createTicket working, solves #3
This commit is contained in:
+10
-8
@@ -3,20 +3,22 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "ticket.h"
|
||||
|
||||
using namespace std;
|
||||
#include "json_serializer.h"
|
||||
|
||||
class Dao {
|
||||
public:
|
||||
string api_key;
|
||||
string db_url;
|
||||
void populate_env();
|
||||
std::string api_key;
|
||||
std::string base_url;
|
||||
|
||||
ticket_t fetch_ticket_create(string title, string description);
|
||||
vector<ticket_t> fetch_ticket_get_all();
|
||||
vector<ticket_t> fetch_ticket_get_by_status(string status);
|
||||
Dao();
|
||||
ticket_t fetch_ticket_create(std::string title, std::string description);
|
||||
std::vector<ticket_t> fetch_ticket_get_all();
|
||||
std::vector<ticket_t> fetch_ticket_get_by_status(std::string status);
|
||||
ticket_t fetch_ticket_get_by_id(unsigned long id);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
|
||||
#include "dao.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int handle_create(Dao *dao, string title, string description);
|
||||
int handle_create(Dao *dao, std::string title, std::string description);
|
||||
int handle_list(Dao *dao);
|
||||
int handle_list(Dao *dao, string status);
|
||||
int handle_list(Dao *dao, std::string status);
|
||||
int handle_detail(Dao *dao, unsigned long id);
|
||||
|
||||
#endif // HANDLER_H
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "ticket.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
// Deserialize JSON -> class
|
||||
void from_json(const json& j, ticket_t& t);
|
||||
|
||||
// Serialize class
|
||||
void to_json(json& j, const ticket_t& t);
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
#include "ticket.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void print_tickets(vector<ticket_t> tickets);
|
||||
void print_tickets(std::vector<ticket_t> tickets);
|
||||
|
||||
#endif // PRINTER_H
|
||||
@@ -2,17 +2,14 @@
|
||||
#define TICKET_H
|
||||
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef struct {
|
||||
unsigned long id;
|
||||
string title;
|
||||
string description;
|
||||
string status;
|
||||
string created_at;
|
||||
string updated_at;
|
||||
std::string title;
|
||||
std::string description;
|
||||
std::string status;
|
||||
std::string created_at;
|
||||
std::string updated_at;
|
||||
} ticket_t;
|
||||
|
||||
#endif // TICKET_H
|
||||
Reference in New Issue
Block a user