diff --git a/backend/internal/services/student_service.go b/backend/internal/services/student_service.go new file mode 100644 index 0000000..e3f6980 --- /dev/null +++ b/backend/internal/services/student_service.go @@ -0,0 +1,19 @@ +package services + +import ( + "faladev/internal/repository" +) + +type StudentService struct { + repo *repository.StudentRepository +} + +func NewStudentService(repo *repository.StudentRepository) *StudentService { + return &StudentService{ + repo: repo, + } +} + +func (s *StudentService) InsertOrUpdateStudent(name, email, phone string) error { + return s.repo.InsertOrUpdateStudent(name, email, phone) +} diff --git a/backend/internal/services/token_service.go b/backend/internal/services/token_service.go new file mode 100644 index 0000000..261483e --- /dev/null +++ b/backend/internal/services/token_service.go @@ -0,0 +1,25 @@ +package services + +import ( + "faladev/internal/repository" + + "golang.org/x/oauth2" +) + +type TokenService struct { + repo *repository.TokenRepository +} + +func NewTokenService(repo *repository.TokenRepository) *TokenService { + return &TokenService{ + repo: repo, + } +} + +func (s *TokenService) CreateToken(token *oauth2.Token) error { + return s.repo.CreateToken(token) +} + +func (s *TokenService) GetToken() (*oauth2.Token, error) { + return s.repo.GetToken() +}