Merge branch 'development' of https://gitlab.com/mbugroup/lti-api into FEAT/BE/report_customer_payment

This commit is contained in:
aguhh18
2026-01-15 16:20:37 +07:00
27 changed files with 372 additions and 131 deletions
@@ -11,6 +11,7 @@ import (
type ProductionResultRepository interface {
GetRecordingsByProjectFlockKandang(ctx context.Context, projectFlockKandangID uint, offset, limit int) ([]entity.Recording, int64, error)
GetProductionStandardIDByProjectFlockKandangID(ctx context.Context, projectFlockKandangID uint) (uint, error)
}
type productionResultRepositoryImpl struct {
@@ -76,3 +77,25 @@ func (r *productionResultRepositoryImpl) GetRecordingsByProjectFlockKandang(
return recordings, total, nil
}
func (r *productionResultRepositoryImpl) GetProductionStandardIDByProjectFlockKandangID(ctx context.Context, projectFlockKandangID uint) (uint, error) {
if projectFlockKandangID == 0 {
return 0, nil
}
var row struct {
ProductionStandardID uint `gorm:"column:production_standard_id"`
}
err := r.db.WithContext(ctx).
Table("project_flock_kandangs pfk").
Select("pf.production_standard_id").
Joins("JOIN project_flocks pf ON pf.id = pfk.project_flock_id").
Where("pfk.id = ?", projectFlockKandangID).
Take(&row).Error
if err != nil {
return 0, err
}
return row.ProductionStandardID, nil
}