feat: add endpoints for retrieving stock alerts and anomaly items, including database queries and models
This commit is contained in:
@@ -2189,6 +2189,108 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/dashboard/anomalies": {
|
||||
"get": {
|
||||
"description": "Retrieve list of component items with abnormal status (damaged, expired, long_unused, pending_inspection)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"dashboard"
|
||||
],
|
||||
"summary": "Get anomaly items",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Filter by warehouse ID",
|
||||
"name": "warehouse_id",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.SuccessResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.AnomalyItem"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/dashboard/stock-alerts": {
|
||||
"get": {
|
||||
"description": "Retrieve list of components that are low on stock (total_quantity \u003c= min_quantity)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"dashboard"
|
||||
],
|
||||
"summary": "Get stock alerts",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.SuccessResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.StockAlert"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/dashboard/summary": {
|
||||
"get": {
|
||||
"description": "Retrieve dashboard summary with key statistics",
|
||||
@@ -2202,6 +2304,14 @@ const docTemplate = `{
|
||||
"dashboard"
|
||||
],
|
||||
"summary": "Get dashboard summary",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Filter by warehouse ID",
|
||||
"name": "warehouse_id",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -3904,6 +4014,38 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.AnomalyItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"componentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"componentName": {
|
||||
"type": "string"
|
||||
},
|
||||
"componentUnit": {
|
||||
"type": "string"
|
||||
},
|
||||
"containerId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Cabinet": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4322,6 +4464,32 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.StockAlert": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"componentTypeId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"componentTypeName": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"minQuantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"totalQuantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"unit": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TodayInvoiceCount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -2183,6 +2183,108 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/dashboard/anomalies": {
|
||||
"get": {
|
||||
"description": "Retrieve list of component items with abnormal status (damaged, expired, long_unused, pending_inspection)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"dashboard"
|
||||
],
|
||||
"summary": "Get anomaly items",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Filter by warehouse ID",
|
||||
"name": "warehouse_id",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.SuccessResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.AnomalyItem"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/dashboard/stock-alerts": {
|
||||
"get": {
|
||||
"description": "Retrieve list of components that are low on stock (total_quantity \u003c= min_quantity)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"dashboard"
|
||||
],
|
||||
"summary": "Get stock alerts",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.SuccessResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.StockAlert"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/dashboard/summary": {
|
||||
"get": {
|
||||
"description": "Retrieve dashboard summary with key statistics",
|
||||
@@ -2196,6 +2298,14 @@
|
||||
"dashboard"
|
||||
],
|
||||
"summary": "Get dashboard summary",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Filter by warehouse ID",
|
||||
"name": "warehouse_id",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -3898,6 +4008,38 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.AnomalyItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"componentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"componentName": {
|
||||
"type": "string"
|
||||
},
|
||||
"componentUnit": {
|
||||
"type": "string"
|
||||
},
|
||||
"containerId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Cabinet": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4316,6 +4458,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.StockAlert": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"componentTypeId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"componentTypeName": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"minQuantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"totalQuantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"unit": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TodayInvoiceCount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -26,6 +26,27 @@ definitions:
|
||||
priority:
|
||||
type: integer
|
||||
type: object
|
||||
models.AnomalyItem:
|
||||
properties:
|
||||
componentId:
|
||||
type: integer
|
||||
componentName:
|
||||
type: string
|
||||
componentUnit:
|
||||
type: string
|
||||
containerId:
|
||||
type: integer
|
||||
createdAt:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
quantity:
|
||||
type: integer
|
||||
status:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
models.Cabinet:
|
||||
properties:
|
||||
createdAt:
|
||||
@@ -300,6 +321,23 @@ definitions:
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
models.StockAlert:
|
||||
properties:
|
||||
componentTypeId:
|
||||
type: integer
|
||||
componentTypeName:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
minQuantity:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
totalQuantity:
|
||||
type: integer
|
||||
unit:
|
||||
type: string
|
||||
type: object
|
||||
models.TodayInvoiceCount:
|
||||
properties:
|
||||
count:
|
||||
@@ -2416,11 +2454,79 @@ paths:
|
||||
summary: Update container
|
||||
tags:
|
||||
- container
|
||||
/v1/dashboard/anomalies:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve list of component items with abnormal status (damaged,
|
||||
expired, long_unused, pending_inspection)
|
||||
parameters:
|
||||
- description: Filter by warehouse ID
|
||||
in: query
|
||||
name: warehouse_id
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.SuccessResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/models.AnomalyItem'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.ErrorResponse'
|
||||
summary: Get anomaly items
|
||||
tags:
|
||||
- dashboard
|
||||
/v1/dashboard/stock-alerts:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve list of components that are low on stock (total_quantity
|
||||
<= min_quantity)
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.SuccessResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/models.StockAlert'
|
||||
type: array
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.ErrorResponse'
|
||||
summary: Get stock alerts
|
||||
tags:
|
||||
- dashboard
|
||||
/v1/dashboard/summary:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve dashboard summary with key statistics
|
||||
parameters:
|
||||
- description: Filter by warehouse ID
|
||||
in: query
|
||||
name: warehouse_id
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
||||
Reference in New Issue
Block a user