package repository import ( "context" "gitlab.com/mbugroup/lti-api.git/internal/common/repository" entity "gitlab.com/mbugroup/lti-api.git/internal/entities" "gorm.io/gorm" ) type LocationRepository interface { repository.BaseRepository[entity.Location] AreaExists(ctx context.Context, areaId uint) (bool, error) NameExists(ctx context.Context, name string, excludeID *uint) (bool, error) } type LocationRepositoryImpl struct { *repository.BaseRepositoryImpl[entity.Location] db *gorm.DB } func NewLocationRepository(db *gorm.DB) LocationRepository { return &LocationRepositoryImpl{ BaseRepositoryImpl: repository.NewBaseRepository[entity.Location](db), db: db, } } func (r *LocationRepositoryImpl) AreaExists(ctx context.Context, areaId uint) (bool, error) { return repository.Exists[entity.Area](ctx, r.db, areaId) } func (r *LocationRepositoryImpl) NameExists(ctx context.Context, name string, excludeID *uint) (bool, error) { return repository.ExistsByName[entity.Location](ctx, r.db, name, excludeID) }