init push

This commit is contained in:
2026-07-16 22:16:45 +07:00
commit 8b068bdb10
1021 changed files with 332816 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package flightinspection
import (
"time"
"gorm.io/gorm"
"wucher/internal/shared/pkg/uuidv7"
)
const (
StatusDraft = "Draft"
StatusInProgress = "InProgress"
StatusCompleted = "Completed"
)
type FlightInspection struct {
ID []byte `gorm:"type:binary(16);primaryKey;column:id"`
InspectionDate time.Time `gorm:"type:date;not null;index;column:inspection_date"`
Status string `gorm:"type:varchar(20);not null;default:Draft;index;check:chk_flight_inspection_status,status IN ('Draft','InProgress','Completed');column:status"`
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 (FlightInspection) TableName() string { return "flight_inspections" }
func (f *FlightInspection) BeforeCreate(tx *gorm.DB) error {
if len(f.ID) == 0 {
f.ID = uuidv7.MustBytes()
}
return nil
}

View File

@@ -0,0 +1,13 @@
package flightinspection
import "context"
type FlightInspectionRepository interface {
Create(ctx context.Context, row *FlightInspection) error
Update(ctx context.Context, row *FlightInspection) error
GetByID(ctx context.Context, id []byte) (*FlightInspection, error)
List(ctx context.Context, sort string, limit, offset int) ([]FlightInspection, int64, error)
}
// Repository is kept as backward-compatible alias for older services/wirings.
type Repository = FlightInspectionRepository

View File

@@ -0,0 +1,10 @@
package flightinspection
import "context"
type FlightInspectionService interface {
CreateDraft(ctx context.Context, row *FlightInspection) error
Update(ctx context.Context, row *FlightInspection) error
GetByID(ctx context.Context, id []byte) (*FlightInspection, error)
List(ctx context.Context, sort string, limit, offset int) ([]FlightInspection, int64, error)
}