Older/Database/Task.h
amass e0bac3a19b
All checks were successful
Deploy / Build (push) Successful in 6m12s
add task deadline.
2025-01-17 17:56:03 +08:00

35 lines
890 B
C++

#ifndef __TASK_H__
#define __TASK_H__
#include <Wt/Dbo/Dbo.h>
#include <Wt/Dbo/StdSqlTraits.h>
#include <string>
class Task;
using Tasks = Wt::Dbo::collection<Wt::Dbo::ptr<Task>>;
class Task {
public:
bool finished = false;
std::chrono::system_clock::time_point createTime;
std::chrono::system_clock::time_point deadline;
std::string content;
std::string remark;
Wt::Dbo::ptr<Task> parent;
Tasks children;
template <class Action>
void persist(Action &a) {
Wt::Dbo::field(a, content, "content");
Wt::Dbo::field(a, deadline, "deadline");
Wt::Dbo::field(a, remark, "remark");
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__