mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
FIX[BE]: Fix Delete one on chickin match with BE standard
This commit is contained in:
+19
-1
@@ -9,8 +9,16 @@ import (
|
||||
)
|
||||
|
||||
type ProjectFlockPopulationRepository interface {
|
||||
repository.BaseRepository[entity.ProjectFlockPopulation]
|
||||
// domain-specific
|
||||
GetByProjectFlockKandangID(ctx context.Context, projectFlockKandangID uint) (*entity.ProjectFlockPopulation, error)
|
||||
|
||||
// subset of base repository methods used by services
|
||||
CreateOne(ctx context.Context, entity *entity.ProjectFlockPopulation, modifier func(*gorm.DB) *gorm.DB) error
|
||||
PatchOne(ctx context.Context, id uint, updates map[string]any, modifier func(*gorm.DB) *gorm.DB) error
|
||||
|
||||
// transaction helpers
|
||||
WithTx(tx *gorm.DB) ProjectFlockPopulationRepository
|
||||
DB() *gorm.DB
|
||||
}
|
||||
|
||||
type projectFlockPopulationRepositoryImpl struct {
|
||||
@@ -23,6 +31,16 @@ func NewProjectFlockPopulationRepository(db *gorm.DB) ProjectFlockPopulationRepo
|
||||
}
|
||||
}
|
||||
|
||||
func (r *projectFlockPopulationRepositoryImpl) WithTx(tx *gorm.DB) ProjectFlockPopulationRepository {
|
||||
return &projectFlockPopulationRepositoryImpl{
|
||||
BaseRepositoryImpl: repository.NewBaseRepository[entity.ProjectFlockPopulation](tx),
|
||||
}
|
||||
}
|
||||
|
||||
func (r *projectFlockPopulationRepositoryImpl) DB() *gorm.DB {
|
||||
return r.BaseRepositoryImpl.DB()
|
||||
}
|
||||
|
||||
func (r *projectFlockPopulationRepositoryImpl) GetByProjectFlockKandangID(ctx context.Context, projectFlockKandangID uint) (*entity.ProjectFlockPopulation, error) {
|
||||
var record entity.ProjectFlockPopulation
|
||||
err := r.DB().WithContext(ctx).
|
||||
|
||||
Reference in New Issue
Block a user