createTicket working, solves #3
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#include "include/json_serializer.h"
|
||||
|
||||
// Deserialize JSON -> class
|
||||
void from_json(const json& j, ticket_t& t) {
|
||||
t.id = j.at("id").get<int>();
|
||||
t.title = j.at("title").get<std::string>();
|
||||
t.description = j.at("description").get<std::string>();
|
||||
t.status = j.at("status").get<std::string>();
|
||||
t.created_at = j.at("created_at").get<std::string>();
|
||||
t.updated_at = j.at("updated_at").get<std::string>();
|
||||
}
|
||||
|
||||
// Serialize class -> JSON
|
||||
void to_json(json& j, const ticket_t& t) {
|
||||
j = json{
|
||||
{"id", t.id},
|
||||
{"title", t.title},
|
||||
{"description", t.description},
|
||||
{"status", t.status},
|
||||
{"created_at", t.created_at},
|
||||
{"updated_at", t.updated_at}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user