Files
fm_be/internal/transport/http/dto/vocation_dto.go
2026-07-16 22:16:45 +07:00

78 lines
3.0 KiB
Go

package dto
// JSON:API Vocation DTOs
type VocationAttributes struct {
Name string `json:"name" example:"Pilot"`
SortKey *int `json:"sortkey" example:"1"`
Note string `json:"note,omitempty" example:"Helicopter pilot vocation"`
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 VocationResource struct {
Type string `json:"type" example:"vocation"`
ID string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
Attributes VocationAttributes `json:"attributes"`
}
type VocationResponse struct {
Data VocationResource `json:"data"`
}
type VocationListResponse struct {
Data []VocationResource `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 VocationDataTableResponse struct {
Data []VocationResource `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 VocationCreateAttributes struct {
Name string `json:"name" validate:"required" example:"Pilot"`
SortKey *int `json:"sortkey" example:"1"`
Note *string `json:"note,omitempty" example:"Helicopter pilot vocation"`
IsActive *bool `json:"is_active,omitempty" example:"true"`
}
type VocationCreateData struct {
Type string `json:"type" validate:"required,oneof=vocation_create vocation" example:"vocation_create"`
Attributes VocationCreateAttributes `json:"attributes" validate:"required"`
}
type VocationCreateRequest struct {
Data VocationCreateData `json:"data" validate:"required"`
}
type VocationUpdateAttributes struct {
Name *string `json:"name,omitempty" example:"Pilot"`
SortKey NullInt `json:"sortkey,omitempty" swaggertype:"integer" example:"1"`
Note *string `json:"note,omitempty" example:"Helicopter pilot vocation"`
IsActive *bool `json:"is_active,omitempty" example:"true"`
}
type VocationUpdateData struct {
Type string `json:"type" validate:"required,oneof=vocation_update vocation" example:"vocation_update"`
ID string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
Attributes VocationUpdateAttributes `json:"attributes" validate:"required"`
}
type VocationUpdateRequest struct {
Data VocationUpdateData `json:"data" validate:"required"`
}