chore: implement memo route

This commit is contained in:
Steven
2023-12-15 07:32:49 +08:00
parent 6cf7192d6a
commit 52743017a3
3 changed files with 58 additions and 10 deletions

View File

@ -33,9 +33,6 @@ type Server struct {
Profile *profile.Profile
Store *store.Store
// API services.
apiV2Service *apiv2.APIV2Service
// Asynchronous runners.
backupRunner *backup.BackupRunner
telegramBot *telegram.Bot
@ -84,7 +81,8 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
s.ID = serverID
// Serve frontend.
frontend.Serve(e)
frontendService := frontend.NewFrontendService(profile, store)
frontendService.Serve(e)
// Serve swagger in dev/demo mode.
if profile.Mode == "dev" || profile.Mode == "demo" {
@ -110,9 +108,9 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
apiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store, s.telegramBot)
apiV1Service.Register(rootGroup)
s.apiV2Service = apiv2.NewAPIV2Service(s.Secret, profile, store, s.Profile.Port+1)
apiV2Service := apiv2.NewAPIV2Service(s.Secret, profile, store, s.Profile.Port+1)
// Register gRPC gateway as api v2.
if err := s.apiV2Service.RegisterGateway(ctx, e); err != nil {
if err := apiV2Service.RegisterGateway(ctx, e); err != nil {
return nil, errors.Wrap(err, "failed to register gRPC gateway")
}