48 lines
1.6 KiB
Go
48 lines
1.6 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"wucher/internal/domain/mcf"
|
|
)
|
|
|
|
type MCFService struct{ repo mcf.Repository }
|
|
|
|
func NewMCFService(repo mcf.Repository) *MCFService { return &MCFService{repo: repo} }
|
|
|
|
func (s *MCFService) Create(ctx context.Context, row *mcf.MaintenanceCheckFlight) error {
|
|
return s.repo.Create(ctx, row)
|
|
}
|
|
|
|
func (s *MCFService) Update(ctx context.Context, row *mcf.MaintenanceCheckFlight) error {
|
|
return s.repo.Update(ctx, row)
|
|
}
|
|
|
|
func (s *MCFService) Delete(ctx context.Context, id []byte, deletedBy []byte) error {
|
|
return s.repo.Delete(ctx, id, deletedBy)
|
|
}
|
|
|
|
func (s *MCFService) GetByID(ctx context.Context, id []byte) (*mcf.MaintenanceCheckFlight, error) {
|
|
return s.repo.GetByID(ctx, id)
|
|
}
|
|
|
|
func (s *MCFService) ListByHelicopter(ctx context.Context, helicopterID []byte) ([]mcf.MaintenanceCheckFlight, error) {
|
|
return s.repo.ListByHelicopter(ctx, helicopterID)
|
|
}
|
|
|
|
func (s *MCFService) GetLatestByHelicopter(ctx context.Context, helicopterID []byte) (*mcf.MaintenanceCheckFlight, error) {
|
|
return s.repo.GetLatestByHelicopter(ctx, helicopterID)
|
|
}
|
|
|
|
func (s *MCFService) LatestByHelicopterIDs(ctx context.Context, helicopterIDs [][]byte) (map[string]*mcf.MaintenanceCheckFlight, error) {
|
|
return s.repo.LatestByHelicopterIDs(ctx, helicopterIDs)
|
|
}
|
|
|
|
func (s *MCFService) PendingHelicopterIDs(ctx context.Context, helicopterIDs [][]byte) (map[string]bool, error) {
|
|
return s.repo.PendingHelicopterIDs(ctx, helicopterIDs)
|
|
}
|
|
|
|
func (s *MCFService) HelicopterHasOpenMCF(ctx context.Context, helicopterID []byte) (bool, error) {
|
|
return s.repo.HelicopterHasOpenMCF(ctx, helicopterID)
|
|
}
|