118 lines
3.0 KiB
Go
118 lines
3.0 KiB
Go
package airrescuechecklist
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
|
|
"wucher/internal/shared/pkg/uuidv7"
|
|
)
|
|
|
|
type AirRescuerChecklist struct {
|
|
ID []byte `gorm:"column:id;type:binary(16);primaryKey"`
|
|
HEMSBaseID []byte `gorm:"column:hems_base_id;type:binary(16);not null"`
|
|
ScopeCode string `gorm:"column:scope_code;type:varchar(20);not null"`
|
|
Title string `gorm:"column:title;type:varchar(150);not null"`
|
|
Position int `gorm:"column:position;not null;default:1"`
|
|
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
|
|
CreatedBy []byte `gorm:"column:created_by;type:binary(16)"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
|
|
UpdatedBy []byte `gorm:"column:updated_by;type:binary(16)"`
|
|
DeletedAt *time.Time `gorm:"column:deleted_at"`
|
|
DeletedBy []byte `gorm:"column:deleted_by;type:binary(16)"`
|
|
}
|
|
|
|
func (AirRescuerChecklist) TableName() string {
|
|
return "air_rescuer_checklists"
|
|
}
|
|
|
|
func (h *AirRescuerChecklist) BeforeCreate(tx *gorm.DB) error {
|
|
if len(h.ID) == 0 {
|
|
h.ID = uuidv7.MustBytes()
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type AirRescuerChecklistItem struct {
|
|
ID []byte `gorm:"column:id;type:binary(16);primaryKey"`
|
|
ChecklistID []byte `gorm:"column:checklist_id;type:binary(16);not null"`
|
|
Name string `gorm:"column:name;type:varchar(255);not null"`
|
|
Position int `gorm:"column:position;not null;default:1"`
|
|
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
|
|
CreatedBy []byte `gorm:"column:created_by;type:binary(16)"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
|
|
UpdatedBy []byte `gorm:"column:updated_by;type:binary(16)"`
|
|
DeletedAt *time.Time `gorm:"column:deleted_at"`
|
|
DeletedBy []byte `gorm:"column:deleted_by;type:binary(16)"`
|
|
}
|
|
|
|
func (AirRescuerChecklistItem) TableName() string {
|
|
return "air_rescuer_checklist_items"
|
|
}
|
|
|
|
func (h *AirRescuerChecklistItem) BeforeCreate(tx *gorm.DB) error {
|
|
if len(h.ID) == 0 {
|
|
h.ID = uuidv7.MustBytes()
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type HEMSBaseView struct {
|
|
ID []byte
|
|
BaseName string
|
|
BaseAbbreviation string
|
|
BaseCategory string
|
|
Position int
|
|
}
|
|
|
|
type ChecklistHeaderView struct {
|
|
ID []byte
|
|
HEMSBaseID []byte
|
|
BaseName string
|
|
BaseAbbreviation string
|
|
BaseCategory string
|
|
ScopeCode string
|
|
Title string
|
|
Position int
|
|
CreatedAt time.Time
|
|
CreatedBy []byte
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type ChecklistItemView struct {
|
|
ID []byte
|
|
ChecklistID []byte
|
|
Name string
|
|
Position int
|
|
CreatedAt time.Time
|
|
CreatedBy []byte
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type ChecklistHeaderFilter struct {
|
|
HEMSBaseID []byte
|
|
BaseName string
|
|
BaseAbbreviation string
|
|
ScopeCode string
|
|
CategoryType string
|
|
}
|
|
|
|
type HEMSBaseFilter struct {
|
|
HEMSBaseID []byte
|
|
BaseName string
|
|
BaseAbbreviation string
|
|
CategoryType string
|
|
}
|
|
|
|
type ChecklistCreateInput struct {
|
|
Checklist AirRescuerChecklist
|
|
Items []AirRescuerChecklistItem
|
|
}
|
|
|
|
type ChecklistItemReorderInput struct {
|
|
ID []byte
|
|
Position int
|
|
}
|