67 lines
2.4 KiB
Go
67 lines
2.4 KiB
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
|
|
v1 "likedream-goframe/internal/api/v1"
|
|
"likedream-goframe/internal/ent"
|
|
"likedream-goframe/internal/service"
|
|
"likedream-goframe/internal/utils"
|
|
)
|
|
|
|
type ConfigCtrlV1 struct{}
|
|
|
|
func (c ConfigCtrlV1) Get(ctx context.Context, req *v1.ConfigGetReq) (res *utils.Response[*ent.SysConfig], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.Get(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) PublicGet(ctx context.Context, req *v1.ConfigPublicGetReq) (res *utils.Response[*ent.SysConfig], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.PublicGet(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) List(ctx context.Context, req *v1.ConfigListReq) (res *utils.Response[[]*ent.SysConfig], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.List(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) Update(ctx context.Context, req *v1.ConfigUpdateReq) (res *utils.Response[any], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.Update(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) GetPriceConfig(ctx context.Context, req *v1.PriceConfigGetReq) (res *utils.Response[*v1.PriceConfigResp], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.GetPriceConfig(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) UpdatePriceConfig(ctx context.Context, req *v1.PriceConfigUpdateReq) (res *utils.Response[any], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.UpdatePriceConfig(ctx, req), nil
|
|
}
|
|
|
|
func NewConfigCtrlV1() IConfigCtrlV1 {
|
|
return &ConfigCtrlV1{}
|
|
}
|
|
|
|
func (c ConfigCtrlV1) GetSmtpConfig(ctx context.Context, req *v1.SmtpConfigGetReq) (res *utils.Response[any], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.GetSmtpConfig(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) UpdateSmtpConfig(ctx context.Context, req *v1.SmtpConfigUpdateReq) (res *utils.Response[any], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.UpdateSmtpConfig(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) TestSmtp(ctx context.Context, req *v1.SmtpTestReq) (res *utils.Response[any], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.TestSmtp(ctx, req), nil
|
|
}
|
|
|
|
func (c ConfigCtrlV1) GetOutlookOAuthAuthorizeURL(ctx context.Context, req *v1.OutlookOAuthAuthorizeURLReq) (res *utils.Response[*v1.OutlookOAuthAuthorizeURLResp], err error) {
|
|
defer utils.Pass(&err)
|
|
return service.Global.Config.GetOutlookOAuthAuthorizeURL(ctx, req), nil
|
|
}
|