Older/Server/Database/Task.cpp

22 lines
597 B
C++
Raw Normal View History

2024-01-03 22:44:36 +08:00
#include "Task.h"
#include <boost/json/array.hpp>
#include <boost/json/object.hpp>
#include <boost/json/serialize.hpp>
namespace boost {
namespace json {
std::string serialize(const Tasks &tasks) {
boost::json::array ret;
for (auto &task : tasks) {
boost::json::object t;
t["id"] = task.id;
t["finished"] = task.finished;
t["createTime"] = task.createTime;
t["content"] = task.content;
t["comment"] = task.comment;
ret.push_back(std::move(t));
}
return boost::json::serialize(ret);
}
} // namespace json
} // namespace boost