Fix kyc info and data and api handler
All checks were successful
Client CMS Check Build (NixCN CMS) TeamCity build finished
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-02-01 13:58:12 +08:00
parent 0ac96ab3e6
commit 8f1d5280f7
4 changed files with 6 additions and 7 deletions

View File

@@ -16,6 +16,6 @@ func ApiHandler(r *gin.RouterGroup) {
kycHandler := &KycHandler{kycSvc} kycHandler := &KycHandler{kycSvc}
r.Use(middleware.ApiVersionCheck(), middleware.JWTAuth(), middleware.Permission(10)) r.Use(middleware.ApiVersionCheck(), middleware.JWTAuth(), middleware.Permission(10))
r.POST("/kyc/session", kycHandler.Session) r.POST("/session", kycHandler.Session)
r.POST("/kyc/query", kycHandler.Query) r.POST("/query", kycHandler.Query)
} }

View File

@@ -38,7 +38,7 @@ func Init(ctx context.Context) {
} }
// Auto migrate // Auto migrate
err = db.AutoMigrate(&User{}, &Event{}, &Attendance{}, &Client{}) err = db.AutoMigrate(&User{}, &Event{}, &Attendance{}, &Client{}, &Kyc{})
if err != nil { if err != nil {
slog.ErrorContext(ctx, "[Database] Error migrating database!", "err", err) slog.ErrorContext(ctx, "[Database] Error migrating database!", "err", err)
os.Exit(1) os.Exit(1)

View File

@@ -152,11 +152,10 @@ func (self *KycServiceImpl) QueryKyc(payload *KycQueryPayload) (result *KycQuery
} }
var updates = map[string]any{ var updates = map[string]any{
"kyc_info": kycInfo, "kyc_info": encodedKycInfo,
} }
err = new(data.Kyc). err = new(data.Kyc).
SetKycInfo(*encodedKycInfo).
UpdateByKycID(payload.Context, &kycId, updates) UpdateByKycID(payload.Context, &kycId, updates)
if err != nil { if err != nil {
exception := new(exception.Builder). exception := new(exception.Builder).

View File

@@ -142,12 +142,12 @@ func (self *KycServiceImpl) SessionKyc(payload *KycSessionPayload) (result *KycS
SetEndpoint(exception.EndpointKycServiceSession). SetEndpoint(exception.EndpointKycServiceSession).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).
SetOriginal(exception.KycSessionFailed). SetOriginal(exception.KycSessionFailed).
SetError(err). SetError(nil).
Throw(payload.Context) Throw(payload.Context)
result = &KycSessionResult{ result = &KycSessionResult{
Common: shared.CommonResult{ Common: shared.CommonResult{
HttpCode: 500, HttpCode: 400,
Exception: exception, Exception: exception,
}, },
Data: nil, Data: nil,