deleted edit function in project-flock, and must retest closing feat after fixing product warehouse

This commit is contained in:
ragilap
2025-12-04 18:44:56 +07:00
parent 6e3a8f3551
commit b43e2b44ec
9 changed files with 208 additions and 467 deletions
@@ -20,6 +20,7 @@ type ProjectFlockKandangRepository interface {
DeleteMany(ctx context.Context, projectFlockID uint, kandangIDs []uint) error
GetAll(ctx context.Context, offset int, limit int, modifier func(*gorm.DB) *gorm.DB) ([]entity.ProjectFlockKandang, int64, error)
GetAllWithFilters(ctx context.Context, offset int, limit int, params interface{}) ([]entity.ProjectFlockKandang, int64, error)
GetByProjectFlockID(ctx context.Context, projectFlockID uint) ([]entity.ProjectFlockKandang, error)
ListExistingKandangIDs(ctx context.Context, projectFlockID uint, kandangIDs []uint) ([]uint, error)
HasKandangsLinkedToOtherProject(ctx context.Context, kandangIDs []uint, exceptProjectID *uint) (bool, error)
FindKandangsWithRecordings(ctx context.Context, projectFlockID uint, kandangIDs []uint) ([]entity.Kandang, error)
@@ -77,6 +78,16 @@ func (r *projectFlockKandangRepositoryImpl) GetAll(ctx context.Context, offset i
return records, total, nil
}
func (r *projectFlockKandangRepositoryImpl) GetByProjectFlockID(ctx context.Context, projectFlockID uint) ([]entity.ProjectFlockKandang, error) {
var records []entity.ProjectFlockKandang
if err := r.db.WithContext(ctx).
Where("project_flock_id = ?", projectFlockID).
Find(&records).Error; err != nil {
return nil, err
}
return records, nil
}
func (r *projectFlockKandangRepositoryImpl) GetAllWithFilters(ctx context.Context, offset int, limit int, params interface{}) ([]entity.ProjectFlockKandang, int64, error) {
var records []entity.ProjectFlockKandang
var total int64