fx build fix
This commit is contained in:
21
api/notification/interface/api/api.go
Normal file
21
api/notification/interface/api/api.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/tech/sendico/notification/interface/api/localizer"
|
||||
"github.com/tech/sendico/pkg/db"
|
||||
"github.com/tech/sendico/pkg/domainprovider"
|
||||
"github.com/tech/sendico/pkg/messaging"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
)
|
||||
|
||||
type API interface {
|
||||
Config() *Config
|
||||
DBFactory() db.Factory
|
||||
Logger() mlogger.Logger
|
||||
Register() messaging.Register
|
||||
Localizer() localizer.Localizer
|
||||
DomainProvider() domainprovider.DomainProvider
|
||||
}
|
||||
|
||||
type MicroServiceFactoryT = func(API) (mservice.MicroService, error)
|
||||
13
api/notification/interface/api/config.go
Normal file
13
api/notification/interface/api/config.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
mwa "github.com/tech/sendico/notification/interface/middleware"
|
||||
amp "github.com/tech/sendico/notification/interface/services/amplitude/config"
|
||||
not "github.com/tech/sendico/notification/interface/services/notification/config"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Mw *mwa.Config `yaml:"middleware"`
|
||||
Notification *not.Config `yaml:"notification"`
|
||||
Amplitude *amp.Config `yaml:"amplitude"`
|
||||
}
|
||||
19
api/notification/interface/api/localizer/localizer.go
Normal file
19
api/notification/interface/api/localizer/localizer.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package localizer
|
||||
|
||||
import (
|
||||
lclrimp "github.com/tech/sendico/notification/internal/localizer"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
)
|
||||
|
||||
type Config = *lclrimp.Config
|
||||
|
||||
type Localizer interface {
|
||||
LocalizeTemplate(id string, templateData, ctr any, lang string) (string, error)
|
||||
LocalizeString(id, lang string) (string, error)
|
||||
ServiceName() string
|
||||
SupportMail() string
|
||||
}
|
||||
|
||||
func CreateLocalizer(logger mlogger.Logger, config *Config) (Localizer, error) {
|
||||
return lclrimp.CreateLocalizer(logger, *config)
|
||||
}
|
||||
12
api/notification/interface/middleware/middleware.go
Normal file
12
api/notification/interface/middleware/middleware.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
ai "github.com/tech/sendico/notification/internal/api/config"
|
||||
)
|
||||
|
||||
type (
|
||||
Config = ai.Config
|
||||
Signature = ai.SignatureConf
|
||||
)
|
||||
|
||||
type MapClaims = ai.MapClaims
|
||||
11
api/notification/interface/services/amplitude/amplitude.go
Normal file
11
api/notification/interface/services/amplitude/amplitude.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package amplitude
|
||||
|
||||
import (
|
||||
"github.com/tech/sendico/notification/interface/api"
|
||||
ampliimp "github.com/tech/sendico/notification/internal/server/amplitude"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
)
|
||||
|
||||
func Create(a api.API) (mservice.MicroService, error) {
|
||||
return ampliimp.CreateAPI(a)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package amplitude
|
||||
|
||||
type Config struct {
|
||||
Environment string `yaml:"ampli_environment_env"`
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package notificationimp
|
||||
|
||||
type Config struct {
|
||||
Driver string `yaml:"driver"`
|
||||
Settings map[string]any `yaml:"settings,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package notification
|
||||
|
||||
import (
|
||||
"github.com/tech/sendico/notification/interface/api"
|
||||
"github.com/tech/sendico/notification/internal/server/notificationimp"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
)
|
||||
|
||||
func Create(a api.API) (mservice.MicroService, error) {
|
||||
return notificationimp.CreateAPI(a)
|
||||
}
|
||||
Reference in New Issue
Block a user