Add branch_user table and branch-user assignment endpoints

Introduces a branch_user join table linking branches to users, plus
create/delete API endpoints under the auth module for managing branch
assignments. The create response includes the branch's localized name
via a join. Regenerated swagger docs to include the new endpoints.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 15:02:05 +05:00
parent 1337175e5d
commit 77bc4025d3
9 changed files with 462 additions and 3 deletions

View File

@@ -19,6 +19,16 @@ definitions:
status:
type: boolean
type: object
auth.CreateBranchUserDTO:
properties:
branchId:
type: integer
userId:
type: integer
required:
- branchId
- userId
type: object
auth.LoginDTO:
properties:
email:
@@ -430,6 +440,71 @@ info:
title: Service APIs
version: "1.0"
paths:
/branch-users:
post:
consumes:
- application/json
description: Creates a branch-user assignment
parameters:
- description: Branch-user payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/auth.CreateBranchUserDTO'
produces:
- application/json
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'
security:
- BearerAuth: []
summary: Assign user to branch
tags:
- auth
/branch-users/{id}:
delete:
description: Deletes a branch-user assignment
parameters:
- description: Branch-user ID
in: path
name: id
required: true
type: integer
produces:
- application/json
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'
security:
- BearerAuth: []
summary: Remove user from branch
tags:
- auth
/branches:
get:
description: Returns paginated branches with optional filters