init push
This commit is contained in:
77
internal/transport/http/dto/opc_dto.go
Normal file
77
internal/transport/http/dto/opc_dto.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package dto
|
||||
|
||||
// JSON:API OPC DTOs
|
||||
|
||||
type OpcAttributes struct {
|
||||
Title string `json:"title" example:"Main OPC Base"`
|
||||
SortKey *int `json:"sortkey" example:"1"`
|
||||
Note string `json:"note,omitempty" example:"Primary operation control center"`
|
||||
IsActive bool `json:"is_active" example:"true"`
|
||||
CreatedAt string `json:"created_at,omitempty" example:"2026-03-12T03:04:05Z"`
|
||||
CreatedBy string `json:"created_by" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
|
||||
UpdatedAt string `json:"updated_at,omitempty" example:"2026-03-12T03:04:05Z"`
|
||||
UpdatedBy string `json:"updated_by" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
|
||||
DeletedAt string `json:"deleted_at,omitempty" example:"2026-03-12T03:04:05Z"`
|
||||
DeletedBy string `json:"deleted_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
|
||||
}
|
||||
|
||||
type OpcResource struct {
|
||||
Type string `json:"type" example:"opc"`
|
||||
ID string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
|
||||
Attributes OpcAttributes `json:"attributes"`
|
||||
}
|
||||
|
||||
type OpcResponse struct {
|
||||
Data OpcResource `json:"data"`
|
||||
}
|
||||
|
||||
type OpcListResponse struct {
|
||||
Data []OpcResource `json:"data"`
|
||||
Meta struct {
|
||||
PageNumber int `json:"page_number" example:"1"`
|
||||
PageSize int `json:"page_size" example:"20"`
|
||||
Total int64 `json:"total" example:"120"`
|
||||
} `json:"meta"`
|
||||
}
|
||||
|
||||
type OpcDataTableResponse struct {
|
||||
Data []OpcResource `json:"data"`
|
||||
Meta struct {
|
||||
Draw int `json:"draw" example:"1"`
|
||||
RecordsTotal int64 `json:"records_total" example:"120"`
|
||||
RecordsFiltered int64 `json:"records_filtered" example:"12"`
|
||||
} `json:"meta"`
|
||||
}
|
||||
|
||||
type OpcCreateAttributes struct {
|
||||
Title string `json:"title" validate:"required" example:"Main OPC Base"`
|
||||
SortKey *int `json:"sortkey" example:"1"`
|
||||
Note *string `json:"note,omitempty" example:"Primary operation control center"`
|
||||
IsActive *bool `json:"is_active,omitempty" example:"true"`
|
||||
}
|
||||
|
||||
type OpcCreateData struct {
|
||||
Type string `json:"type" validate:"required,oneof=opc_create opc" example:"opc_create"`
|
||||
Attributes OpcCreateAttributes `json:"attributes" validate:"required"`
|
||||
}
|
||||
|
||||
type OpcCreateRequest struct {
|
||||
Data OpcCreateData `json:"data" validate:"required"`
|
||||
}
|
||||
|
||||
type OpcUpdateAttributes struct {
|
||||
Title *string `json:"title,omitempty" example:"Main OPC Base"`
|
||||
SortKey NullInt `json:"sortkey,omitempty" swaggertype:"integer" example:"1"`
|
||||
Note *string `json:"note,omitempty" example:"Primary operation control center"`
|
||||
IsActive *bool `json:"is_active,omitempty" example:"true"`
|
||||
}
|
||||
|
||||
type OpcUpdateData struct {
|
||||
Type string `json:"type" validate:"required,oneof=opc_update opc" example:"opc_update"`
|
||||
ID string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
|
||||
Attributes OpcUpdateAttributes `json:"attributes" validate:"required"`
|
||||
}
|
||||
|
||||
type OpcUpdateRequest struct {
|
||||
Data OpcUpdateData `json:"data" validate:"required"`
|
||||
}
|
||||
Reference in New Issue
Block a user