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

@@ -1327,6 +1327,49 @@ const docTemplate = `{
}
}
},
"/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",
@@ -2146,6 +2189,47 @@ const docTemplate = `{
}
}
},
"/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",
@@ -3780,6 +3864,17 @@ const docTemplate = `{
}
},
"definitions": {
"models.AbnormalAlert": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"status": {
"type": "string"
}
}
},
"models.AlternativeComponent": {
"type": "object",
"properties": {
@@ -3992,6 +4087,46 @@ const docTemplate = `{
}
}
},
"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": {
@@ -4187,6 +4322,28 @@ const docTemplate = `{
}
}
},
"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": {
@@ -4841,6 +4998,26 @@ const docTemplate = `{
}
}
},
"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": {
@@ -4956,6 +5133,20 @@ const docTemplate = `{
}
}
},
"responses.RoleItem": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"responses.UpdateAlternativeComponentResponse": {
"type": "object",
"properties": {
@@ -5259,6 +5450,26 @@ const docTemplate = `{
"type": "string"
}
}
},
"responses.UserInfoResponse": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"fullName": {
"type": "string"
},
"id": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"username": {
"type": "string"
}
}
}
}
}`