Fix kyc info and data and api handler
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -16,6 +16,6 @@ func ApiHandler(r *gin.RouterGroup) {
|
||||
kycHandler := &KycHandler{kycSvc}
|
||||
|
||||
r.Use(middleware.ApiVersionCheck(), middleware.JWTAuth(), middleware.Permission(10))
|
||||
r.POST("/kyc/session", kycHandler.Session)
|
||||
r.POST("/kyc/query", kycHandler.Query)
|
||||
r.POST("/session", kycHandler.Session)
|
||||
r.POST("/query", kycHandler.Query)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func Init(ctx context.Context) {
|
||||
}
|
||||
|
||||
// Auto migrate
|
||||
err = db.AutoMigrate(&User{}, &Event{}, &Attendance{}, &Client{})
|
||||
err = db.AutoMigrate(&User{}, &Event{}, &Attendance{}, &Client{}, &Kyc{})
|
||||
if err != nil {
|
||||
slog.ErrorContext(ctx, "[Database] Error migrating database!", "err", err)
|
||||
os.Exit(1)
|
||||
|
||||
@@ -152,11 +152,10 @@ func (self *KycServiceImpl) QueryKyc(payload *KycQueryPayload) (result *KycQuery
|
||||
}
|
||||
|
||||
var updates = map[string]any{
|
||||
"kyc_info": kycInfo,
|
||||
"kyc_info": encodedKycInfo,
|
||||
}
|
||||
|
||||
err = new(data.Kyc).
|
||||
SetKycInfo(*encodedKycInfo).
|
||||
UpdateByKycID(payload.Context, &kycId, updates)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
|
||||
@@ -142,12 +142,12 @@ func (self *KycServiceImpl) SessionKyc(payload *KycSessionPayload) (result *KycS
|
||||
SetEndpoint(exception.EndpointKycServiceSession).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.KycSessionFailed).
|
||||
SetError(err).
|
||||
SetError(nil).
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &KycSessionResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 500,
|
||||
HttpCode: 400,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
|
||||
Reference in New Issue
Block a user