summaryrefslogtreecommitdiff
path: root/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'service.go')
-rw-r--r--service.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/service.go b/service.go
new file mode 100644
index 0000000..6523d21
--- /dev/null
+++ b/service.go
@@ -0,0 +1,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)
+}