mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
FIX[BE]: name duplicate flock,projectflock category change,menerapkan dto seperti warehouse di projectflock
This commit is contained in:
@@ -1,21 +1,30 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
||||
"context"
|
||||
|
||||
"gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
||||
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FlockRepository interface {
|
||||
repository.BaseRepository[entity.Flock]
|
||||
NameExists(ctx context.Context, name string, excludeID *uint) (bool, error)
|
||||
}
|
||||
|
||||
type FlockRepositoryImpl struct {
|
||||
*repository.BaseRepositoryImpl[entity.Flock]
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewFlockRepository(db *gorm.DB) FlockRepository {
|
||||
return &FlockRepositoryImpl{
|
||||
BaseRepositoryImpl: repository.NewBaseRepository[entity.Flock](db),
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *FlockRepositoryImpl) NameExists(ctx context.Context, name string, excludeID *uint) (bool, error) {
|
||||
return repository.ExistsByName[entity.Flock](ctx, r.db, name, excludeID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user