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

@@ -1321,6 +1321,49 @@
}
}
},
"/profile": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns user info with roles and permissions (requires auth)",
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Get current user profile",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.BodyProfileResponse"
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/alternative-components": {
"get": {
"description": "Retrieve a list of all alternative components",
@@ -2140,6 +2183,47 @@
}
}
},
"/v1/dashboard/summary": {
"get": {
"description": "Retrieve dashboard summary with key statistics",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"dashboard"
],
"summary": "Get dashboard summary",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.DashboardSummary"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoice-config-items": {
"get": {
"description": "Retrieve a list of all invoice config items",
@@ -3774,6 +3858,17 @@
}
},
"definitions": {
"models.AbnormalAlert": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"status": {
"type": "string"
}
}
},
"models.AlternativeComponent": {
"type": "object",
"properties": {
@@ -3986,6 +4081,46 @@
}
}
},
"models.ContainerStats": {
"type": "object",
"properties": {
"emptyContainers": {
"type": "integer"
},
"totalContainers": {
"type": "integer"
}
}
},
"models.DashboardSummary": {
"type": "object",
"properties": {
"abnormalAlerts": {
"type": "array",
"items": {
"$ref": "#/definitions/models.AbnormalAlert"
}
},
"emptyContainers": {
"$ref": "#/definitions/models.ContainerStats"
},
"lowStockComponents": {
"type": "integer"
},
"pendingInvoices": {
"type": "integer"
},
"todayInvoices": {
"type": "array",
"items": {
"$ref": "#/definitions/models.TodayInvoiceCount"
}
},
"totalComponents": {
"$ref": "#/definitions/models.TotalComponentStats"
}
}
},
"models.FindComponentItemResult": {
"type": "object",
"properties": {
@@ -4181,6 +4316,28 @@
}
}
},
"models.TodayInvoiceCount": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"models.TotalComponentStats": {
"type": "object",
"properties": {
"totalQuantity": {
"type": "integer"
},
"totalTypes": {
"type": "integer"
}
}
},
"models.Warehouse": {
"type": "object",
"properties": {
@@ -4835,6 +4992,26 @@
}
}
},
"responses.BodyProfileResponse": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/responses.UserInfoResponse"
},
"permissions": {
"type": "array",
"items": {
"type": "string"
}
},
"roles": {
"type": "array",
"items": {
"$ref": "#/definitions/responses.RoleItem"
}
}
}
},
"responses.BodyRegisterResponse": {
"type": "object",
"properties": {
@@ -4950,6 +5127,20 @@
}
}
},
"responses.RoleItem": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"responses.UpdateAlternativeComponentResponse": {
"type": "object",
"properties": {
@@ -5253,6 +5444,26 @@
"type": "string"
}
}
},
"responses.UserInfoResponse": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"fullName": {
"type": "string"
},
"id": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"username": {
"type": "string"
}
}
}
}
}