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

92 lines
3.8 KiB
Go

package dto
// JSON:API Federal State DTOs
type FederalStateAttributes struct {
Name string `json:"name" example:"Bayern"`
Note string `json:"note,omitempty" example:"Central region"`
LandID string `json:"land_id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
LandName string `json:"land_name,omitempty" example:"Germany"`
LandISOCode string `json:"land_iso_code,omitempty" example:"DE"`
SortKey *int `json:"sortkey" example:"1"`
IsActive bool `json:"is_active" example:"true"`
CreatedAt string `json:"created_at,omitempty" example:"2026-03-12T03:04:05Z"`
CreatedBy string `json:"created_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
UpdatedAt string `json:"updated_at,omitempty" example:"2026-03-12T03:04:05Z"`
UpdatedBy string `json:"updated_by,omitempty" 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 FederalStateResource struct {
Type string `json:"type" example:"federal_state"`
ID string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
Attributes FederalStateAttributes `json:"attributes"`
}
type FederalStateResponse struct {
Data FederalStateResource `json:"data"`
}
type FederalStateDeleteResponse struct {
Data struct {
Type string `json:"type" example:"federal_state_delete"`
Attributes struct {
Deleted bool `json:"deleted" example:"true"`
} `json:"attributes"`
} `json:"data"`
}
type FederalStateListResponse struct {
Data []FederalStateResource `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 FederalStateDataTableResponse struct {
Data []FederalStateResource `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 FederalStateCreateAttributes struct {
Name string `json:"name" validate:"required" example:"Bayern"`
Note *string `json:"note,omitempty" example:"Central region"`
LandID string `json:"land_id" validate:"required" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
SortKey *int `json:"sortkey" example:"1"`
IsActive *bool `json:"is_active,omitempty" example:"true"`
}
type FederalStateCreateData struct {
Type string `json:"type" validate:"required,oneof=federal_state_create federal_state" example:"federal_state_create"`
Attributes FederalStateCreateAttributes `json:"attributes" validate:"required"`
}
type FederalStateCreateRequest struct {
Data FederalStateCreateData `json:"data" validate:"required"`
}
type FederalStateUpdateAttributes struct {
Name *string `json:"name,omitempty" example:"Bayern"`
Note *string `json:"note,omitempty" example:"Central region"`
LandID *string `json:"land_id,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
SortKey NullInt `json:"sortkey,omitempty" swaggertype:"integer" example:"1"`
IsActive *bool `json:"is_active,omitempty" example:"true"`
}
type FederalStateUpdateData struct {
Type string `json:"type" validate:"required,oneof=federal_state_update federal_state" example:"federal_state_update"`
ID string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
Attributes FederalStateUpdateAttributes `json:"attributes" validate:"required"`
}
type FederalStateUpdateRequest struct {
Data FederalStateUpdateData `json:"data" validate:"required"`
}