feat: add dashboard summary endpoint and related models, queries, and services

This commit is contained in:
Tran Anh Tuan
2026-05-13 17:53:32 +07:00
parent b815111b8f
commit 383bed757d
12 changed files with 928 additions and 0 deletions

View File

@@ -1,5 +1,12 @@
basePath: /api/v1
definitions:
models.AbnormalAlert:
properties:
count:
type: integer
status:
type: string
type: object
models.AlternativeComponent:
properties:
alternativeComponentId:
@@ -139,6 +146,32 @@ definitions:
updatedAt:
type: string
type: object
models.ContainerStats:
properties:
emptyContainers:
type: integer
totalContainers:
type: integer
type: object
models.DashboardSummary:
properties:
abnormalAlerts:
items:
$ref: '#/definitions/models.AbnormalAlert'
type: array
emptyContainers:
$ref: '#/definitions/models.ContainerStats'
lowStockComponents:
type: integer
pendingInvoices:
type: integer
todayInvoices:
items:
$ref: '#/definitions/models.TodayInvoiceCount'
type: array
totalComponents:
$ref: '#/definitions/models.TotalComponentStats'
type: object
models.FindComponentItemResult:
properties:
cabinetName:
@@ -267,6 +300,20 @@ definitions:
updatedAt:
type: string
type: object
models.TodayInvoiceCount:
properties:
count:
type: integer
type:
type: string
type: object
models.TotalComponentStats:
properties:
totalQuantity:
type: integer
totalTypes:
type: integer
type: object
models.Warehouse:
properties:
address:
@@ -703,6 +750,19 @@ definitions:
status:
type: integer
type: object
responses.BodyProfileResponse:
properties:
info:
$ref: '#/definitions/responses.UserInfoResponse'
permissions:
items:
type: string
type: array
roles:
items:
$ref: '#/definitions/responses.RoleItem'
type: array
type: object
responses.BodyRegisterResponse:
properties:
id:
@@ -775,6 +835,15 @@ definitions:
id:
type: integer
type: object
responses.RoleItem:
properties:
description:
type: string
id:
type: string
name:
type: string
type: object
responses.UpdateAlternativeComponentResponse:
properties:
alternativeComponentId:
@@ -973,6 +1042,19 @@ definitions:
name:
type: string
type: object
responses.UserInfoResponse:
properties:
email:
type: string
fullName:
type: string
id:
type: string
isActive:
type: boolean
username:
type: string
type: object
host: localhost:3000
info:
contact: {}
@@ -1800,6 +1882,30 @@ paths:
summary: Health check
tags:
- health
/profile:
get:
description: Returns user info with roles and permissions (requires auth)
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.BodyProfileResponse'
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.ErrorResponse'
security:
- BearerAuth: []
summary: Get current user profile
tags:
- auth
/v1/alternative-components:
get:
consumes:
@@ -2310,6 +2416,30 @@ paths:
summary: Update container
tags:
- container
/v1/dashboard/summary:
get:
consumes:
- application/json
description: Retrieve dashboard summary with key statistics
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/models.DashboardSummary'
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Get dashboard summary
tags:
- dashboard
/v1/invoice-config-items:
get:
consumes: