summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/db/sqlite3/db.c2
-rw-r--r--src/entry.c8
-rw-r--r--src/entry.h5
3 files changed, 13 insertions, 2 deletions
diff --git a/src/db/sqlite3/db.c b/src/db/sqlite3/db.c
index dd46071..36981d4 100644
--- a/src/db/sqlite3/db.c
+++ b/src/db/sqlite3/db.c
@@ -52,7 +52,7 @@ int create_tables(const char *path) {
"CREATE TABLE IF NOT EXISTS 'Entry' ("
"'ID' int NOT NULL PRIMARY KEY, "
"'Group_ID' int NOT NULL, " // FIXME might want foreign key constraint
- // TODO add due_date here once it's figure out
+ "'Due_date' date DEFAULT NULL, "
"'Alt_due_date' varchar(%d) DEFAULT NULL, "
"'Title' varchar(%d) NOT NULL, "
"'Color' varchar(%d) DEFAULT NULL, "
diff --git a/src/entry.c b/src/entry.c
index 2d5f7d0..f996a00 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -3,6 +3,10 @@
#include "entry.h"
// getters
+struct tm entry_get_due_date(Entry *e) {
+ return e->due_date;
+}
+
char *entry_get_alt_due_date(Entry *e) {
return e->alt_due_date;
}
@@ -29,6 +33,10 @@ char *entry_get_url(Entry *e) {
// setters
+void entry_set_due_date(Entry *e, struct tm due_date) {
+ e->due_date = due_date;
+}
+
void entry_set_alt_due_date(Entry *e, char *alt_due_date) {
strcpy(e->alt_due_date, alt_due_date);
}
diff --git a/src/entry.h b/src/entry.h
index a2f637e..298b9b4 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -2,12 +2,13 @@
#define ENTRY_H
#include <stdbool.h>
+#include <time.h>
#include "../config.h"
// a group/category for entries to be put in
typedef struct {
- //TODO due_date
+ struct tm due_date;
char alt_due_date[BUF_LEN];
char title[BUF_LEN];
char color[BUF_LEN]; // TODO consider making an enum
@@ -17,6 +18,7 @@ typedef struct {
} Entry;
// getters
+struct tm entry_get_due_date(Entry *e);
char *entry_get_alt_due_date(Entry *e);
char *entry_get_title(Entry *e);
char *entry_get_color(Entry *e);
@@ -25,6 +27,7 @@ bool entry_get_done(Entry *e);
char *entry_get_url(Entry *e);
// setters
+void entry_set_due_date(Entry *e, struct tm due_date);
void entry_set_alt_due_date(Entry *e, char *alt_due_date);
void entry_set_title(Entry *e, char *title);
void entry_set_color(Entry *e, char *color);