Files
fm_be/internal/domain/flight_prep_check/model.go
2026-07-16 22:16:45 +07:00

51 lines
1.5 KiB
Go

package flightprepcheck
import (
"time"
"gorm.io/gorm"
"wucher/internal/shared/pkg/uuidv7"
)
type FlightPrepCheck struct {
ID []byte `gorm:"type:binary(16);primaryKey;column:id"`
NOTAMBriefing bool `gorm:"type:tinyint(1);not null;default:0;column:notam_briefing"`
WeatherBriefing bool `gorm:"type:tinyint(1);not null;default:0;column:weather_briefing"`
OperationalFlightPlan bool `gorm:"type:tinyint(1);not null;default:0;column:operational_flight_plan"`
FlightInspectionID []byte `gorm:"type:binary(16);not null;uniqueIndex:uk_flight_prep_checks_inspection;column:flight_inspection_id"`
CreatedAt time.Time `gorm:"column:created_at"`
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
UpdatedAt time.Time `gorm:"column:updated_at"`
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
}
func (FlightPrepCheck) TableName() string { return "flight_prep_checks" }
func (f *FlightPrepCheck) BeforeCreate(tx *gorm.DB) error {
if len(f.ID) == 0 {
f.ID = uuidv7.MustBytes()
}
return nil
}
type ValidationError struct {
Status int
Title string
Pointer string
Detail string
}
func (e *ValidationError) Error() string {
if e == nil {
return ""
}
return e.Detail
}
type UpsertRequest struct {
NOTAMBriefing *bool `json:"notam_briefing,omitempty"`
WeatherBriefing *bool `json:"weather_briefing,omitempty"`
OperationalFlightPlan *bool `json:"operational_flight_plan,omitempty"`
}