feat: add components management functionality
This commit is contained in:
19
internal/models/component_model.go
Normal file
19
internal/models/component_model.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Component struct {
|
||||
ID int64 `json:"id"`
|
||||
ComponentTypeID int64 `json:"componentTypeId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Unit string `json:"unit"`
|
||||
TotalQuantity int32 `json:"totalQuantity"`
|
||||
MinQuantity int32 `json:"minQuantity"`
|
||||
Metadata json.RawMessage `json:"metadata"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
21
internal/models/requests/component_request.go
Normal file
21
internal/models/requests/component_request.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package requests
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type CreateComponentRequest struct {
|
||||
ComponentTypeID int64 `json:"componentTypeId" binding:"required"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
Unit string `json:"unit" binding:"required"`
|
||||
MinQuantity int32 `json:"minQuantity" binding:"required"`
|
||||
Metadata json.RawMessage `json:"metadata"`
|
||||
}
|
||||
|
||||
type UpdateComponentRequest struct {
|
||||
ComponentTypeID int64 `json:"componentTypeId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Unit string `json:"unit"`
|
||||
MinQuantity int32 `json:"minQuantity"`
|
||||
Metadata json.RawMessage `json:"metadata"`
|
||||
}
|
||||
14
internal/models/responses/component_response.go
Normal file
14
internal/models/responses/component_response.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package responses
|
||||
|
||||
type CreateComponentResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
type UpdateComponentResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
ComponentTypeID int64 `json:"componentTypeId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Unit string `json:"unit"`
|
||||
MinQuantity int32 `json:"minQuantity"`
|
||||
}
|
||||
Reference in New Issue
Block a user