added validation; DB is global now
This commit is contained in:
@@ -1,25 +1,22 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"GoMembership/internal/models"
|
||||
"GoMembership/internal/repositories"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ConsentService interface {
|
||||
type ConsentServiceInterface interface {
|
||||
RegisterConsent(consent *models.Consent) (int64, error)
|
||||
}
|
||||
|
||||
type consentService struct {
|
||||
repo repositories.ConsentRepository
|
||||
type ConsentService struct {
|
||||
Repo repositories.ConsentRepositoryInterface
|
||||
}
|
||||
|
||||
func NewConsentService(repo repositories.ConsentRepository) ConsentService {
|
||||
return &consentService{repo}
|
||||
}
|
||||
|
||||
func (service *consentService) RegisterConsent(consent *models.Consent) (int64, error) {
|
||||
func (service *ConsentService) RegisterConsent(consent *models.Consent) (int64, error) {
|
||||
consent.CreatedAt = time.Now()
|
||||
consent.UpdatedAt = time.Now()
|
||||
return service.repo.CreateConsent(consent)
|
||||
return service.Repo.CreateConsent(consent)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user