From e6d7e091b7b6dde1c736e7baf01fad5fd5c1ce27 Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Fri, 8 Dec 2023 17:05:40 +0000 Subject: Initial Commit --- service.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 service.go (limited to 'service.go') 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) +} -- cgit v1.2.3