{ "openapi": "3.0.0", "paths": { "/auth/register": { "post": { "operationId": "AuthController_userRegister", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserRegisterDto" } } } }, "responses": { "200": { "description": "Successfully Registered", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } } } }, "tags": [ "auth" ] } }, "/auth/otp": { "post": { "operationId": "AuthController_sendOtp", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SendOtpDto" } } } }, "responses": { "200": { "description": "Successfully Registered", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } } } }, "tags": [ "auth" ] } }, "/auth/me": { "get": { "operationId": "AuthController_getCurrentUser", "parameters": [], "responses": { "200": { "description": "current user info", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "auth" ] } }, "/users/password": { "post": { "operationId": "UserController_updatePassword", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdatePasswordDto" } } } }, "responses": { "200": { "description": "update current user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "users" ] } }, "/users/update": { "patch": { "operationId": "UserController_updateProfile", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUserDto" } } } }, "responses": { "200": { "description": "update current user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "users" ] } }, "/upload": { "post": { "operationId": "MediaController_uploadFile", "parameters": [ { "schema": {} } ], "requestBody": { "required": false, "content": { "multipart/form-data": { "schema": { "allOf": [ { "$ref": "#/components/schemas/CreateMediaDto" }, { "properties": { "file": { "type": "string", "format": "binary" } }, "type": "object" } ] } } } }, "responses": { "default": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MediaDto" } } } } }, "tags": [ "upload" ] } }, "/category": { "post": { "operationId": "CategoryController_create", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateCategoryDto" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Category" ] }, "get": { "operationId": "CategoryController_findAll", "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/CategoryDto" } } } } } }, "tags": [ "Category" ] } }, "/category/{slug}": { "get": { "operationId": "CategoryController_findOne", "parameters": [ { "name": "slug", "required": true, "in": "path", "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryDto" } } } } }, "tags": [ "Category" ] } }, "/category/{id}": { "patch": { "operationId": "CategoryController_update", "parameters": [ { "name": "id", "required": true, "in": "path", "schema": { "type": "number" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateCategoryDto" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Category" ] }, "delete": { "operationId": "CategoryController_remove", "parameters": [ { "name": "id", "required": true, "in": "path", "schema": { "type": "number" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Category" ] } }, "/product": { "get": { "operationId": "ProductController_getProducts", "parameters": [ { "name": "page", "required": false, "in": "query", "min": 1, "schema": { "default": 1, "type": "number" } }, { "name": "limit", "required": false, "in": "query", "max": 20, "min": 1, "schema": { "default": 20, "type": "number" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProductDto" } } } } } }, "tags": [ "Product" ] }, "post": { "operationId": "ProductController_create", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateProductDto" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Product" ] } }, "/product/search": { "get": { "operationId": "ProductController_searchProducts", "parameters": [ { "name": "page", "required": false, "in": "query", "min": 1, "schema": { "default": 1, "type": "number" } }, { "name": "limit", "required": false, "in": "query", "max": 20, "min": 1, "schema": { "default": 20, "type": "number" } }, { "name": "search", "required": true, "in": "query", "schema": { "minLength": 2, "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProductDto" } } } } } }, "tags": [ "Product" ] } }, "/product/similar/{productId}": { "get": { "operationId": "ProductController_getSimilarProducts", "parameters": [ { "name": "page", "required": false, "in": "query", "min": 1, "schema": { "default": 1, "type": "number" } }, { "name": "limit", "required": false, "in": "query", "max": 20, "min": 1, "schema": { "default": 20, "type": "number" } }, { "name": "productId", "required": true, "in": "path", "schema": {} } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProductDto" } } } } } }, "tags": [ "Product" ] } }, "/product/{slug}": { "get": { "operationId": "ProductController_findOne", "parameters": [ { "name": "slug", "required": true, "in": "path", "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductDto" } } } } }, "tags": [ "Product" ] } }, "/product/category/{categorySlug}": { "get": { "operationId": "ProductController_findByCategory", "parameters": [ { "name": "categorySlug", "required": true, "in": "path", "schema": { "type": "string" } }, { "name": "page", "required": false, "in": "query", "min": 1, "schema": { "default": 1, "type": "number" } }, { "name": "limit", "required": false, "in": "query", "max": 20, "min": 1, "schema": { "default": 20, "type": "number" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProductDto" } } } } } }, "tags": [ "Product" ] } }, "/product/media": { "post": { "operationId": "ProductController_uploadProductMedia", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadProductMediaDto" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "boolean" } } } } }, "tags": [ "Product" ] } }, "/product/{uuid}": { "patch": { "operationId": "ProductController_updateProduct", "parameters": [ { "name": "uuid", "required": true, "in": "path", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateProductDto" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductDto" } } } } }, "tags": [ "Product" ] }, "delete": { "operationId": "ProductController_removeProduct", "parameters": [ { "name": "uuid", "required": true, "in": "path", "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductDto" } } } } }, "tags": [ "Product" ] } }, "/wallet": { "get": { "operationId": "WalletController_getUserWallet", "parameters": [], "responses": { "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Wallet" ] } }, "/address": { "post": { "operationId": "UserAddressController_createAddress", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateUserAddressDto" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserAddressDto" } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "UserAddress" ] }, "get": { "operationId": "UserAddressController_getAddresses", "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/UserAddressDto" } } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "UserAddress" ] } }, "/address/province": { "get": { "operationId": "UserAddressController_getProvinces", "parameters": [], "responses": { "200": { "description": "" } }, "tags": [ "UserAddress" ] } }, "/address/city": { "get": { "operationId": "UserAddressController_getCities", "parameters": [], "responses": { "200": { "description": "" } }, "tags": [ "UserAddress" ] } }, "/address/{addressId}": { "get": { "operationId": "UserAddressController_getAddress", "parameters": [ { "name": "addressId", "required": true, "in": "path", "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/UserAddressDto" } } } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "UserAddress" ] } }, "/order": { "get": { "operationId": "OrderController_getOrder", "parameters": [], "responses": { "401": { "description": "Unauthorized" }, "default": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderDto" } } } } }, "security": [ { "bearer": [] } ], "tags": [ "Order" ] } }, "/order/increase": { "post": { "operationId": "OrderController_addItemToOrder", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChangeOrderItemDto" } } } }, "responses": { "401": { "description": "Unauthorized" }, "default": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderDto" } } } } }, "security": [ { "bearer": [] } ], "tags": [ "Order" ] } }, "/order/decrease": { "post": { "operationId": "OrderController_removeItemFromOrder", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChangeOrderItemDto" } } } }, "responses": { "401": { "description": "Unauthorized" }, "default": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderDto" } } } } }, "security": [ { "bearer": [] } ], "tags": [ "Order" ] } }, "/payment": { "post": { "operationId": "PaymentController_startPayment", "parameters": [], "responses": { "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Payment" ] } }, "/payment/verify": { "post": { "operationId": "PaymentController_verifyPayment", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyPaymentDto" } } } }, "responses": { "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [] } ], "tags": [ "Payment" ] } } }, "info": { "title": "API", "description": "### REST\n\nRoutes follow Richardson level 3.\n\n
Detailed spec\n

\n\n…(your route descriptions)…\n\n

\n
", "version": "v1.0.0", "contact": {} }, "tags": [], "servers": [], "components": { "securitySchemes": { "bearer": { "scheme": "bearer", "bearerFormat": "JWT", "type": "http" } }, "schemas": { "UserRegisterDto": { "type": "object", "properties": { "password": { "type": "string", "minLength": 6 }, "phone": { "type": "string" }, "otp": { "type": "string" }, "email": { "type": "string" } } }, "RoleType": { "type": "string", "enum": [ "USER", "ADMIN" ] }, "UserDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "firstName": { "type": "string", "nullable": true }, "lastName": { "type": "string", "nullable": true }, "username": { "type": "string", "nullable": true }, "role": { "allOf": [ { "$ref": "#/components/schemas/RoleType" } ] }, "email": { "type": "string", "toLowerCase": true, "nullable": true }, "avatar": { "type": "string", "nullable": true }, "phone": { "type": "string", "nullable": true } } }, "SendOtpDto": { "type": "object", "properties": { "phone": { "type": "string", "description": "phone number for sending otp" } }, "required": [ "phone" ] }, "UpdatePasswordDto": { "type": "object", "properties": { "password": { "type": "string", "minLength": 6, "description": "New password", "example": "Str0ng!Pass123" }, "old_password": { "type": "string", "minLength": 6, "description": "Old password (optional)", "example": "OldPassword123" } }, "required": [ "password" ] }, "UpdateUserDto": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "email": { "type": "string", "toLowerCase": true }, "avatar": { "type": "string", "format": "uuid" } } }, "MediaType": { "type": "number", "enum": [ 1, 2 ], "description": "1 : image ----------- 2: video" }, "CreateMediaDto": { "type": "object", "properties": { "type": { "description": "1 : image ----------- 2: video", "allOf": [ { "$ref": "#/components/schemas/MediaType" } ] } }, "required": [ "type" ] }, "MediaDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "fileExtension": { "type": "string" }, "mediaType": { "type": "number" }, "fileSize": { "type": "number" }, "url": { "type": "string" } }, "required": [ "fileExtension", "mediaType", "fileSize" ] }, "CreateCategoryDto": { "type": "object", "properties": { "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": "string" }, "image": { "type": "string", "format": "uuid" }, "parent": { "type": "string", "format": "uuid" } }, "required": [ "name", "slug" ] }, "CategoryDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "id": { "type": "number" }, "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": "string" }, "image": { "type": "string" }, "parent": { "$ref": "#/components/schemas/CategoryDto" }, "children": { "$ref": "#/components/schemas/CategoryDto" } }, "required": [ "id", "name", "slug" ] }, "UpdateCategoryDto": { "type": "object", "properties": { "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": "string" }, "image": { "type": "string", "format": "uuid" }, "parent": { "type": "string", "format": "uuid" } } }, "ProductDetailDto": { "type": "object", "properties": { "series": { "type": "string" }, "character": { "type": "string" }, "description": { "type": "string" } }, "required": [ "series", "character" ] }, "ProductMediaDto": { "type": "object", "properties": { "order": { "type": "number" }, "isDefault": { "type": "boolean" }, "url": { "type": "string" } }, "required": [ "order", "url" ] }, "ProductDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "price": { "type": "number" }, "quantity": { "type": "number" }, "rating": { "type": "number" }, "detail": { "$ref": "#/components/schemas/ProductDetailDto" }, "category": { "$ref": "#/components/schemas/CategoryDto" }, "productMedia": { "each": true, "allOf": [ { "$ref": "#/components/schemas/ProductMediaDto" } ] } }, "required": [ "name", "slug", "price", "quantity", "rating" ] }, "CustomFieldDto": { "type": "object", "properties": { "key": { "type": "string", "example": "key name" }, "value": { "type": "string", "example": "key value" } }, "required": [ "key", "value" ] }, "CreateProductDetailDto": { "type": "object", "properties": { "series": { "type": "string" }, "character": { "type": "string" }, "description": { "type": "string" }, "specifications": { "each": true, "example": "[{key: \"\", value: \"\"}, ...]", "allOf": [ { "$ref": "#/components/schemas/CustomFieldDto" } ] } }, "required": [ "series", "character", "specifications" ] }, "CreateProductDto": { "type": "object", "properties": { "name": { "type": "string", "default": "product name" }, "slug": { "type": "string", "default": "product-slug" }, "price": { "type": "number", "default": 100000 }, "quantity": { "type": "number", "default": 100 }, "rating": { "type": "number", "default": 5 }, "category": { "type": "string", "format": "uuid" }, "productDetail": { "$ref": "#/components/schemas/CreateProductDetailDto" } }, "required": [ "name", "slug", "price", "quantity", "rating", "category", "productDetail" ] }, "UploadProductMediaInfo": { "type": "object", "properties": { "mediaId": { "type": "string", "format": "uuid" }, "order": { "type": "number" }, "isDefault": { "type": "boolean" } }, "required": [ "mediaId", "order" ] }, "UploadProductMediaDto": { "type": "object", "properties": { "productId": { "type": "string", "format": "uuid" }, "infos": { "each": true, "allOf": [ { "$ref": "#/components/schemas/UploadProductMediaInfo" } ] } }, "required": [ "productId", "infos" ] }, "UpdateProductDto": { "type": "object", "properties": { "name": { "type": "string", "default": "product name" }, "slug": { "type": "string", "default": "product-slug" }, "price": { "type": "number", "default": 100000 }, "quantity": { "type": "number", "default": 100 }, "rating": { "type": "number", "default": 5 }, "category": { "type": "string", "format": "uuid" }, "productDetail": { "$ref": "#/components/schemas/CreateProductDetailDto" } } }, "CreateUserAddressDto": { "type": "object", "properties": { "province": { "type": "string" }, "city": { "type": "string" }, "address": { "type": "string" }, "postalCode": { "type": "string" }, "houseNumber": { "type": "string" }, "floorNumber": { "type": "string" } }, "required": [ "province", "city", "address", "postalCode" ] }, "UserAddressDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "province": { "type": "string" }, "city": { "type": "string" }, "address": { "type": "string" }, "postalCode": { "type": "string" }, "houseNumber": { "type": "string" }, "floorNumber": { "type": "string" }, "user": { "$ref": "#/components/schemas/UserDto" } }, "required": [ "province", "city", "address", "postalCode" ] }, "OrderStatusEnum": { "type": "string", "enum": [ "open", "pending", "confirmed", "shipping", "shipped", "cancelled" ] }, "OrderItemDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "quantity": { "type": "number" }, "price": { "type": "number" }, "product": { "$ref": "#/components/schemas/ProductDto" } }, "required": [ "quantity", "price" ] }, "OrderDto": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" }, "createdAt": { "format": "date-time", "type": "string" }, "updatedAt": { "format": "date-time", "type": "string" }, "totalPrice": { "type": "number" }, "finalPrice": { "type": "number" }, "status": { "allOf": [ { "$ref": "#/components/schemas/OrderStatusEnum" } ] }, "items": { "each": true, "allOf": [ { "$ref": "#/components/schemas/OrderItemDto" } ] } }, "required": [ "totalPrice", "finalPrice", "status" ] }, "ChangeOrderItemDto": { "type": "object", "properties": { "productId": { "type": "string", "format": "uuid" }, "quantity": { "type": "number" } }, "required": [ "productId", "quantity" ] }, "VerifyPaymentStatusEnum": { "type": "string", "enum": [ "OK", "NOK" ] }, "VerifyPaymentDto": { "type": "object", "properties": { "status": { "allOf": [ { "$ref": "#/components/schemas/VerifyPaymentStatusEnum" } ] }, "authority": { "type": "string" } }, "required": [ "status", "authority" ] } } } }