Skip to content

Commit

Permalink
Ajuste em services student e token
Browse files Browse the repository at this point in the history
  • Loading branch information
mffonseca committed Jul 26, 2024
1 parent 6b83dcf commit 030e940
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
19 changes: 19 additions & 0 deletions backend/internal/services/student_service.go
Original file line number Diff line number Diff line change
@@ -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)
}
25 changes: 25 additions & 0 deletions backend/internal/services/token_service.go
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 030e940

Please sign in to comment.