Put the user's role and branch on GET /profile, upsert role_user and branch_user on POST, and drop their list endpoints.

Also accept flexible card-order form values, move mock seed under db/mock, and regenerate Swagger.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-22 17:56:07 +05:00
parent 7225dc0399
commit 8795ae2195
47 changed files with 1308 additions and 1785 deletions

View File

@@ -22,7 +22,7 @@ const docTemplate = `{
"BearerAuth": []
}
],
"description": "Returns a paginated audit trail of user actions (create/update/delete)",
"description": "Returns a paginated audit trail of user actions (create/update/delete). Each log includes the actor's username and role from role_user.",
"produces": [
"application/json"
],
@@ -139,56 +139,13 @@ const docTemplate = `{
}
},
"/branch-users": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns the authenticated user's branch-user assignments with the related user and branch",
"produces": [
"application/json"
],
"tags": [
"branch-users"
],
"summary": "List branch users",
"parameters": [
{
"type": "string",
"description": "Filter by branch name (en, ru, tm)",
"name": "branch_name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Creates a branch-user assignment",
"description": "Creates a branch-user assignment, or updates the user's existing branch if one is already assigned",
"consumes": [
"application/json"
],
@@ -4112,7 +4069,7 @@ const docTemplate = `{
"BearerAuth": []
}
],
"description": "Returns the authenticated user's profile",
"description": "Returns the authenticated user's profile with role and branches",
"produces": [
"application/json"
],
@@ -4852,56 +4809,13 @@ const docTemplate = `{
}
},
"/role-users": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns the authenticated user's role-user assignments with the related user and role",
"produces": [
"application/json"
],
"tags": [
"role-users"
],
"summary": "List role users",
"parameters": [
{
"type": "string",
"description": "Filter by role name",
"name": "role_name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Creates a role-user assignment",
"description": "Creates a role-user assignment, or updates the user's existing role if one is already assigned",
"consumes": [
"application/json"
],
@@ -5855,59 +5769,6 @@ const docTemplate = `{
}
}
},
"/visa-master-payment-orders/branches": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns branches for the selected province for visa/master payment order forms",
"produces": [
"application/json"
],
"tags": [
"visa-master-payment-orders"
],
"summary": "List branches by province",
"parameters": [
{
"type": "integer",
"description": "Province ID",
"name": "province_id",
"in": "query",
"required": true
},
{
"type": "boolean",
"default": true,
"description": "Only active branches",
"name": "active",
"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"
}
}
}
}
},
"/visa-master-payment-orders/{id}": {
"get": {
"security": [
@@ -6368,7 +6229,6 @@ const docTemplate = `{
"customerName",
"customerSurname",
"passportFour",
"passportGivenAt",
"passportGivenBy",
"passportId",
"passportOne",
@@ -6379,7 +6239,8 @@ const docTemplate = `{
],
"properties": {
"bornAt": {
"type": "string"
"type": "string",
"format": "date"
},
"bornPlace": {
"type": "string"
@@ -6424,7 +6285,8 @@ const docTemplate = `{
"type": "string"
},
"passportGivenAt": {
"type": "string"
"type": "string",
"format": "date"
},
"passportGivenBy": {
"type": "string"
@@ -6478,7 +6340,6 @@ const docTemplate = `{
"customerName",
"customerSurname",
"passportFour",
"passportGivenAt",
"passportGivenBy",
"passportId",
"passportOne",
@@ -6489,7 +6350,8 @@ const docTemplate = `{
],
"properties": {
"bornAt": {
"type": "string"
"type": "string",
"format": "date"
},
"bornPlace": {
"type": "string"
@@ -6534,7 +6396,8 @@ const docTemplate = `{
"type": "string"
},
"passportGivenAt": {
"type": "string"
"type": "string",
"format": "date"
},
"passportGivenBy": {
"type": "string"