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:
161
docs/docs.go
161
docs/docs.go
@@ -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"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"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"
|
||||
],
|
||||
@@ -133,56 +133,13 @@
|
||||
}
|
||||
},
|
||||
"/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"
|
||||
],
|
||||
@@ -4106,7 +4063,7 @@
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the authenticated user's profile",
|
||||
"description": "Returns the authenticated user's profile with role and branches",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -4846,56 +4803,13 @@
|
||||
}
|
||||
},
|
||||
"/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"
|
||||
],
|
||||
@@ -5849,59 +5763,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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": [
|
||||
@@ -6362,7 +6223,6 @@
|
||||
"customerName",
|
||||
"customerSurname",
|
||||
"passportFour",
|
||||
"passportGivenAt",
|
||||
"passportGivenBy",
|
||||
"passportId",
|
||||
"passportOne",
|
||||
@@ -6373,7 +6233,8 @@
|
||||
],
|
||||
"properties": {
|
||||
"bornAt": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"format": "date"
|
||||
},
|
||||
"bornPlace": {
|
||||
"type": "string"
|
||||
@@ -6418,7 +6279,8 @@
|
||||
"type": "string"
|
||||
},
|
||||
"passportGivenAt": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"format": "date"
|
||||
},
|
||||
"passportGivenBy": {
|
||||
"type": "string"
|
||||
@@ -6472,7 +6334,6 @@
|
||||
"customerName",
|
||||
"customerSurname",
|
||||
"passportFour",
|
||||
"passportGivenAt",
|
||||
"passportGivenBy",
|
||||
"passportId",
|
||||
"passportOne",
|
||||
@@ -6483,7 +6344,8 @@
|
||||
],
|
||||
"properties": {
|
||||
"bornAt": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"format": "date"
|
||||
},
|
||||
"bornPlace": {
|
||||
"type": "string"
|
||||
@@ -6528,7 +6390,8 @@
|
||||
"type": "string"
|
||||
},
|
||||
"passportGivenAt": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"format": "date"
|
||||
},
|
||||
"passportGivenBy": {
|
||||
"type": "string"
|
||||
|
||||
@@ -193,6 +193,7 @@ definitions:
|
||||
cardorder.CreateCardOrderDTO:
|
||||
properties:
|
||||
bornAt:
|
||||
format: date
|
||||
type: string
|
||||
bornPlace:
|
||||
type: string
|
||||
@@ -223,6 +224,7 @@ definitions:
|
||||
passportFour:
|
||||
type: string
|
||||
passportGivenAt:
|
||||
format: date
|
||||
type: string
|
||||
passportGivenBy:
|
||||
type: string
|
||||
@@ -259,7 +261,6 @@ definitions:
|
||||
- customerName
|
||||
- customerSurname
|
||||
- passportFour
|
||||
- passportGivenAt
|
||||
- passportGivenBy
|
||||
- passportId
|
||||
- passportOne
|
||||
@@ -271,6 +272,7 @@ definitions:
|
||||
cardorder.UpdateCardOrderDTO:
|
||||
properties:
|
||||
bornAt:
|
||||
format: date
|
||||
type: string
|
||||
bornPlace:
|
||||
type: string
|
||||
@@ -301,6 +303,7 @@ definitions:
|
||||
passportFour:
|
||||
type: string
|
||||
passportGivenAt:
|
||||
format: date
|
||||
type: string
|
||||
passportGivenBy:
|
||||
type: string
|
||||
@@ -337,7 +340,6 @@ definitions:
|
||||
- customerName
|
||||
- customerSurname
|
||||
- passportFour
|
||||
- passportGivenAt
|
||||
- passportGivenBy
|
||||
- passportId
|
||||
- passportOne
|
||||
@@ -1390,7 +1392,8 @@ info:
|
||||
paths:
|
||||
/activity-logs:
|
||||
get:
|
||||
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.
|
||||
parameters:
|
||||
- description: Filter by user ID
|
||||
in: query
|
||||
@@ -1468,38 +1471,11 @@ paths:
|
||||
tags:
|
||||
- activity-logs
|
||||
/branch-users:
|
||||
get:
|
||||
description: Returns the authenticated user's branch-user assignments with the
|
||||
related user and branch
|
||||
parameters:
|
||||
- description: Filter by branch name (en, ru, tm)
|
||||
in: query
|
||||
name: branch_name
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List branch users
|
||||
tags:
|
||||
- branch-users
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a branch-user assignment
|
||||
description: Creates a branch-user assignment, or updates the user's existing
|
||||
branch if one is already assigned
|
||||
parameters:
|
||||
- description: Branch-user payload
|
||||
in: body
|
||||
@@ -4012,7 +3988,7 @@ paths:
|
||||
- permission
|
||||
/profile:
|
||||
get:
|
||||
description: Returns the authenticated user's profile
|
||||
description: Returns the authenticated user's profile with role and branches
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -4490,38 +4466,11 @@ paths:
|
||||
tags:
|
||||
- auth
|
||||
/role-users:
|
||||
get:
|
||||
description: Returns the authenticated user's role-user assignments with the
|
||||
related user and role
|
||||
parameters:
|
||||
- description: Filter by role name
|
||||
in: query
|
||||
name: role_name
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List role users
|
||||
tags:
|
||||
- role-users
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a role-user assignment
|
||||
description: Creates a role-user assignment, or updates the user's existing
|
||||
role if one is already assigned
|
||||
parameters:
|
||||
- description: Role-user payload
|
||||
in: body
|
||||
@@ -5242,41 +5191,6 @@ paths:
|
||||
summary: Update visa/master payment order
|
||||
tags:
|
||||
- visa-master-payment-orders
|
||||
/visa-master-payment-orders/branches:
|
||||
get:
|
||||
description: Returns branches for the selected province for visa/master payment
|
||||
order forms
|
||||
parameters:
|
||||
- description: Province ID
|
||||
in: query
|
||||
name: province_id
|
||||
required: true
|
||||
type: integer
|
||||
- default: true
|
||||
description: Only active branches
|
||||
in: query
|
||||
name: active
|
||||
type: boolean
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List branches by province
|
||||
tags:
|
||||
- visa-master-payment-orders
|
||||
securityDefinitions:
|
||||
BearerAuth:
|
||||
in: header
|
||||
|
||||
Reference in New Issue
Block a user