From 3e574be3c45b17f4f9a2abd690ce3313534dc06a Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Wed, 22 Dec 2021 00:00:23 +0800 Subject: [PATCH] update --- calendar/service.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/calendar/service.go b/calendar/service.go index a81b00f..ac3e559 100644 --- a/calendar/service.go +++ b/calendar/service.go @@ -1,12 +1,28 @@ package calendar +import ( + "kumoly.io/kumoly/app/store" + "kumoly.io/kumoly/app/util" +) + type Service struct{} func (srv Service) GetName() string { return "calendar.Service" } -func (srv Service) GetDependencies() []string { return []string{} } +func (srv Service) GetDependencies() []string { return []string{"server.Service"} } func (srv Service) IsService() bool { return false } -func (srv Service) Init() error { return nil } -func (srv Service) Load() error { return nil } func (srv Service) Main() error { return nil } func (srv Service) Del() {} func (srv Service) Health() error { return nil } + +func (srv Service) Init() error { + + l = util.Klog.With().Str("mod", "auth").Logger() + l.Debug().Msg("Migrating database for calendar.Service ...") + if err := store.Migrate(&Calendar{}, &EventGroup{}, &Event{}); err != nil { + l.Error().Err(err).Msg("Migrating database") + return err + } + return nil +} + +func (srv Service) Load() error { return nil }