feat: add component_codes management functionality
This commit is contained in:
16
internal/models/component_code_model.go
Normal file
16
internal/models/component_code_model.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ComponentCode struct {
|
||||
ID int64 `json:"id"`
|
||||
ComponentID int64 `json:"componentId"`
|
||||
Code string `json:"code"`
|
||||
CodeType string `json:"codeType"`
|
||||
IsPrimary bool `json:"isPrimary"`
|
||||
Metadata json.RawMessage `json:"metadata"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
19
internal/models/requests/component_code_request.go
Normal file
19
internal/models/requests/component_code_request.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package requests
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type CreateComponentCodeRequest struct {
|
||||
ComponentID int64 `json:"componentId" binding:"required"`
|
||||
Code string `json:"code" binding:"required"`
|
||||
CodeType string `json:"codeType"`
|
||||
IsPrimary bool `json:"isPrimary"`
|
||||
Metadata json.RawMessage `json:"metadata"`
|
||||
}
|
||||
|
||||
type UpdateComponentCodeRequest struct {
|
||||
ComponentID int64 `json:"componentId"`
|
||||
Code string `json:"code"`
|
||||
CodeType string `json:"codeType"`
|
||||
IsPrimary *bool `json:"isPrimary"`
|
||||
Metadata json.RawMessage `json:"metadata"`
|
||||
}
|
||||
13
internal/models/responses/component_code_response.go
Normal file
13
internal/models/responses/component_code_response.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package responses
|
||||
|
||||
type CreateComponentCodeResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
type UpdateComponentCodeResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
ComponentID int64 `json:"componentId"`
|
||||
Code string `json:"code"`
|
||||
CodeType string `json:"codeType"`
|
||||
IsPrimary bool `json:"isPrimary"`
|
||||
}
|
||||
Reference in New Issue
Block a user