summaryrefslogtreecommitdiff
path: root/service.go
diff options
context:
space:
mode:
authoruvok cheetah2023-12-08 17:05:40 +0000
committeruvok cheetah2023-12-08 17:05:40 +0000
commite6d7e091b7b6dde1c736e7baf01fad5fd5c1ce27 (patch)
tree38a11d4df6a3661ba9eec8d0e7c7df0d9116a19d /service.go
Initial Commit
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)
+}