22 lines
442 B
Go
22 lines
442 B
Go
package repositories
|
|
|
|
import (
|
|
"GoMembership/internal/database"
|
|
"GoMembership/internal/models"
|
|
)
|
|
|
|
type ConsentRepositoryInterface interface {
|
|
CreateConsent(consent *models.Consent) (int64, error)
|
|
}
|
|
|
|
type ConsentRepository struct{}
|
|
|
|
func (repo *ConsentRepository) CreateConsent(consent *models.Consent) (int64, error) {
|
|
result := database.DB.Create(consent)
|
|
|
|
if result.Error != nil {
|
|
return 0, result.Error
|
|
}
|
|
return consent.ID, nil
|
|
}
|