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}
|
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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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).
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user