summaryrefslogtreecommitdiff
path: root/service.go
blob: 6523d216eb8c09b6d834c6e88cf711271503cafb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package registration

type RegistrationService struct {
	Notifier   RegistrationNotifier
	Repository RegistrationRepository
}

func (service *RegistrationService) HandleNewRegistration(reg *Registration) error {
	return service.Repository.SaveRegistration(reg)
}

func (service *RegistrationService) GetUnconfirmedRegistrations() ([]*Registration, error) {
	return service.Repository.GetUnconfirmedRegistrations()
}

func (service *RegistrationService) ConfirmRegistration(registrationId string) error {
	registration, err := service.Repository.ConfirmRegistration(registrationId)
	if err != nil {
		return err
	}
	return service.Notifier.NotifyNewRegistration(registration)
}