add: some user api and all api desc
This commit is contained in:
@@ -2,6 +2,9 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/schema"
|
||||
|
||||
"juwan-backend/app/user_verifications/rpc/internal/svc"
|
||||
"juwan-backend/app/user_verifications/rpc/pb"
|
||||
@@ -24,7 +27,31 @@ func NewUpdateUserVerificationsLogic(ctx context.Context, svcCtx *svc.ServiceCon
|
||||
}
|
||||
|
||||
func (l *UpdateUserVerificationsLogic) UpdateUserVerifications(in *pb.UpdateUserVerificationsReq) (*pb.UpdateUserVerificationsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var materials *schema.MaterialStruct
|
||||
materials = nil
|
||||
if in.Materials != nil {
|
||||
err := json.Unmarshal([]byte(*in.Materials), &materials)
|
||||
if err != nil {
|
||||
logx.Errorf("Unmarshal materials failed, err:%v.", err)
|
||||
return nil, errors.New("bad input materials")
|
||||
}
|
||||
if len(materials.GameScreenshots) > 20 {
|
||||
logx.Errorf("User %v upload oo many game screenshots: %d", in.UserId, len(materials.GameScreenshots))
|
||||
return nil, errors.New("too many game screenshots")
|
||||
}
|
||||
}
|
||||
|
||||
_, err := l.svcCtx.UserVeriModelRW.UpdateOneID(in.Id).
|
||||
SetNillableRejectReason(in.RejectReason).
|
||||
SetNillableMaterials(materials).
|
||||
SetNillableRole(in.Role).
|
||||
SetNillableStatus(in.Status).
|
||||
SetReviewedBy(in.ReviewedBy).
|
||||
Save(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("save user verifications failed, err:%v.", err)
|
||||
return nil, errors.New("save user verifications failed")
|
||||
}
|
||||
|
||||
return &pb.UpdateUserVerificationsResp{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user