Added better datetime and fixed transaction fetching for beginning of month, I think, added edit and delete of transactions and categories

This commit is contained in:
Nathan Anderson
2023-08-02 01:12:32 -06:00
parent 37250a15fb
commit ef9a7d06e4
8 changed files with 2507 additions and 10 deletions
+12 -7
View File
@@ -73,19 +73,21 @@ pub fn startHttpServer() !void {
router.put("/user", user.putUser);
// router.delete("/user/:id", user.deleteUser);
router.get("/shared_notes/:limit", note.getSharedNotes);
router.put("/shared_notes", note.putSharedNote);
router.post("/shared_notes", note.postSharedNote);
router.get("/shared_note/:limit", note.getSharedNotes);
router.put("/shared_note", note.putSharedNote);
router.post("/shared_note", note.postSharedNote);
// router.get("/budget/:id", budget.getBudget);
// router.put("/budget", budget.putBudget);
// router.post("/budget", budget.postBudget);
router.put("/budget_category", budget.putBudgetCategory);
router.post("/budget_category", budget.postBudgetCategory);
router.put("/budget_category", budget.putBudgetCategory);
router.delete("/budget_category", budget.deleteBudgetCategory);
router.post("/transactions", trans.postTransaction);
router.put("/transactions", trans.putTransaction);
router.post("/transaction", trans.postTransaction);
router.put("/transaction", trans.putTransaction);
router.delete("/transaction", trans.deleteTransaction);
router.get("/dashboard", dash.getDashboard);
@@ -100,7 +102,10 @@ fn notFound(_: *httpz.Request, res: *httpz.Response) !void {
// you can set the body directly to a []u8, but note that the memory
// must be valid beyond your handler. Use the res.arena if you need to allocate
// memory for the body.
res.body = "Not Found";
try res.json(
.{ .success = false, .message = "Not Found" },
.{},
);
}
// note that the error handler return `void` and not `!void`