package service import ( "context" "opencatd-open/internal/dao" "opencatd-open/internal/store" "opencatd-open/pkg/config" "gorm.io/gorm" ) type UserServiceImpl struct { cfg *config.Config db *gorm.DB userRepo *dao.UserDAO } func NewUserService(cfg *config.Config, db *gorm.DB, userRepo *dao.UserDAO) *UserServiceImpl { return &UserServiceImpl{ cfg: cfg, db: db, userRepo: userRepo, } } func (s *UserServiceImpl) GetByID(ctx context.Context, id uint64) (*store.User, error) { return s.userRepo.GetByID(id) } func (s *UserServiceImpl) GetByUsername(ctx context.Context, username string) (*store.User, error) { return s.userRepo.GetByUsername(username) } func (s *UserServiceImpl) List(ctx context.Context, limit, offset int) ([]*store.User, int64, error) { return s.userRepo.List(limit, offset) } func (s *UserServiceImpl) Create(ctx context.Context, user *store.User) error { return s.userRepo.Create(user) } func (s *UserServiceImpl) Update(ctx context.Context, user *store.User) error { return s.userRepo.Update(user) } func (s *UserServiceImpl) Delete(ctx context.Context, id uint64) error { return s.userRepo.Delete(id) }