add password reset model ; create entry in database; send email
This commit is contained in:
41
domain/service/passwordreset.go
Normal file
41
domain/service/passwordreset.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"bitbucket.org/nemt/nemt-portal-api/domain/entity"
|
||||
)
|
||||
|
||||
// userService is the domain service for user operations
|
||||
type passwordResetService struct {
|
||||
svc *Service
|
||||
}
|
||||
|
||||
// newUserService returns an instance of userService
|
||||
func newPasswordResetService(svc *Service) *passwordResetService {
|
||||
return &passwordResetService{
|
||||
svc: svc,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *passwordResetService) GetAll() ([]entity.PasswordReset, error) {
|
||||
return s.svc.db.PasswordReset().GetAll()
|
||||
}
|
||||
|
||||
func (s *passwordResetService) GetByID(ID int64) (entity.PasswordReset, error) {
|
||||
return s.svc.db.PasswordReset().GetByID(ID)
|
||||
}
|
||||
|
||||
func (s *passwordResetService) GetByToken(token string) (entity.PasswordReset, error) {
|
||||
return s.svc.db.PasswordReset().GetByToken(token)
|
||||
}
|
||||
|
||||
func (s *passwordResetService) CreatePasswordResetEntry(passwordResetEntry entity.PasswordReset) (entity.PasswordReset, error) {
|
||||
return s.svc.db.PasswordReset().CreatePasswordResetEntry(passwordResetEntry)
|
||||
}
|
||||
|
||||
func (s *passwordResetService) SetTokenOpened(token string) error {
|
||||
return s.svc.db.PasswordReset().SetTokenOpened(token)
|
||||
}
|
||||
|
||||
func (s *passwordResetService) SetTokenUsed(token string) error {
|
||||
return s.svc.db.PasswordReset().SetTokenUsed(token)
|
||||
}
|
||||
Reference in New Issue
Block a user