42 lines
1.8 KiB
Go
42 lines
1.8 KiB
Go
package fmreport
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
|
|
"wucher/internal/shared/pkg/uuidv7"
|
|
)
|
|
|
|
type Report struct {
|
|
ID []byte `gorm:"type:binary(16);primaryKey;column:id"`
|
|
TakeoverID []byte `gorm:"type:binary(16);not null;uniqueIndex:uidx_fm_reports_takeover_id;index;column:takeover_id"`
|
|
FlightID []byte `gorm:"type:binary(16);not null;uniqueIndex:uidx_fm_reports_flight_id;index;column:flight_id"`
|
|
FlightInspectionID []byte `gorm:"type:binary(16);not null;uniqueIndex:uidx_fm_reports_flight_inspection_id;index;column:flight_inspection_id"`
|
|
|
|
HelicopterID []byte `gorm:"type:binary(16);uniqueIndex:uidx_fm_reports_helicopter_report_code,priority:1;column:helicopter_id"`
|
|
ReportCode *string `gorm:"type:varchar(32);uniqueIndex:uidx_fm_reports_helicopter_report_code,priority:2;column:report_code"`
|
|
Engine1GpcN1 *string `gorm:"type:varchar(255);null;column:engine1_gpc_n1"`
|
|
Engine1PtcN2 *string `gorm:"type:varchar(255);null;column:engine1_ptc_n2"`
|
|
Engine2GpcN1 *string `gorm:"type:varchar(255);null;column:engine2_gpc_n1"`
|
|
Engine2PtcN2 *string `gorm:"type:varchar(255);null;column:engine2_ptc_n2"`
|
|
CompletedAt *time.Time `gorm:"type:datetime(3);column:completed_at"`
|
|
CompletedBy []byte `gorm:"type:binary(16);column:completed_by"`
|
|
|
|
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"`
|
|
DeletedAt *time.Time `gorm:"column:deleted_at;index"`
|
|
DeletedBy []byte `gorm:"type:binary(16);column:deleted_by"`
|
|
}
|
|
|
|
func (Report) TableName() string { return "fm_reports" }
|
|
|
|
func (r *Report) BeforeCreate(tx *gorm.DB) error {
|
|
if len(r.ID) == 0 {
|
|
r.ID = uuidv7.MustBytes()
|
|
}
|
|
return nil
|
|
}
|