setup user/auth repository and service
This commit is contained in:
parent
8db61212d9
commit
0ae9cd7133
7 changed files with 249 additions and 4 deletions
25
internal/service/user.go
Normal file
25
internal/service/user.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"git.juancwu.dev/juancwu/budgething/internal/model"
|
||||
"git.juancwu.dev/juancwu/budgething/internal/repository"
|
||||
)
|
||||
|
||||
type UserService struct {
|
||||
userRepository repository.UserRepository
|
||||
}
|
||||
|
||||
func NewUserService(userRepository repository.UserRepository) *UserService {
|
||||
return &UserService{
|
||||
userRepository: userRepository,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *UserService) ByID(id string) (*model.User, error) {
|
||||
user, err := s.userRepository.ByID(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return user, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue