migrate to c++, all layers done except for data access
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#ifndef DAO_H
|
||||
#define DAO_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ticket.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Dao {
|
||||
public:
|
||||
string api_key;
|
||||
string db_url;
|
||||
void populate_env();
|
||||
|
||||
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);
|
||||
ticket_t fetch_ticket_get_by_id(unsigned long id);
|
||||
};
|
||||
|
||||
#endif // DAO_H
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef HANDLER_H
|
||||
#define HANDLER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "dao.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int handle_create(Dao *dao, string title, string description);
|
||||
int handle_list(Dao *dao);
|
||||
int handle_list(Dao *dao, string status);
|
||||
int handle_detail(Dao *dao, unsigned long id);
|
||||
|
||||
#endif // HANDLER_H
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
#include "dao.h"
|
||||
|
||||
int parse_args(Dao *dao, int argc, char *argv[]);
|
||||
|
||||
#endif // PARSER_H
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef PRINTER_H
|
||||
#define PRINTER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ticket.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void print_tickets(vector<ticket_t> tickets);
|
||||
|
||||
#endif // PRINTER_H
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef TICKET_H
|
||||
#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;
|
||||
} ticket_t;
|
||||
|
||||
#endif // TICKET_H
|
||||
Reference in New Issue
Block a user