createTicket working, solves #3

This commit is contained in:
odweta
2026-08-16 17:41:56 +02:00
parent 94d743edfc
commit 8ae9cccc69
13 changed files with 127 additions and 34 deletions
+23
View File
@@ -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}
};
}