{ "swagger": "2.0", "info": { "contact": {} }, "paths": { "/branches": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns paginated branches with optional filters", "produces": [ "application/json" ], "tags": [ "branches" ], "summary": "List branches", "parameters": [ { "type": "integer", "description": "Filter by province ID", "name": "province_id", "in": "query" }, { "type": "integer", "description": "Filter by location ID", "name": "location_id", "in": "query" }, { "type": "string", "description": "Filter by province name (en, ru, tm)", "name": "province_name", "in": "query" }, { "type": "string", "description": "Filter by branch name (en, ru, tm)", "name": "branch_name", "in": "query" }, { "type": "string", "description": "Filter by unique number", "name": "unikal_nomer", "in": "query" }, { "type": "integer", "default": 1, "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "Items per page", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new branch", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "branches" ], "summary": "Create branch", "parameters": [ { "description": "Branch payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/branches.CreateBranchDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/branches/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single branch", "produces": [ "application/json" ], "tags": [ "branches" ], "summary": "Get branch by ID", "parameters": [ { "type": "integer", "description": "Branch ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Updates an existing branch", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "branches" ], "summary": "Update branch", "parameters": [ { "type": "integer", "description": "Branch ID", "name": "id", "in": "path", "required": true }, { "description": "Branch payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/branches.UpdateBranchDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Deletes a branch", "produces": [ "application/json" ], "tags": [ "branches" ], "summary": "Delete branch", "parameters": [ { "type": "integer", "description": "Branch ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/file": { "post": { "security": [ { "BearerAuth": [] } ], "description": "file upload", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "file-upload" ], "parameters": [ { "type": "file", "description": "upload file", "name": "file", "in": "formData", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/file/{id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "remove file", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "file-upload" ], "parameters": [ { "type": "string", "description": "file name", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/get-profile": { "get": { "security": [ { "BearerAuth": [] } ], "description": "profile data for Admin", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/locations": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns paginated locations with optional filters", "produces": [ "application/json" ], "tags": [ "location" ], "summary": "List locations", "parameters": [ { "type": "integer", "description": "Filter by province ID", "name": "province_id", "in": "query" }, { "type": "string", "description": "Filter by province name (en, ru, tm)", "name": "province_name", "in": "query" }, { "type": "string", "description": "Filter by location name (en, ru, tm)", "name": "location_name", "in": "query" }, { "type": "boolean", "description": "Filter by location status", "name": "status", "in": "query" }, { "type": "integer", "default": 1, "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "Items per page", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new location in a province", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "location" ], "summary": "Create location", "parameters": [ { "description": "Location payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/location.CreateLocationDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/locations/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single location", "produces": [ "application/json" ], "tags": [ "location" ], "summary": "Get location by ID", "parameters": [ { "type": "integer", "description": "Location ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Updates an existing location", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "location" ], "summary": "Update location", "parameters": [ { "type": "integer", "description": "Location ID", "name": "id", "in": "path", "required": true }, { "description": "Location payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/location.UpdateLocationDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Deletes a location", "produces": [ "application/json" ], "tags": [ "location" ], "summary": "Delete location", "parameters": [ { "type": "integer", "description": "Location ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/locations/{id}/status": { "patch": { "security": [ { "BearerAuth": [] } ], "description": "Enables or disables a location", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "location" ], "summary": "Update location status", "parameters": [ { "type": "integer", "description": "Location ID", "name": "id", "in": "path", "required": true }, { "description": "Status payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/location.UpdateLocationStatusDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/login": { "post": { "description": "login for Admin", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "parameters": [ { "description": "Login JSON", "name": "auth", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.LoginDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/provinces": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns all provinces", "produces": [ "application/json" ], "tags": [ "province" ], "summary": "List provinces", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new province", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "province" ], "summary": "Create province", "parameters": [ { "description": "Province payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/province.CreateProvinceDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/provinces/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single province", "produces": [ "application/json" ], "tags": [ "province" ], "summary": "Get province by ID", "parameters": [ { "type": "integer", "description": "Province ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Updates an existing province", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "province" ], "summary": "Update province", "parameters": [ { "type": "integer", "description": "Province ID", "name": "id", "in": "path", "required": true }, { "description": "Province payload", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/province.UpdateProvinceDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Deletes a province and its locations", "produces": [ "application/json" ], "tags": [ "province" ], "summary": "Delete province", "parameters": [ { "type": "integer", "description": "Province ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/appresult.AppError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } }, "/token": { "post": { "description": "refresh admin tokens", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "parameters": [ { "description": "Token JSON", "name": "auth", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.TokenReqBody" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/appresult.AppSuccess" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/appresult.AppError" } } } } } }, "definitions": { "appresult.AppError": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "status": { "type": "boolean" } } }, "appresult.AppSuccess": { "type": "object", "properties": { "code": { "type": "string" }, "data": {}, "message": { "type": "string" }, "status": { "type": "boolean" } } }, "auth.LoginDTO": { "type": "object", "required": [ "login", "password" ], "properties": { "login": { "type": "string" }, "password": { "type": "string" } } }, "auth.TokenReqBody": { "type": "object", "required": [ "refreshToken" ], "properties": { "refreshToken": { "type": "string" } } }, "branches.CreateBranchDTO": { "type": "object", "required": [ "address", "locationId", "provinceId", "title", "unikalNomer" ], "properties": { "address": { "$ref": "#/definitions/branches.LocalizedText" }, "billingLogin": { "type": "string" }, "billingPassword": { "type": "string" }, "billingPasswordSber": { "type": "string" }, "billingPasswordVisa": { "type": "string" }, "billingUsernameSber": { "type": "string" }, "billingUsernameVisa": { "type": "string" }, "locationId": { "type": "integer" }, "provinceId": { "type": "integer" }, "title": { "$ref": "#/definitions/branches.LocalizedText" }, "unikalNomer": { "type": "string" } } }, "branches.LocalizedText": { "type": "object", "properties": { "en": { "type": "string" }, "ru": { "type": "string" }, "tm": { "type": "string" } } }, "branches.UpdateBranchDTO": { "type": "object", "required": [ "address", "locationId", "provinceId", "title", "unikalNomer" ], "properties": { "address": { "$ref": "#/definitions/branches.LocalizedText" }, "billingLogin": { "type": "string" }, "billingPassword": { "type": "string" }, "billingPasswordSber": { "type": "string" }, "billingPasswordVisa": { "type": "string" }, "billingUsernameSber": { "type": "string" }, "billingUsernameVisa": { "type": "string" }, "locationId": { "type": "integer" }, "provinceId": { "type": "integer" }, "title": { "$ref": "#/definitions/branches.LocalizedText" }, "unikalNomer": { "type": "string" } } }, "location.CreateLocationDTO": { "type": "object", "required": [ "provinceId", "title" ], "properties": { "provinceId": { "type": "integer" }, "status": { "type": "boolean" }, "title": { "$ref": "#/definitions/location.LocalizedTitle" } } }, "location.LocalizedTitle": { "type": "object", "properties": { "en": { "type": "string" }, "ru": { "type": "string" }, "tm": { "type": "string" } } }, "location.UpdateLocationDTO": { "type": "object", "required": [ "provinceId", "title" ], "properties": { "provinceId": { "type": "integer" }, "status": { "type": "boolean" }, "title": { "$ref": "#/definitions/location.LocalizedTitle" } } }, "location.UpdateLocationStatusDTO": { "type": "object", "properties": { "status": { "type": "boolean" } } }, "province.CreateProvinceDTO": { "type": "object", "required": [ "title" ], "properties": { "title": { "$ref": "#/definitions/province.LocalizedTitle" } } }, "province.LocalizedTitle": { "type": "object", "properties": { "en": { "type": "string" }, "ru": { "type": "string" }, "tm": { "type": "string" } } }, "province.UpdateProvinceDTO": { "type": "object", "required": [ "title" ], "properties": { "title": { "$ref": "#/definitions/province.LocalizedTitle" } } } } }