142 lines
7.8 KiB
Go
142 lines
7.8 KiB
Go
package auth
|
|
|
|
import "time"
|
|
|
|
// PilotProfile stores role-specific data for role=pilot.
|
|
type PilotProfile struct {
|
|
UserID []byte `gorm:"type:binary(16);primaryKey;column:user_id"`
|
|
PilotCategory string `gorm:"type:varchar(16);not null;index;column:pilot_category"`
|
|
ShortName string `gorm:"type:varchar(120);column:short_name"`
|
|
LicenseNo string `gorm:"type:varchar(120);index;column:license_no"`
|
|
LicenseIssuedAt *time.Time `gorm:"column:license_issued_at"`
|
|
LicenseExpiredAt *time.Time `gorm:"column:license_expired_at"`
|
|
TechnicianLicenseNo string `gorm:"type:varchar(120);column:technician_license_no"`
|
|
HasIFRQualification bool `gorm:"not null;default:false;column:has_ifr_qualification"`
|
|
IsChiefPilot bool `gorm:"not null;default:false;column:is_chief_pilot"`
|
|
IsDUL bool `gorm:"not null;default:false;column:is_dul"`
|
|
TotalFlightMinutes int `gorm:"not null;default:0;column:total_flight_minutes"`
|
|
ResponsiblePilotMinutes int `gorm:"not null;default:0;column:responsible_pilot_minutes"`
|
|
SecondPilotMinutes int `gorm:"not null;default:0;column:second_pilot_minutes"`
|
|
DoubleCommandMinutes int `gorm:"not null;default:0;column:double_command_minutes"`
|
|
FlightInstructorMinutes int `gorm:"not null;default:0;column:flight_instructor_minutes"`
|
|
NightFlightMinutes int `gorm:"not null;default:0;column:night_flight_minutes"`
|
|
IFRFlightMinutes int `gorm:"not null;default:0;column:ifr_flight_minutes"`
|
|
Location string `gorm:"type:varchar(255);column:location"`
|
|
Postcode string `gorm:"type:varchar(32);column:postcode"`
|
|
StreetLine string `gorm:"type:varchar(255);column:street_line"`
|
|
Note string `gorm:"type:text;column:note"`
|
|
WeightKG *float64 `gorm:"type:decimal(8,2);column:weight_kg"`
|
|
PhotoFileID string `gorm:"type:varchar(255);column:photo_file_id"`
|
|
CreatedAt time.Time
|
|
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
|
|
UpdatedAt time.Time
|
|
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
|
|
|
|
User User `gorm:"foreignKey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
}
|
|
|
|
func (PilotProfile) TableName() string { return "pilot_profiles" }
|
|
|
|
// DoctorProfile stores role-specific data for role=doctor.
|
|
type DoctorProfile struct {
|
|
UserID []byte `gorm:"type:binary(16);primaryKey;column:user_id"`
|
|
ShortName string `gorm:"type:varchar(120);column:short_name"`
|
|
Specialization string `gorm:"type:varchar(120);column:specialization"`
|
|
SubSpecialization string `gorm:"type:varchar(120);column:sub_specialization"`
|
|
IsChiefPhysician bool `gorm:"not null;default:false;column:is_chief_physician"`
|
|
Location string `gorm:"type:varchar(255);column:location"`
|
|
Postcode string `gorm:"type:varchar(32);column:postcode"`
|
|
StreetLine string `gorm:"type:varchar(255);column:street_line"`
|
|
Note string `gorm:"type:text;column:note"`
|
|
PhotoFileID string `gorm:"type:varchar(255);column:photo_file_id"`
|
|
CreatedAt time.Time
|
|
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
|
|
UpdatedAt time.Time
|
|
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
|
|
|
|
User User `gorm:"foreignKey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
}
|
|
|
|
func (DoctorProfile) TableName() string { return "doctor_profiles" }
|
|
|
|
// AirRescuerProfile stores role-specific data for role=air_rescuer.
|
|
type AirRescuerProfile struct {
|
|
UserID []byte `gorm:"type:binary(16);primaryKey;column:user_id"`
|
|
ShortName string `gorm:"type:varchar(120);column:short_name"`
|
|
ResponsibleFlightRescuer bool `gorm:"not null;default:false;column:responsible_flight_rescuer"`
|
|
Location string `gorm:"type:varchar(255);column:location"`
|
|
Postcode string `gorm:"type:varchar(32);column:postcode"`
|
|
StreetLine string `gorm:"type:varchar(255);column:street_line"`
|
|
Note string `gorm:"type:text;column:note"`
|
|
PhotoFileID string `gorm:"type:varchar(255);column:photo_file_id"`
|
|
CreatedAt time.Time
|
|
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
|
|
UpdatedAt time.Time
|
|
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
|
|
|
|
User User `gorm:"foreignKey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
}
|
|
|
|
func (AirRescuerProfile) TableName() string { return "air_rescuer_profiles" }
|
|
|
|
// TechnicianProfile stores role-specific data for role=technician.
|
|
type TechnicianProfile struct {
|
|
UserID []byte `gorm:"type:binary(16);primaryKey;column:user_id"`
|
|
ShortName string `gorm:"type:varchar(120);column:short_name"`
|
|
LicenseNo string `gorm:"type:varchar(120);index;column:license_no"`
|
|
IsChiefTechnician bool `gorm:"not null;default:false;column:is_chief_technician"`
|
|
IsResponsibleComplaints bool `gorm:"not null;default:false;column:is_responsible_complaints"`
|
|
Location string `gorm:"type:varchar(255);column:location"`
|
|
Postcode string `gorm:"type:varchar(32);column:postcode"`
|
|
StreetLine string `gorm:"type:varchar(255);column:street_line"`
|
|
Note string `gorm:"type:text;column:note"`
|
|
PhotoFileID string `gorm:"type:varchar(255);column:photo_file_id"`
|
|
CreatedAt time.Time
|
|
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
|
|
UpdatedAt time.Time
|
|
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
|
|
|
|
User User `gorm:"foreignKey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
}
|
|
|
|
func (TechnicianProfile) TableName() string { return "technician_profiles" }
|
|
|
|
// FlightAssistantProfile stores role-specific data for role=flight_assistant.
|
|
type FlightAssistantProfile struct {
|
|
UserID []byte `gorm:"type:binary(16);primaryKey;column:user_id"`
|
|
ShortName string `gorm:"type:varchar(120);column:short_name"`
|
|
Location string `gorm:"type:varchar(255);column:location"`
|
|
Postcode string `gorm:"type:varchar(32);column:postcode"`
|
|
StreetLine string `gorm:"type:varchar(255);column:street_line"`
|
|
Note string `gorm:"type:text;column:note"`
|
|
PhotoFileID string `gorm:"type:varchar(255);column:photo_file_id"`
|
|
CreatedAt time.Time
|
|
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
|
|
UpdatedAt time.Time
|
|
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
|
|
|
|
User User `gorm:"foreignKey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
}
|
|
|
|
func (FlightAssistantProfile) TableName() string { return "flight_assistant_profiles" }
|
|
|
|
// StaffProfile stores role-specific data for role=staff.
|
|
type StaffProfile struct {
|
|
UserID []byte `gorm:"type:binary(16);primaryKey;column:user_id"`
|
|
ShortName string `gorm:"type:varchar(120);column:short_name"`
|
|
RoleLabel string `gorm:"type:varchar(120);column:role_label"`
|
|
Location string `gorm:"type:varchar(255);column:location"`
|
|
Postcode string `gorm:"type:varchar(32);column:postcode"`
|
|
StreetLine string `gorm:"type:varchar(255);column:street_line"`
|
|
Note string `gorm:"type:text;column:note"`
|
|
PhotoFileID string `gorm:"type:varchar(255);column:photo_file_id"`
|
|
CreatedAt time.Time
|
|
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
|
|
UpdatedAt time.Time
|
|
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
|
|
|
|
User User `gorm:"foreignKey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
}
|
|
|
|
func (StaffProfile) TableName() string { return "staff_profiles" }
|