33 lines
734 B
C++
33 lines
734 B
C++
#ifndef __TASK_H__
|
|
#define __TASK_H__
|
|
|
|
#include <Wt/Dbo/Dbo.h>
|
|
#include <string>
|
|
|
|
class Task;
|
|
using Tasks = Wt::Dbo::collection<Wt::Dbo::ptr<Task>>;
|
|
|
|
class Task {
|
|
public:
|
|
bool finished = false;
|
|
int32_t createTime = 0;
|
|
std::string content;
|
|
std::string comment;
|
|
|
|
Wt::Dbo::ptr<Task> parent;
|
|
Tasks children;
|
|
|
|
template <class Action>
|
|
void persist(Action &a) {
|
|
Wt::Dbo::field(a, content, "content");
|
|
Wt::Dbo::field(a, comment, "comment");
|
|
Wt::Dbo::field(a, finished, "finished");
|
|
Wt::Dbo::field(a, createTime, "create_time");
|
|
|
|
Wt::Dbo::belongsTo(a, parent, "parent");
|
|
Wt::Dbo::hasMany(a, children, Wt::Dbo::ManyToOne, "parent");
|
|
}
|
|
};
|
|
|
|
|
|
#endif // __TASK_H__
|