{ "openapi": "3.1.0", "info": { "title": "Api", "version": "0.1.0", "description": "Jatek Food Delivery API" }, "servers": [ { "url": "/api", "description": "Base API path" } ], "tags": [ { "name": "health", "description": "Health operations" }, { "name": "auth", "description": "Authentication operations" }, { "name": "restaurants", "description": "Restaurant operations" }, { "name": "menu", "description": "Menu item operations" }, { "name": "orders", "description": "Order operations" }, { "name": "users", "description": "User operations" }, { "name": "drivers", "description": "Driver operations" }, { "name": "reviews", "description": "Review operations" }, { "name": "admin", "description": "Admin operations" }, { "name": "rewards", "description": "Rewards and loyalty operations" }, { "name": "storage", "description": "Object storage upload and serving endpoints" }, { "name": "backend", "description": "Backend dashboard operations (super_admin / admin / manager / merchant / employee)" }, { "name": "favorites", "description": "Favorite restaurant operations" }, { "name": "addresses", "description": "Saved delivery address operations" }, { "name": "paymentMethods", "description": "Saved payment method operations" }, { "name": "supportTickets", "description": "Customer support ticket operations" }, { "name": "notificationPrefs", "description": "Notification preference operations" }, { "name": "userConsents", "description": "Privacy consent and account data operations" }, { "name": "quotes", "description": "Quote and invoice operations" }, { "name": "events", "description": "Server-sent event subscriptions" } ], "paths": { "/addresses": { "get": { "operationId": "listAddresses", "tags": [ "addresses" ], "summary": "List current user's addresses", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "addresses", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Address" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createAddress", "tags": [ "addresses" ], "summary": "Create a address", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddressBody" } } } }, "responses": { "201": { "description": "address created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Address" } } } }, "400": { "description": "Invalid payload", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/addresses/{id}": { "patch": { "operationId": "updateAddress", "tags": [ "addresses" ], "summary": "Update a address", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAddressBody" } } } }, "responses": { "200": { "description": "address updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Address" } } } }, "400": { "description": "Invalid payload", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteAddress", "tags": [ "addresses" ], "summary": "Delete a address", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/admin/recent-orders": { "get": { "operationId": "getRecentOrders", "tags": [ "admin" ], "summary": "Get recent orders for admin dashboard", "responses": { "200": { "description": "Recent orders", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } } }, "security": [ { "bearerAuth": [] } ] } }, "/admin/stats": { "get": { "operationId": "getAdminStats", "tags": [ "admin" ], "summary": "Get admin dashboard statistics", "responses": { "200": { "description": "Admin stats", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AdminStats" } } } } }, "security": [ { "bearerAuth": [] } ] } }, "/auth/forgot-password": { "post": { "operationId": "forgotPassword", "tags": [ "auth" ], "summary": "Send a password reset OTP to the phone attached to an email", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ForgotPasswordBody" } } } }, "responses": { "200": { "description": "Reset request accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PasswordResetRequestResponse" } } } }, "400": { "description": "Email missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/login": { "post": { "operationId": "login", "tags": [ "auth" ], "summary": "Login", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginBody" } } } }, "responses": { "200": { "description": "Logged in", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/logout": { "post": { "operationId": "logout", "tags": [ "auth" ], "summary": "Logout", "responses": { "200": { "description": "Logged out", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } } } } }, "/auth/me": { "get": { "operationId": "getMe", "tags": [ "auth" ], "summary": "Get current user", "responses": { "200": { "description": "Current user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } }, "security": [ { "bearerAuth": [] } ] }, "delete": { "operationId": "deleteAuthMe", "tags": [ "auth" ], "summary": "Delete the current authenticated user account", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Account deleted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } }, "401": { "description": "Invalid or missing token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/register": { "post": { "operationId": "register", "tags": [ "auth" ], "summary": "Register a new user", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RegisterBody" } } } }, "responses": { "201": { "description": "User registered", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/reset-password": { "post": { "operationId": "resetPassword", "tags": [ "auth" ], "summary": "Reset password with OTP and login", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetPasswordBody" } } } }, "responses": { "200": { "description": "Password reset", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PasswordResetResponse" } } } }, "400": { "description": "Invalid or expired reset code", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/send-otp": { "post": { "operationId": "sendOtp", "tags": [ "auth" ], "summary": "Send OTP to phone number", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SendOtpBody" } } } }, "responses": { "200": { "description": "OTP sent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SendOtpResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limited", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/update-name": { "patch": { "operationId": "updateAuthName", "tags": [ "auth" ], "summary": "Update the current user name after OTP signup", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateNameBody" } } } }, "responses": { "200": { "description": "Updated user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserEnvelope" } } } }, "400": { "description": "Invalid name", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Invalid or missing token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/auth/verify-otp": { "post": { "operationId": "verifyOtp", "tags": [ "auth" ], "summary": "Verify OTP and authenticate", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyOtpBody" } } } }, "responses": { "200": { "description": "OTP verified, user authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthResponse" } } } }, "400": { "description": "Invalid or expired OTP", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/backend/categories": { "get": { "operationId": "listBackendCategories", "tags": [ "backend" ], "summary": "List shop/restaurant categories (distinct values from shops)", "responses": { "200": { "description": "Categories", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/CategoryEntry" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/customers": { "get": { "operationId": "listBackendCustomers", "tags": [ "backend" ], "summary": "List customers", "parameters": [ { "name": "search", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Customers", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/dashboard": { "get": { "operationId": "getBackendDashboard", "tags": [ "backend" ], "summary": "Aggregate stats for the backend dashboard", "parameters": [ { "name": "range", "in": "query", "schema": { "type": "string", "enum": [ "week", "month", "year" ], "default": "month" } } ], "responses": { "200": { "description": "Dashboard data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BackendDashboard" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/deliverymen": { "get": { "operationId": "listBackendDeliverymen", "tags": [ "backend" ], "summary": "List delivery drivers", "responses": { "200": { "description": "Drivers", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Driver" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/login": { "post": { "operationId": "backendLogin", "tags": [ "backend" ], "summary": "Login to the backend dashboard (staff only)", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginBody" } } } }, "responses": { "200": { "description": "Logged in", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthResponse" } } } }, "401": { "description": "Unauthorized or insufficient role", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/backend/me": { "get": { "operationId": "backendMe", "tags": [ "backend" ], "summary": "Get current backend user with permissions", "responses": { "200": { "description": "Current backend user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BackendMe" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/orders": { "get": { "operationId": "listBackendOrders", "tags": [ "backend" ], "summary": "List orders (filtered by role scope)", "parameters": [ { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "shopId", "in": "query", "schema": { "type": "integer" } }, { "name": "search", "in": "query", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 50 } } ], "responses": { "200": { "description": "Orders", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/products": { "get": { "operationId": "listBackendProducts", "tags": [ "backend" ], "summary": "List products (menu items, filtered by role scope)", "parameters": [ { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "shopId", "in": "query", "schema": { "type": "integer" } }, { "name": "search", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Products", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MenuItem" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/reviews": { "get": { "operationId": "listBackendReviews", "tags": [ "backend" ], "summary": "List shop reviews", "parameters": [ { "name": "shopId", "in": "query", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Reviews", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Review" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/roles": { "get": { "operationId": "listBackendRoles", "tags": [ "backend" ], "summary": "List roles + permission matrix", "responses": { "200": { "description": "Roles", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/RoleDef" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/shops": { "get": { "operationId": "listBackendShops", "tags": [ "backend" ], "summary": "List shops (filtered by role scope)", "parameters": [ { "name": "search", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Shops", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Restaurant" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/staff": { "get": { "operationId": "listBackendStaff", "tags": [ "backend" ], "summary": "List staff & admin users (admin only)", "responses": { "200": { "description": "Staff users", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." }, "post": { "operationId": "createBackendStaff", "tags": [ "backend" ], "summary": "Create a staff/admin user (admin only)", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateStaffBody" } } } }, "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/staff/{id}": { "patch": { "operationId": "updateBackendStaff", "tags": [ "backend" ], "summary": "Update staff user", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateStaffBody" } } } }, "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." }, "delete": { "operationId": "deleteBackendStaff", "tags": [ "backend" ], "summary": "Delete staff user", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/todos": { "get": { "operationId": "listBackendTodos", "tags": [ "backend" ], "summary": "List dashboard todos for current user", "responses": { "200": { "description": "Todos", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/DashboardTodo" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." }, "post": { "operationId": "createBackendTodo", "tags": [ "backend" ], "summary": "Create a todo", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateTodoBody" } } } }, "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DashboardTodo" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/backend/todos/{id}": { "patch": { "operationId": "toggleBackendTodo", "tags": [ "backend" ], "summary": "Toggle done status of a todo", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "done": { "type": "boolean" } }, "required": [ "done" ] } } } }, "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DashboardTodo" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." }, "delete": { "operationId": "deleteBackendTodo", "tags": [ "backend" ], "summary": "Delete a todo", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden by backend dashboard RBAC", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Backend dashboard RBAC applies by staff role and scoped shop access." } }, "/consents": { "get": { "operationId": "getUserConsents", "tags": [ "userConsents" ], "summary": "Get privacy consents and current legal versions", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "User consents", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserConsentsWithVersions" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "patch": { "operationId": "updateUserConsents", "tags": [ "userConsents" ], "summary": "Update privacy consents", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUserConsentsBody" } } } }, "responses": { "200": { "description": "User consents updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserConsents" } } } }, "400": { "description": "No valid fields to update", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/consents/accept-all": { "post": { "operationId": "acceptAllConsents", "tags": [ "userConsents" ], "summary": "Accept all privacy consents", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "All consents accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserConsents" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/consents/reject-all": { "post": { "operationId": "rejectAllConsents", "tags": [ "userConsents" ], "summary": "Reject optional privacy consents", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Optional consents rejected", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserConsents" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/drivers": { "get": { "operationId": "listDrivers", "tags": [ "drivers" ], "summary": "List drivers", "parameters": [ { "name": "isAvailable", "in": "query", "schema": { "type": "boolean" } } ], "responses": { "200": { "description": "Drivers", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Driver" } } } } } } } }, "/drivers/{id}": { "get": { "operationId": "getDriver", "tags": [ "drivers" ], "summary": "Get a driver", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Driver", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Driver" } } } } } }, "patch": { "operationId": "updateDriver", "tags": [ "drivers" ], "summary": "Update driver info", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateDriverBody" } } } }, "responses": { "200": { "description": "Updated driver", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Driver" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Driver owner or admin only." } }, "/drivers/{id}/complete-profile": { "post": { "operationId": "completeDriverProfile", "tags": [ "drivers" ], "summary": "Complete a driver profile", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompleteDriverProfileBody" } } } }, "responses": { "200": { "description": "Driver profile completed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Driver" } } } }, "400": { "description": "Invalid profile data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Driver not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/drivers/{id}/earnings": { "get": { "operationId": "getDriverEarnings", "tags": [ "drivers" ], "summary": "Get driver earnings summary", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Driver earnings", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DriverEarnings" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Driver owner or admin only." } }, "/drivers/{id}/location": { "patch": { "operationId": "updateDriverLocation", "tags": [ "drivers" ], "summary": "Update driver live location", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DriverLocationUpdateBody" } } } }, "responses": { "200": { "description": "Driver location updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DriverLocation" } } } }, "400": { "description": "Invalid coordinates", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Driver not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "get": { "operationId": "getDriverLocation", "tags": [ "drivers" ], "summary": "Get driver live location", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Driver location", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DriverLocationPublic" } } } }, "400": { "description": "Invalid driver id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Driver not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/events": { "get": { "operationId": "subscribeEvents", "tags": [ "events" ], "summary": "Subscribe to server-sent events", "parameters": [ { "name": "channels", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Comma-separated channels such as order:5,restaurant:2,available_orders,driver:7." } ], "responses": { "200": { "description": "SSE stream", "content": { "text/event-stream": { "schema": { "type": "string" } } } }, "400": { "description": "channels query param required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/favorites": { "get": { "operationId": "listFavorites", "tags": [ "favorites" ], "summary": "List favorite restaurants for current user", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Favorites", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/FavoriteWithRestaurant" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "addFavorite", "tags": [ "favorites" ], "summary": "Add a restaurant to favorites", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FavoriteBody" } } } }, "responses": { "200": { "description": "Existing favorite", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Favorite" } } } }, "201": { "description": "Favorite created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Favorite" } } } }, "400": { "description": "restaurantId required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/favorites/{restaurantId}": { "delete": { "operationId": "deleteFavorite", "tags": [ "favorites" ], "summary": "Remove a restaurant from favorites", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "restaurantId", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/healthz": { "get": { "operationId": "healthCheck", "tags": [ "health" ], "summary": "Health check", "responses": { "200": { "description": "Healthy", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthStatus" } } } } } } }, "/me": { "delete": { "operationId": "deleteMyData", "tags": [ "userConsents" ], "summary": "Delete current user account and related data", "security": [ { "bearerAuth": [] } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/me/export": { "get": { "operationId": "exportMyData", "tags": [ "userConsents" ], "summary": "Export current user personal data", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Personal data export", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDataExport" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/menu/{id}": { "get": { "operationId": "getMenuItem", "tags": [ "menu" ], "summary": "Get a menu item", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Menu item", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MenuItem" } } } } }, "security": [ { "bearerAuth": [] } ] }, "patch": { "operationId": "updateMenuItem", "tags": [ "menu" ], "summary": "Update a menu item", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateMenuItemBody" } } } }, "responses": { "200": { "description": "Updated menu item", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MenuItem" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "RBAC: admin or owning restaurant_owner." }, "delete": { "operationId": "deleteMenuItem", "tags": [ "menu" ], "summary": "Delete a menu item", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" } }, "security": [ { "bearerAuth": [] } ], "description": "RBAC: admin or owning restaurant_owner." } }, "/notification-prefs": { "get": { "operationId": "getNotificationPrefs", "tags": [ "notificationPrefs" ], "summary": "Get notification preferences", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Notification preferences", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationPrefs" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "patch": { "operationId": "updateNotificationPrefs", "tags": [ "notificationPrefs" ], "summary": "Update notification preferences", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateNotificationPrefsBody" } } } }, "responses": { "200": { "description": "Notification preferences updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationPrefs" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/orders": { "get": { "operationId": "listOrders", "tags": [ "orders" ], "summary": "List orders", "parameters": [ { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "userId", "in": "query", "schema": { "type": "integer" } }, { "name": "restaurantId", "in": "query", "schema": { "type": "integer" } }, { "name": "driverId", "in": "query", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Orders", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Customers are scoped to their own orders unless using restaurant/driver filters as allowed by role." }, "post": { "operationId": "createOrder", "tags": [ "orders" ], "summary": "Place a new order", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateOrderBody" } } } }, "responses": { "201": { "description": "Order created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Creates an order for the current user." } }, "/orders/{id}": { "get": { "operationId": "getOrder", "tags": [ "orders" ], "summary": "Get an order", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Order", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ {}, { "bearerAuth": [] } ] } }, "/orders/{id}/accept-delivery": { "post": { "operationId": "acceptOrderDelivery", "tags": [ "orders" ], "summary": "Driver accepts a ready order for delivery", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AcceptDeliveryBody" } } } }, "responses": { "200": { "description": "Order assigned to driver", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "400": { "description": "Invalid driver id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Order or driver not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Order no longer available", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "412": { "description": "Driver profile incomplete", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/orders/{id}/confirm-delivery": { "post": { "operationId": "confirmOrderDelivery", "tags": [ "orders" ], "summary": "Driver confirms delivery using the customer pickup code", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmDeliveryBody" } } } }, "responses": { "200": { "description": "Order delivered", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "400": { "description": "Invalid pickup code", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Order not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Order is not in transit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/orders/{id}/invoice": { "get": { "operationId": "getOrderInvoice", "tags": [ "quotes" ], "summary": "Get printable order invoice HTML", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "token", "in": "query", "required": false, "schema": { "type": "string" }, "description": "JWT token alternative for browser-opened document URLs." } ], "responses": { "200": { "description": "Invoice HTML", "content": { "text/html": { "schema": { "type": "string" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Forbidden" }, "404": { "description": "Order not found" } } } }, "/orders/{id}/receipt": { "get": { "operationId": "getOrderReceipt", "tags": [ "orders" ], "summary": "Get printable kitchen receipt HTML", "description": "Restricted to admin or the owning restaurant owner. Supports bearer auth and token query auth.", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "token", "in": "query", "required": false, "schema": { "type": "string" }, "description": "JWT token alternative for browser-opened document URLs." } ], "responses": { "200": { "description": "Printable receipt HTML", "content": { "text/html": { "schema": { "type": "string" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Forbidden" }, "404": { "description": "Order or restaurant not found" } } } }, "/orders/{id}/status": { "patch": { "operationId": "updateOrderStatus", "tags": [ "orders" ], "summary": "Update order status", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateOrderStatusBody" } } } }, "responses": { "200": { "description": "Updated order", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Additional role/ownership checks apply when accepting restaurant orders or assigning drivers." } }, "/orders/active": { "get": { "operationId": "getActiveOrders", "tags": [ "orders" ], "summary": "Get active orders for current driver", "responses": { "200": { "description": "Active orders", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } } } } }, "/orders/available": { "get": { "operationId": "getAvailableOrders", "tags": [ "orders" ], "summary": "List ready orders available for driver pickup", "responses": { "200": { "description": "Available orders", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } } } } }, "/payment-methods": { "get": { "operationId": "listPaymentMethods", "tags": [ "paymentMethods" ], "summary": "List current user's payment methods", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "payment methods", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/PaymentMethod" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createPaymentMethod", "tags": [ "paymentMethods" ], "summary": "Create a payment method", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentMethodBody" } } } }, "responses": { "201": { "description": "payment method created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentMethod" } } } }, "400": { "description": "Invalid payload", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/payment-methods/{id}": { "patch": { "operationId": "updatePaymentMethod", "tags": [ "paymentMethods" ], "summary": "Update a payment method", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdatePaymentMethodBody" } } } }, "responses": { "200": { "description": "payment method updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentMethod" } } } }, "400": { "description": "Invalid payload", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deletePaymentMethod", "tags": [ "paymentMethods" ], "summary": "Delete a payment method", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/quotes": { "post": { "operationId": "createQuote", "tags": [ "quotes" ], "summary": "Request a quote from a merchant", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateQuoteBody" } } } }, "responses": { "201": { "description": "Quote created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Quote" } } } }, "400": { "description": "Invalid quote request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Merchant not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "get": { "operationId": "listQuotes", "tags": [ "quotes" ], "summary": "List quotes visible to the current user", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "restaurantId", "in": "query", "required": false, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Quotes", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Quote" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Not your restaurant", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/quotes/{id}": { "get": { "operationId": "getQuote", "tags": [ "quotes" ], "summary": "Get a quote", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Quote", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Quote" } } } }, "400": { "description": "Invalid id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "patch": { "operationId": "updateQuote", "tags": [ "quotes" ], "summary": "Update a quote status or merchant offer", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateQuoteBody" } } } }, "responses": { "200": { "description": "Quote updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Quote" } } } }, "400": { "description": "Invalid update", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/quotes/{id}/pdf": { "get": { "operationId": "getQuotePdf", "tags": [ "quotes" ], "summary": "Get printable quote document HTML", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "token", "in": "query", "required": false, "schema": { "type": "string" }, "description": "JWT token alternative for browser-opened document URLs." } ], "responses": { "200": { "description": "Quote document HTML", "content": { "text/html": { "schema": { "type": "string" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Forbidden" }, "404": { "description": "Quote not found" } } } }, "/restaurants": { "get": { "operationId": "listRestaurants", "tags": [ "restaurants" ], "summary": "List restaurants", "parameters": [ { "name": "search", "in": "query", "schema": { "type": "string" } }, { "name": "category", "in": "query", "schema": { "type": "string" } }, { "name": "isLocal", "in": "query", "schema": { "type": "boolean" } }, { "name": "isOpen", "in": "query", "schema": { "type": "boolean" } }, { "name": "businessType", "in": "query", "schema": { "type": "string" } }, { "name": "ownerId", "in": "query", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "List of restaurants", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Restaurant" } } } } } } }, "post": { "operationId": "createRestaurant", "tags": [ "restaurants" ], "summary": "Create a restaurant", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateRestaurantBody" } } } }, "responses": { "201": { "description": "Restaurant created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Restaurant" } } } } }, "description": "RBAC: admin only." } }, "/restaurants/{id}": { "get": { "operationId": "getRestaurant", "tags": [ "restaurants" ], "summary": "Get a restaurant", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Restaurant", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Restaurant" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "patch": { "operationId": "updateRestaurant", "tags": [ "restaurants" ], "summary": "Update a restaurant", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateRestaurantBody" } } } }, "responses": { "200": { "description": "Updated restaurant", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Restaurant" } } } } }, "description": "RBAC: admin or owning restaurant_owner." }, "delete": { "operationId": "deleteRestaurant", "tags": [ "restaurants" ], "summary": "Delete a restaurant", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" } }, "description": "RBAC: admin only." } }, "/restaurants/{id}/complete-profile": { "post": { "operationId": "completeRestaurantProfile", "tags": [ "restaurants" ], "summary": "Complete a restaurant business profile", "description": "RBAC: admin or the owning restaurant_owner. Required before accepting orders.", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompleteRestaurantProfileBody" } } } }, "responses": { "200": { "description": "Restaurant profile completed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Restaurant" } } } }, "400": { "description": "Invalid profile data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Restaurant not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/restaurants/{id}/stats": { "get": { "operationId": "getRestaurantStats", "tags": [ "restaurants" ], "summary": "Get restaurant statistics", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Restaurant statistics", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RestaurantStats" } } } } } } }, "/restaurants/{restaurantId}/menu": { "get": { "operationId": "listMenuItems", "tags": [ "menu" ], "summary": "List menu items for a restaurant", "parameters": [ { "name": "restaurantId", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "category", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Menu items", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MenuItem" } } } } } } }, "post": { "operationId": "createMenuItem", "tags": [ "menu" ], "summary": "Create a menu item", "parameters": [ { "name": "restaurantId", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateMenuItemBody" } } } }, "responses": { "201": { "description": "Menu item created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MenuItem" } } } } }, "description": "RBAC: admin or owning restaurant_owner." } }, "/restaurants/featured": { "get": { "operationId": "getFeaturedRestaurants", "tags": [ "restaurants" ], "summary": "Get featured/top restaurants", "responses": { "200": { "description": "Featured restaurants", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Restaurant" } } } } } } } }, "/reviews": { "get": { "operationId": "listReviews", "tags": [ "reviews" ], "summary": "List reviews", "parameters": [ { "name": "restaurantId", "in": "query", "schema": { "type": "integer" } }, { "name": "userId", "in": "query", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Reviews", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Review" } } } } } }, "security": [ { "bearerAuth": [] } ] }, "post": { "operationId": "createReview", "tags": [ "reviews" ], "summary": "Create a review", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateReviewBody" } } } }, "responses": { "201": { "description": "Review created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Review" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required." } }, "/reviews/{id}": { "delete": { "operationId": "deleteReview", "tags": [ "reviews" ], "summary": "Delete a review", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Review author or admin only." } }, "/rewards/my": { "get": { "operationId": "getMyRewards", "tags": [ "rewards" ], "summary": "Get current user rewards/points", "responses": { "200": { "description": "User rewards", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserRewards" } } } } }, "security": [ {}, { "bearerAuth": [] } ] } }, "/storage/objects/{path}": { "get": { "operationId": "getObject", "tags": [ "storage" ], "summary": "Serve an uploaded object", "parameters": [ { "name": "path", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Object bytes", "content": { "*/*": { "schema": { "type": "string", "format": "binary" } } } }, "404": { "description": "Object not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Failed to serve object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/storage/public-objects/{filePath}": { "get": { "operationId": "getPublicObject", "tags": [ "storage" ], "summary": "Serve a public object", "parameters": [ { "name": "filePath", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Object bytes", "content": { "*/*": { "schema": { "type": "string", "format": "binary" } } } }, "404": { "description": "File not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Failed to serve public object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/storage/uploads/request-url": { "post": { "operationId": "requestUploadUrl", "tags": [ "storage" ], "summary": "Request a presigned URL for file upload", "description": "RBAC: admin or restaurant_owner only.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadUrlRequest" } } } }, "responses": { "200": { "description": "Presigned upload URL generated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadUrlResponse" } } } }, "400": { "description": "Missing or invalid required fields", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Failed to generate upload URL", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "security": [ { "bearerAuth": [] } ] } }, "/support-tickets": { "get": { "operationId": "listSupportTickets", "tags": [ "supportTickets" ], "summary": "List support tickets", "description": "Admins receive all tickets with user details; other users receive only their own tickets.", "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Support tickets", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/SupportTicket" } } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createSupportTicket", "tags": [ "supportTickets" ], "summary": "Create a support ticket", "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateSupportTicketBody" } } } }, "responses": { "201": { "description": "Ticket created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SupportTicket" } } } }, "400": { "description": "Invalid ticket", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/support-tickets/{id}": { "patch": { "operationId": "updateSupportTicket", "tags": [ "supportTickets" ], "summary": "Update support ticket status", "description": "Admin only.", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateSupportTicketBody" } } } }, "responses": { "200": { "description": "Ticket updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SupportTicket" } } } }, "400": { "description": "Invalid status", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Admin only", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Ticket not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteSupportTicket", "tags": [ "supportTickets" ], "summary": "Delete a support ticket", "description": "Admin only.", "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" }, "401": { "description": "Authentication required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Admin only", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/users": { "get": { "operationId": "listUsers", "tags": [ "users" ], "summary": "List users (admin)", "parameters": [ { "name": "role", "in": "query", "schema": { "type": "string" } }, { "name": "search", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Users", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } } } } } }, "/users/{id}": { "get": { "operationId": "getUser", "tags": [ "users" ], "summary": "Get a user", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "User", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } } }, "patch": { "operationId": "updateUser", "tags": [ "users" ], "summary": "Update a user", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUserBody" } } } }, "responses": { "200": { "description": "Updated user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Users can update themselves; admins can update any user." }, "delete": { "operationId": "deleteUser", "tags": [ "users" ], "summary": "Delete a user (admin)", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Deleted" } }, "security": [ { "bearerAuth": [] } ], "description": "JWT required. Users can delete themselves; admins can delete any user." } } }, "components": { "schemas": { "HealthStatus": { "type": "object", "properties": { "status": { "type": "string" } }, "required": [ "status" ] }, "ErrorResponse": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] }, "SuccessResponse": { "type": "object", "properties": { "success": { "type": "boolean" } }, "required": [ "success" ] }, "RegisterBody": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" }, "role": { "type": "string", "enum": [ "customer", "driver", "restaurant_owner", "admin" ] }, "phone": { "type": [ "string", "null" ] } }, "required": [ "name", "email", "password", "role" ] }, "LoginBody": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "required": [ "email", "password" ] }, "AuthResponse": { "type": "object", "properties": { "token": { "type": "string" }, "user": { "$ref": "#/components/schemas/User" } }, "required": [ "token", "user" ] }, "SendOtpBody": { "type": "object", "properties": { "phone": { "type": "string" }, "name": { "type": "string" }, "channel": { "type": "string", "enum": [ "sms", "whatsapp" ], "description": "Delivery channel for the OTP code" } }, "required": [ "phone" ] }, "SendOtpResponse": { "type": "object", "properties": { "success": { "type": "boolean" }, "message": { "type": "string" }, "demoOtp": { "type": "string" } }, "required": [ "success", "message" ] }, "VerifyOtpBody": { "type": "object", "properties": { "phone": { "type": "string" }, "code": { "type": "string" }, "name": { "type": "string" }, "role": { "type": "string" } }, "required": [ "phone", "code" ] }, "User": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "email": { "type": "string" }, "role": { "type": "string" }, "phone": { "type": [ "string", "null" ] }, "address": { "type": [ "string", "null" ] }, "avatarUrl": { "type": [ "string", "null" ] }, "isActive": { "type": "boolean" }, "loyaltyPoints": { "type": "integer" }, "createdAt": { "type": "string", "format": "date-time" }, "assignedShopId": { "type": [ "integer", "null" ] } }, "required": [ "id", "name", "email", "role", "isActive", "loyaltyPoints", "createdAt" ] }, "UpdateUserBody": { "type": "object", "properties": { "name": { "type": "string" }, "phone": { "type": "string" }, "address": { "type": "string" }, "avatarUrl": { "type": "string" }, "isActive": { "type": "boolean" } } }, "Restaurant": { "type": "object", "properties": { "id": { "type": "integer" }, "ownerId": { "type": "integer" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "address": { "type": "string" }, "phone": { "type": [ "string", "null" ] }, "imageUrl": { "type": [ "string", "null" ] }, "coverImageUrl": { "type": [ "string", "null" ] }, "logoUrl": { "type": [ "string", "null" ] }, "category": { "type": "string" }, "businessType": { "type": "string" }, "isLocal": { "type": "boolean" }, "isOpen": { "type": "boolean" }, "deliveryTime": { "type": [ "integer", "null" ] }, "deliveryFee": { "type": [ "number", "null" ] }, "minimumOrder": { "type": [ "number", "null" ] }, "rating": { "type": [ "number", "null" ] }, "reviewCount": { "type": "integer" }, "isVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "legalName": { "type": [ "string", "null" ] }, "ice": { "type": [ "string", "null" ] }, "printerEmail": { "type": [ "string", "null" ] }, "profileCompletedAt": { "type": [ "string", "null" ], "format": "date-time" }, "freeDeliveryThreshold": { "type": "number", "description": "Defaulted by the API when not stored on the restaurant row." } }, "required": [ "id", "ownerId", "name", "address", "category", "businessType", "isLocal", "isOpen", "reviewCount", "isVerified", "createdAt" ] }, "CreateRestaurantBody": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "address": { "type": "string" }, "phone": { "type": "string" }, "imageUrl": { "type": "string" }, "coverImageUrl": { "type": "string" }, "logoUrl": { "type": [ "string", "null" ] }, "category": { "type": "string" }, "businessType": { "type": "string" }, "isLocal": { "type": "boolean" }, "deliveryTime": { "type": "integer" }, "deliveryFee": { "type": "number" }, "minimumOrder": { "type": "number" } }, "required": [ "name", "address", "category" ] }, "UpdateRestaurantBody": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "address": { "type": "string" }, "phone": { "type": "string" }, "imageUrl": { "type": "string" }, "coverImageUrl": { "type": "string" }, "logoUrl": { "type": [ "string", "null" ] }, "category": { "type": "string" }, "businessType": { "type": "string" }, "isLocal": { "type": "boolean" }, "isOpen": { "type": "boolean" }, "deliveryTime": { "type": "integer" }, "deliveryFee": { "type": "number" }, "minimumOrder": { "type": "number" }, "isVerified": { "type": "boolean" } } }, "RestaurantStats": { "type": "object", "properties": { "totalOrders": { "type": "integer" }, "completedOrders": { "type": "integer" }, "totalRevenue": { "type": "number" }, "averageRating": { "type": [ "number", "null" ] }, "totalReviews": { "type": "integer" }, "pendingOrders": { "type": "integer" } }, "required": [ "totalOrders", "completedOrders", "totalRevenue", "totalReviews", "pendingOrders" ] }, "MenuItem": { "type": "object", "properties": { "id": { "type": "integer" }, "restaurantId": { "type": "integer" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "price": { "type": "number" }, "imageUrl": { "type": [ "string", "null" ] }, "category": { "type": "string" }, "isAvailable": { "type": "boolean" }, "isPopular": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "restaurantId", "name", "price", "category", "isAvailable", "isPopular", "createdAt" ] }, "CreateMenuItemBody": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "imageUrl": { "type": "string" }, "category": { "type": "string" }, "isAvailable": { "type": "boolean" }, "isPopular": { "type": "boolean" } }, "required": [ "name", "price", "category" ] }, "UpdateMenuItemBody": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "imageUrl": { "type": "string" }, "category": { "type": "string" }, "isAvailable": { "type": "boolean" }, "isPopular": { "type": "boolean" } } }, "OrderItem": { "type": "object", "properties": { "id": { "type": "integer" }, "orderId": { "type": "integer" }, "menuItemId": { "type": "integer" }, "menuItemName": { "type": "string" }, "quantity": { "type": "integer" }, "unitPrice": { "type": "number" }, "totalPrice": { "type": "number" } }, "required": [ "id", "orderId", "menuItemId", "menuItemName", "quantity", "unitPrice", "totalPrice" ] }, "Order": { "type": "object", "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "restaurantId": { "type": "integer" }, "driverId": { "type": [ "integer", "null" ] }, "restaurantName": { "type": "string" }, "userName": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "accepted", "preparing", "ready", "picked_up", "delivered", "cancelled" ] }, "subtotal": { "type": "number" }, "deliveryFee": { "type": "number" }, "total": { "type": "number" }, "deliveryAddress": { "type": "string" }, "notes": { "type": [ "string", "null" ] }, "estimatedDeliveryTime": { "type": [ "integer", "null" ] }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItem" } }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "reference": { "type": [ "string", "null" ] }, "kitchenCode": { "type": [ "string", "null" ] }, "pickupCode": { "type": [ "string", "null" ] } }, "required": [ "id", "userId", "restaurantId", "restaurantName", "userName", "status", "subtotal", "deliveryFee", "total", "deliveryAddress", "items", "createdAt", "updatedAt" ] }, "CreateOrderBody": { "type": "object", "properties": { "restaurantId": { "type": "integer" }, "deliveryAddress": { "type": "string" }, "notes": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "menuItemId": { "type": "integer" }, "quantity": { "type": "integer" } }, "required": [ "menuItemId", "quantity" ] } } }, "required": [ "restaurantId", "deliveryAddress", "items" ] }, "UpdateOrderStatusBody": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "pending", "accepted", "preparing", "ready", "picked_up", "delivered", "cancelled" ] }, "driverId": { "type": "integer" } }, "required": [ "status" ] }, "Driver": { "type": "object", "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "name": { "type": "string" }, "phone": { "type": [ "string", "null" ] }, "vehicleType": { "type": [ "string", "null" ] }, "isAvailable": { "type": "boolean" }, "totalDeliveries": { "type": "integer" }, "rating": { "type": [ "number", "null" ] }, "createdAt": { "type": "string", "format": "date-time" }, "vehiclePlate": { "type": [ "string", "null" ] }, "nationalId": { "type": [ "string", "null" ] }, "licenseNumber": { "type": [ "string", "null" ] }, "photoUrl": { "type": [ "string", "null" ] }, "latitude": { "type": [ "number", "null" ] }, "longitude": { "type": [ "number", "null" ] }, "locationUpdatedAt": { "type": [ "string", "null" ], "format": "date-time" }, "profileCompletedAt": { "type": [ "string", "null" ], "format": "date-time" } }, "required": [ "id", "userId", "name", "isAvailable", "totalDeliveries", "createdAt" ] }, "UpdateDriverBody": { "type": "object", "properties": { "vehicleType": { "type": "string" }, "isAvailable": { "type": "boolean" } } }, "DriverEarnings": { "type": "object", "properties": { "today": { "type": "number" }, "thisWeek": { "type": "number" }, "thisMonth": { "type": "number" }, "totalDeliveries": { "type": "integer" }, "completedToday": { "type": "integer" } }, "required": [ "today", "thisWeek", "thisMonth", "totalDeliveries", "completedToday" ] }, "Review": { "type": "object", "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "restaurantId": { "type": "integer" }, "orderId": { "type": [ "integer", "null" ] }, "userName": { "type": "string" }, "rating": { "type": "integer" }, "comment": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "restaurantId", "userName", "rating", "createdAt" ] }, "CreateReviewBody": { "type": "object", "properties": { "restaurantId": { "type": "integer" }, "orderId": { "type": "integer" }, "rating": { "type": "integer" }, "comment": { "type": "string" } }, "required": [ "restaurantId", "rating" ] }, "UserRewards": { "type": "object", "properties": { "userId": { "type": "integer" }, "loyaltyPoints": { "type": "integer" }, "tier": { "type": "string" }, "nextTierPoints": { "type": "integer" }, "totalOrdersCount": { "type": "integer" }, "totalSpent": { "type": "number" } }, "required": [ "userId", "loyaltyPoints", "tier", "nextTierPoints", "totalOrdersCount", "totalSpent" ] }, "AdminStats": { "type": "object", "properties": { "totalUsers": { "type": "integer" }, "totalRestaurants": { "type": "integer" }, "totalOrders": { "type": "integer" }, "totalDrivers": { "type": "integer" }, "activeOrders": { "type": "integer" }, "revenue": { "type": "number" }, "ordersToday": { "type": "integer" }, "newUsersToday": { "type": "integer" } }, "required": [ "totalUsers", "totalRestaurants", "totalOrders", "totalDrivers", "activeOrders", "revenue", "ordersToday", "newUsersToday" ] }, "BackendMe": { "type": "object", "required": [ "user", "permissions" ], "properties": { "user": { "$ref": "#/components/schemas/User" }, "permissions": { "type": "array", "items": { "type": "string" } }, "scopedShopIds": { "type": "array", "description": "Restricts data to these shops (merchant + employee). Empty = no scope restriction.", "items": { "type": "integer" } } } }, "BackendDashboard": { "type": "object", "required": [ "inProgressOrders", "cancelledOrders", "deliveredOrders", "outOfStockProducts", "totalProducts", "orderReviews", "totalEarned", "deliveryEarning", "totalOrderTax", "totalCommission", "ordersChart" ], "properties": { "inProgressOrders": { "type": "integer" }, "cancelledOrders": { "type": "integer" }, "deliveredOrders": { "type": "integer" }, "outOfStockProducts": { "type": "integer" }, "totalProducts": { "type": "integer" }, "orderReviews": { "type": "integer" }, "totalEarned": { "type": "number" }, "deliveryEarning": { "type": "number" }, "totalOrderTax": { "type": "number" }, "totalCommission": { "type": "number" }, "ordersChart": { "type": "array", "items": { "type": "object", "required": [ "label", "value" ], "properties": { "label": { "type": "string" }, "value": { "type": "integer" } } } } } }, "CreateStaffBody": { "type": "object", "required": [ "name", "email", "password", "role" ], "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" }, "role": { "type": "string", "enum": [ "admin", "super_admin", "manager", "restaurant_owner", "employee" ] }, "phone": { "type": [ "string", "null" ] }, "assignedShopId": { "type": [ "integer", "null" ] } } }, "UpdateStaffBody": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" }, "role": { "type": "string" }, "phone": { "type": "string" }, "isActive": { "type": "boolean" }, "assignedShopId": { "type": [ "integer", "null" ] } } }, "CategoryEntry": { "type": "object", "required": [ "name", "count" ], "properties": { "name": { "type": "string" }, "count": { "type": "integer" } } }, "RoleDef": { "type": "object", "required": [ "key", "label", "permissions" ], "properties": { "key": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } } } }, "DashboardTodo": { "type": "object", "required": [ "id", "userId", "text", "done", "createdAt" ], "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "text": { "type": "string" }, "done": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } }, "CreateTodoBody": { "type": "object", "required": [ "text" ], "properties": { "text": { "type": "string" } } }, "UploadUrlRequest": { "type": "object", "required": [ "name", "size", "contentType" ], "properties": { "name": { "type": "string", "minLength": 1, "description": "Original file name." }, "size": { "type": "integer", "minimum": 1, "description": "File size in bytes." }, "contentType": { "type": "string", "minLength": 1, "description": "MIME type of the file (e.g. image/jpeg)." } } }, "UploadUrlResponse": { "type": "object", "required": [ "uploadURL", "objectPath" ], "properties": { "uploadURL": { "type": "string", "format": "uri", "description": "Presigned GCS URL for PUT upload." }, "objectPath": { "type": "string", "description": "Normalized object path (e.g. /objects/uploads/uuid). Store this in your database." }, "metadata": { "$ref": "#/components/schemas/UploadUrlRequest" } } }, "UpdateNameBody": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "minLength": 2 } } }, "UserEnvelope": { "type": "object", "required": [ "user" ], "properties": { "user": { "$ref": "#/components/schemas/User" } } }, "ForgotPasswordBody": { "type": "object", "required": [ "email" ], "properties": { "email": { "type": "string", "format": "email" } } }, "PasswordResetRequestResponse": { "type": "object", "required": [ "success", "message" ], "properties": { "success": { "type": "boolean" }, "message": { "type": "string" }, "demoOtp": { "type": "string" } } }, "ResetPasswordBody": { "type": "object", "required": [ "email", "code", "newPassword" ], "properties": { "email": { "type": "string", "format": "email" }, "code": { "type": "string" }, "newPassword": { "type": "string", "minLength": 6 } } }, "PasswordResetResponse": { "type": "object", "required": [ "success", "token", "user" ], "properties": { "success": { "type": "boolean" }, "token": { "type": "string" }, "user": { "$ref": "#/components/schemas/User" } } }, "CompleteRestaurantProfileBody": { "type": "object", "required": [ "legalName", "ice" ], "properties": { "legalName": { "type": "string", "minLength": 2 }, "ice": { "type": "string", "pattern": "^\\d{8,15}$" }, "printerEmail": { "type": [ "string", "null" ], "format": "email" } } }, "AcceptDeliveryBody": { "type": "object", "required": [ "driverId" ], "properties": { "driverId": { "type": "integer" } } }, "ConfirmDeliveryBody": { "type": "object", "required": [ "pickupCode" ], "properties": { "pickupCode": { "type": "string", "pattern": "^\\d{4}$" } } }, "CompleteDriverProfileBody": { "type": "object", "required": [ "vehicleType", "vehiclePlate", "nationalId" ], "properties": { "vehicleType": { "type": "string" }, "vehiclePlate": { "type": "string", "minLength": 3 }, "nationalId": { "type": "string", "minLength": 4 }, "licenseNumber": { "type": [ "string", "null" ] }, "photoUrl": { "type": [ "string", "null" ] } } }, "DriverLocationUpdateBody": { "type": "object", "required": [ "latitude", "longitude" ], "properties": { "latitude": { "type": "number" }, "longitude": { "type": "number" } } }, "DriverLocation": { "type": "object", "required": [ "latitude", "longitude" ], "properties": { "latitude": { "type": [ "number", "null" ] }, "longitude": { "type": [ "number", "null" ] }, "locationUpdatedAt": { "type": [ "string", "null" ], "format": "date-time" } } }, "DriverLocationPublic": { "type": "object", "properties": { "latitude": { "type": [ "number", "null" ] }, "longitude": { "type": [ "number", "null" ] }, "locationUpdatedAt": { "type": [ "string", "null" ], "format": "date-time" }, "isAvailable": { "type": "boolean" }, "name": { "type": "string" } } }, "Favorite": { "type": "object", "required": [ "id", "userId", "restaurantId", "createdAt" ], "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "restaurantId": { "type": "integer" }, "createdAt": { "type": "string", "format": "date-time" } } }, "FavoriteWithRestaurant": { "type": "object", "required": [ "id", "restaurantId", "createdAt" ], "properties": { "id": { "type": "integer" }, "restaurantId": { "type": "integer" }, "createdAt": { "type": "string", "format": "date-time" }, "restaurant": { "$ref": "#/components/schemas/Restaurant" } } }, "FavoriteBody": { "type": "object", "required": [ "restaurantId" ], "properties": { "restaurantId": { "type": "integer" } } }, "Address": { "type": "object", "required": [ "id", "userId", "label", "fullAddress", "isDefault", "createdAt" ], "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "label": { "type": "string" }, "fullAddress": { "type": "string" }, "details": { "type": [ "string", "null" ] }, "isDefault": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } }, "AddressBody": { "type": "object", "required": [ "label", "fullAddress" ], "properties": { "label": { "type": "string" }, "fullAddress": { "type": "string" }, "details": { "type": [ "string", "null" ] }, "isDefault": { "type": "boolean" } } }, "UpdateAddressBody": { "type": "object", "properties": { "label": { "type": "string" }, "fullAddress": { "type": "string" }, "details": { "type": [ "string", "null" ] }, "isDefault": { "type": "boolean" } } }, "PaymentMethod": { "type": "object", "required": [ "id", "userId", "type", "label", "isDefault", "createdAt" ], "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "type": { "type": "string" }, "label": { "type": "string" }, "last4": { "type": [ "string", "null" ] }, "brand": { "type": [ "string", "null" ] }, "isDefault": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } }, "PaymentMethodBody": { "type": "object", "required": [ "type", "label" ], "properties": { "type": { "type": "string" }, "label": { "type": "string" }, "last4": { "type": [ "string", "null" ] }, "brand": { "type": [ "string", "null" ] }, "isDefault": { "type": "boolean" } } }, "UpdatePaymentMethodBody": { "type": "object", "properties": { "type": { "type": "string" }, "label": { "type": "string" }, "last4": { "type": [ "string", "null" ] }, "brand": { "type": [ "string", "null" ] }, "isDefault": { "type": "boolean" } } }, "SupportTicket": { "type": "object", "required": [ "id", "userId", "category", "subject", "message", "status", "createdAt" ], "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "category": { "type": "string" }, "subject": { "type": "string" }, "message": { "type": "string" }, "status": { "type": "string", "enum": [ "open", "in_progress", "closed" ] }, "createdAt": { "type": "string", "format": "date-time" }, "userName": { "type": [ "string", "null" ] }, "userEmail": { "type": [ "string", "null" ] } } }, "CreateSupportTicketBody": { "type": "object", "required": [ "category", "subject", "message" ], "properties": { "category": { "type": "string" }, "subject": { "type": "string" }, "message": { "type": "string" } } }, "UpdateSupportTicketBody": { "type": "object", "required": [ "status" ], "properties": { "status": { "type": "string", "enum": [ "open", "in_progress", "closed" ] } } }, "NotificationPrefs": { "type": "object", "required": [ "userId", "pushOrders", "pushPromos", "emailReceipts", "emailNewsletter", "smsAlerts", "language", "updatedAt" ], "properties": { "userId": { "type": "integer" }, "pushOrders": { "type": "boolean" }, "pushPromos": { "type": "boolean" }, "emailReceipts": { "type": "boolean" }, "emailNewsletter": { "type": "boolean" }, "smsAlerts": { "type": "boolean" }, "language": { "type": "string", "enum": [ "fr", "en", "ar" ] }, "updatedAt": { "type": "string", "format": "date-time" } } }, "UpdateNotificationPrefsBody": { "type": "object", "properties": { "pushOrders": { "type": "boolean" }, "pushPromos": { "type": "boolean" }, "emailReceipts": { "type": "boolean" }, "emailNewsletter": { "type": "boolean" }, "smsAlerts": { "type": "boolean" }, "language": { "type": "string", "enum": [ "fr", "en", "ar" ] } } }, "UserConsents": { "type": "object", "required": [ "userId", "cookiesEssential", "cookiesAnalytics", "cookiesMarketing", "dataProcessing", "dataSharing", "personalization", "marketingEmails", "marketingSms", "marketingPush", "updatedAt" ], "properties": { "userId": { "type": "integer" }, "cookiesEssential": { "type": "boolean" }, "cookiesAnalytics": { "type": "boolean" }, "cookiesMarketing": { "type": "boolean" }, "dataProcessing": { "type": "boolean" }, "dataSharing": { "type": "boolean" }, "personalization": { "type": "boolean" }, "marketingEmails": { "type": "boolean" }, "marketingSms": { "type": "boolean" }, "marketingPush": { "type": "boolean" }, "termsVersion": { "type": [ "string", "null" ] }, "termsAcceptedAt": { "type": [ "string", "null" ], "format": "date-time" }, "privacyVersion": { "type": [ "string", "null" ] }, "privacyAcceptedAt": { "type": [ "string", "null" ], "format": "date-time" }, "cookiesVersion": { "type": [ "string", "null" ] }, "cookiesAcceptedAt": { "type": [ "string", "null" ], "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } }, "UserConsentsWithVersions": { "type": "object", "properties": { "userId": { "type": "integer" }, "cookiesEssential": { "type": "boolean" }, "cookiesAnalytics": { "type": "boolean" }, "cookiesMarketing": { "type": "boolean" }, "dataProcessing": { "type": "boolean" }, "dataSharing": { "type": "boolean" }, "personalization": { "type": "boolean" }, "marketingEmails": { "type": "boolean" }, "marketingSms": { "type": "boolean" }, "marketingPush": { "type": "boolean" }, "termsVersion": { "type": [ "string", "null" ] }, "termsAcceptedAt": { "type": [ "string", "null" ], "format": "date-time" }, "privacyVersion": { "type": [ "string", "null" ] }, "privacyAcceptedAt": { "type": [ "string", "null" ], "format": "date-time" }, "cookiesVersion": { "type": [ "string", "null" ] }, "cookiesAcceptedAt": { "type": [ "string", "null" ], "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "currentVersions": { "type": "object", "required": [ "terms", "privacy", "cookies" ], "properties": { "terms": { "type": "string" }, "privacy": { "type": "string" }, "cookies": { "type": "string" } } } } }, "UpdateUserConsentsBody": { "type": "object", "properties": { "cookiesAnalytics": { "type": "boolean" }, "cookiesMarketing": { "type": "boolean" }, "dataProcessing": { "type": "boolean" }, "dataSharing": { "type": "boolean" }, "personalization": { "type": "boolean" }, "marketingEmails": { "type": "boolean" }, "marketingSms": { "type": "boolean" }, "marketingPush": { "type": "boolean" }, "acceptTerms": { "type": "boolean" }, "acceptPrivacy": { "type": "boolean" }, "acceptCookies": { "type": "boolean" } } }, "UserDataExport": { "type": "object", "required": [ "generatedAt", "user", "orders", "orderItems", "addresses", "paymentMethods", "favorites", "reviews", "supportTickets" ], "properties": { "generatedAt": { "type": "string", "format": "date-time" }, "user": { "$ref": "#/components/schemas/User" }, "orders": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } }, "orderItems": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItem" } }, "addresses": { "type": "array", "items": { "$ref": "#/components/schemas/Address" } }, "paymentMethods": { "type": "array", "items": { "$ref": "#/components/schemas/PaymentMethod" } }, "favorites": { "type": "array", "items": { "$ref": "#/components/schemas/Favorite" } }, "notificationPrefs": { "anyOf": [ { "$ref": "#/components/schemas/NotificationPrefs" }, { "type": "null" } ] }, "consents": { "anyOf": [ { "$ref": "#/components/schemas/UserConsents" }, { "type": "null" } ] }, "reviews": { "type": "array", "items": { "$ref": "#/components/schemas/Review" } }, "supportTickets": { "type": "array", "items": { "$ref": "#/components/schemas/SupportTicket" } } } }, "Quote": { "type": "object", "required": [ "id", "userId", "restaurantId", "restaurantName", "userName", "subject", "description", "status", "createdAt", "updatedAt" ], "properties": { "id": { "type": "integer" }, "userId": { "type": "integer" }, "restaurantId": { "type": "integer" }, "restaurantName": { "type": "string" }, "userName": { "type": "string" }, "userPhone": { "type": [ "string", "null" ] }, "subject": { "type": "string" }, "description": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "quoted", "accepted", "rejected", "cancelled" ] }, "quotedAmount": { "type": [ "number", "null" ] }, "merchantNotes": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } }, "CreateQuoteBody": { "type": "object", "required": [ "restaurantId", "subject", "description" ], "properties": { "restaurantId": { "type": "integer" }, "subject": { "type": "string", "minLength": 2, "maxLength": 200 }, "description": { "type": "string", "minLength": 2, "maxLength": 4000 } } }, "UpdateQuoteBody": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "pending", "quoted", "accepted", "rejected", "cancelled" ] }, "quotedAmount": { "type": "number", "minimum": 0 }, "merchantNotes": { "type": "string", "maxLength": 2000 } } } }, "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT", "description": "JWT returned by /auth/login, /auth/verify-otp, or /backend/login. Some HTML document endpoints also accept the same token as a token query parameter." } } } }