diff --git a/backend/src/controllers.h b/backend/src/controllers.h index 87d7b4a..0951a02 100644 --- a/backend/src/controllers.h +++ b/backend/src/controllers.h @@ -1,7 +1,7 @@ #pragma once #include "db.h" -#include "http.h" +#include "http/http.h" #include #include diff --git a/backend/src/controllers/carts.c b/backend/src/controllers/carts.c index 3f560e4..3c94384 100644 --- a/backend/src/controllers/carts.c +++ b/backend/src/controllers/carts.c @@ -1,5 +1,4 @@ #include "../controllers.h" -#include "../http_server.h" #include "../models_json.h" #include "../str_util.h" @@ -10,17 +9,16 @@ void route_get_cart_items_from_session(HttpCtx* ctx) if (!session) return; - CartItemVec cart_items; cart_item_vec_construct(&cart_items); - DbRes db_res = db_cart_items_with_user_id(cx->db, &cart_items, session->user_id); + DbRes db_res + = db_cart_items_with_user_id(cx->db, &cart_items, session->user_id); if (db_res != DbRes_Ok) { RESPOND_BAD_REQUEST(ctx, "Could not find cart for user"); return; } - String res; string_construct(&res); @@ -35,7 +33,6 @@ void route_get_cart_items_from_session(HttpCtx* ctx) } string_push_str(&res, "]}"); - cart_item_vec_destroy(&cart_items); RESPOND_JSON(ctx, 200, "%s", res.data); string_destroy(&res); diff --git a/backend/src/controllers/general.c b/backend/src/controllers/general.c index db31270..23750cb 100644 --- a/backend/src/controllers/general.c +++ b/backend/src/controllers/general.c @@ -1,12 +1,13 @@ #include "../controllers.h" -#include "../http.h" +#include "../http/http.h" #include "../models_json.h" void route_get_index(HttpCtx* ctx) { Cx* cx = http_ctx_user_ctx(ctx); - RESPOND_HTML(ctx, 200, + RESPOND_HTML(ctx, + 200, "

Number = %d

", cx->number); @@ -39,7 +40,8 @@ l0_return: void route_get_not_found(HttpCtx* ctx) { - RESPOND_HTML(ctx, 404, + RESPOND_HTML(ctx, + 404, "

404 Not " "Found

GET " diff --git a/backend/src/controllers/products.c b/backend/src/controllers/products.c index 7f0a58b..b726640 100644 --- a/backend/src/controllers/products.c +++ b/backend/src/controllers/products.c @@ -1,5 +1,5 @@ #include "../controllers.h" -#include "../http.h" +#include "../http/http.h" #include "../models_json.h" #include "../str_util.h" diff --git a/backend/src/controllers/sessions.c b/backend/src/controllers/sessions.c index 5404cab..58fab06 100644 --- a/backend/src/controllers/sessions.c +++ b/backend/src/controllers/sessions.c @@ -1,5 +1,5 @@ #include "../controllers.h" -#include "../http.h" +#include "../http/http.h" #include "../models_json.h" #include "../str_util.h" #include diff --git a/backend/src/controllers/users.c b/backend/src/controllers/users.c index 4968588..fb1407d 100644 --- a/backend/src/controllers/users.c +++ b/backend/src/controllers/users.c @@ -1,5 +1,5 @@ #include "../controllers.h" -#include "../http.h" +#include "../http/http.h" #include "../models_json.h" #include "../str_util.h" #include diff --git a/backend/src/http.h b/backend/src/http/http.h similarity index 100% rename from backend/src/http.h rename to backend/src/http/http.h diff --git a/backend/src/http/server.c b/backend/src/http/server.c index e284ff6..ba92f68 100644 --- a/backend/src/http/server.c +++ b/backend/src/http/server.c @@ -1,6 +1,6 @@ #include "server.h" -#include "../http.h" #include "../str_util.h" +#include "http.h" #include #include #include diff --git a/backend/src/http/server.h b/backend/src/http/server.h index 08d13c8..c6661b9 100644 --- a/backend/src/http/server.h +++ b/backend/src/http/server.h @@ -1,8 +1,8 @@ #pragma once #include "../collection.h" -#include "../http.h" #include "client_connection.h" +#include "http.h" #include "packet.h" #include "request.h" #include "worker.h" diff --git a/backend/src/http/worker.h b/backend/src/http/worker.h index 1cd2b98..ae10f5b 100644 --- a/backend/src/http/worker.h +++ b/backend/src/http/worker.h @@ -1,7 +1,7 @@ #pragma once -#include "../http.h" #include "client_connection.h" +#include "http.h" #include typedef struct { diff --git a/backend/src/main.c b/backend/src/main.c index 301f0a4..bb87999 100644 --- a/backend/src/main.c +++ b/backend/src/main.c @@ -1,6 +1,6 @@ #include "controllers.h" #include "db_sqlite.h" -#include "http.h" +#include "http/http.h" #include "json.h" #include "models.h" #include "models_json.h"