added validation; DB is global now

This commit is contained in:
$(pass /github/name)
2024-07-11 20:59:52 +02:00
parent e4475e2400
commit 03a2b3bdc5
22 changed files with 287 additions and 218 deletions

View File

@@ -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)
}