fix: some api bug
This commit is contained in:
@@ -1,28 +1,45 @@
|
||||
Name: pb.rpc
|
||||
ListenOn: 0.0.0.0:8080
|
||||
|
||||
DataSource: "${DB_URI}?sslmode=disable"
|
||||
|
||||
UserVeriRpcConf :
|
||||
Target: k8s://juwan/user_verifications-rpc-svc.juwan:8080
|
||||
# ===== PROC Config =====
|
||||
#SnowflakeRpcConf:
|
||||
# Target: k8s://juwan/snowflake-svc.juwan:8080
|
||||
#UserRpcConf:
|
||||
# Target: k8s://juwan/user-rpc-svc.juwan:8080
|
||||
#
|
||||
#DB:
|
||||
# Master: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@user-db-rw.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
# Slave: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@user-db-ro.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
#
|
||||
#CacheConf:
|
||||
# - Host: "${REDIS_M_HOST}"
|
||||
# Type: node
|
||||
# Pass: "${REDIS_PASSWORD}"
|
||||
# User: "default"
|
||||
# - Host: "${REDIS_S_HOST}"
|
||||
# Type: node
|
||||
# Pass: "${REDIS_PASSWORD}"
|
||||
# User: "default"
|
||||
#
|
||||
#Log:
|
||||
# Level: info
|
||||
|
||||
# ===== DEV Config =====
|
||||
SnowflakeRpcConf:
|
||||
Target: k8s://juwan/snowflake-svc.juwan:8080
|
||||
|
||||
Endpoints:
|
||||
- snowflake:8080
|
||||
UserRpcConf:
|
||||
Endpoints:
|
||||
- user-rpc:8080
|
||||
|
||||
DB:
|
||||
Master: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@user-db-rw.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
Slave: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@user-db-ro.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
Master: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@postgres:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
Slave: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@postgres:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
|
||||
CacheConf:
|
||||
- Host: "${REDIS_M_HOST}"
|
||||
- Host: "${REDIS_HOST}:${REDIS_PORT}"
|
||||
Type: node
|
||||
Pass: "${REDIS_PASSWORD}"
|
||||
User: "default"
|
||||
- Host: "${REDIS_S_HOST}"
|
||||
Type: node
|
||||
Pass: "${REDIS_PASSWORD}"
|
||||
User: "default"
|
||||
|
||||
Log:
|
||||
Level: info
|
||||
Level: debug
|
||||
|
||||
@@ -12,6 +12,6 @@ type Config struct {
|
||||
Slave string
|
||||
}
|
||||
CacheConf cache.CacheConf
|
||||
UserVeriRpcConf zrpc.RpcClientConf
|
||||
SnowflakeRpcConf zrpc.RpcClientConf
|
||||
UserRpcConf zrpc.RpcClientConf
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"juwan-backend/app/snowflake/rpc/snowflake"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/schema"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/userverifications"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/svc"
|
||||
"juwan-backend/app/user_verifications/rpc/pb"
|
||||
"juwan-backend/app/users/rpc/usercenter"
|
||||
"slices"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AddOrUpdateUserVerificationsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewAddOrUpdateUserVerificationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddOrUpdateUserVerificationsLogic {
|
||||
return &AddOrUpdateUserVerificationsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AddOrUpdateUserVerificationsLogic) AddOrUpdateUserVerifications(in *pb.AddOrUpdateUserVerificationsReq) (*pb.AddOrUpdateUserVerificationsResp, error) {
|
||||
NotFoundError := &models.NotFoundError{}
|
||||
var materials schema.MaterialStruct
|
||||
|
||||
uv, vErr := l.svcCtx.UserVeriModelRO.Query().
|
||||
Where(
|
||||
userverifications.UserIDEQ(in.UserId),
|
||||
userverifications.RoleEQ(in.Role),
|
||||
userverifications.StatusNEQ("rejected"),
|
||||
).
|
||||
First(l.ctx)
|
||||
if vErr != nil && !errors.As(vErr, &NotFoundError) {
|
||||
logx.Errorf("add or update user verifications: get user err:%v", vErr)
|
||||
return nil, errors.New("")
|
||||
}
|
||||
|
||||
isRole, err := l.checkIsRole(in.UserId, in.Role)
|
||||
|
||||
if err != nil {
|
||||
logx.Errorf("add or update user verifications: check user err:%v", err)
|
||||
return nil, errors.New("check user role failed")
|
||||
}
|
||||
if isRole {
|
||||
return nil, errors.New("user already has the role")
|
||||
}
|
||||
|
||||
jsonErr := json.Unmarshal([]byte(in.Material), &materials)
|
||||
if jsonErr != nil {
|
||||
logx.Errorf("add or update user verifications: marshal materials err:%v", jsonErr)
|
||||
return nil, errors.New("invalid materials")
|
||||
}
|
||||
|
||||
idResp, rpcErr := l.svcCtx.SnowflakeRpc.NextId(l.ctx, &snowflake.NextIdReq{})
|
||||
if errors.As(vErr, &NotFoundError) {
|
||||
if rpcErr != nil {
|
||||
logx.Errorf("add or update user verifications: get next id err:%v", rpcErr)
|
||||
return nil, errors.New("generate id failed: ")
|
||||
}
|
||||
|
||||
uv, err = l.svcCtx.UserVeriModelRW.Create().
|
||||
SetID(idResp.Id).
|
||||
SetUserID(in.UserId).
|
||||
SetRole(in.Role).
|
||||
SetMaterials(materials).
|
||||
SetRejectReason("").
|
||||
SetReviewedBy(0).
|
||||
Save(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("add or update user verifications: create user verifications err:%v", err)
|
||||
return nil, errors.New("create user verifications failed")
|
||||
}
|
||||
} else {
|
||||
uv, err = uv.Update().
|
||||
SetRole(in.Role).
|
||||
SetMaterials(materials).
|
||||
Save(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("add or update user verifications: update user verifications err:%v", err)
|
||||
return nil, errors.New("update user verifications failed")
|
||||
}
|
||||
}
|
||||
|
||||
return &pb.AddOrUpdateUserVerificationsResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (l *AddOrUpdateUserVerificationsLogic) checkIsRole(userid int64, role string) (bool, error) {
|
||||
user, err := l.svcCtx.UserRpc.GetUsersById(l.ctx, &usercenter.GetUsersByIdReq{
|
||||
Id: userid,
|
||||
})
|
||||
logx.Debug("checkIsRole user:", user)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
logx.Debug("checkIsRole user verified roles:", user.Users.VerifiedRoles)
|
||||
if slices.Contains(user.Users.VerifiedRoles, role) {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/userverifications"
|
||||
|
||||
"juwan-backend/app/user_verifications/rpc/internal/svc"
|
||||
"juwan-backend/app/user_verifications/rpc/pb"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListUserVerificationsByUserIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListUserVerificationsByUserIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListUserVerificationsByUserIdLogic {
|
||||
return &ListUserVerificationsByUserIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListUserVerificationsByUserIdLogic) ListUserVerificationsByUserId(in *pb.ListUserVerificationsByUserIdReq) (*pb.ListUserVerificationsByUserIdResp, error) {
|
||||
all, err := l.svcCtx.UserVeriModelRO.Query().
|
||||
Where(userverifications.UserIDEQ(in.UserId)).
|
||||
All(l.ctx)
|
||||
|
||||
if err != nil {
|
||||
logx.Errorf("ListUserVerificationsByUserId err: %v", err)
|
||||
return nil, errors.New("list user verifications by user id err")
|
||||
}
|
||||
|
||||
list := make([]*pb.UserVerifications, 0, len(all))
|
||||
for _, v := range all {
|
||||
var temp pb.UserVerifications
|
||||
err = copier.Copy(&temp, v)
|
||||
if err != nil {
|
||||
logx.Errorf("copy user verifications err: %v", err)
|
||||
continue
|
||||
}
|
||||
temp.CreatedAt = v.CreatedAt.Unix()
|
||||
temp.UpdatedAt = v.UpdatedAt.Unix()
|
||||
if v.ReviewedAt != nil {
|
||||
temp.ReviewedAt = v.ReviewedAt.Unix()
|
||||
}
|
||||
list = append(list, &temp)
|
||||
}
|
||||
|
||||
return &pb.ListUserVerificationsByUserIdResp{
|
||||
UserVerifications: list,
|
||||
}, nil
|
||||
}
|
||||
@@ -31,11 +31,7 @@ func (l *SearchUserVerificationsLogic) SearchUserVerifications(in *pb.SearchUser
|
||||
logx.Errorf("Limit exceeds max limit: %d", in.Limit)
|
||||
return nil, errors.New("limit exceeds max limit")
|
||||
}
|
||||
verifications, err := l.svcCtx.UserVeriModelRO.Query().Where(userverifications.Or(
|
||||
userverifications.UserIDEQ(in.UserId),
|
||||
userverifications.StatusEQ(in.Status),
|
||||
userverifications.Role(in.Role),
|
||||
)).
|
||||
verifications, err := l.svcCtx.UserVeriModelRO.Query().Where(userverifications.UserIDEQ(in.UserId)).
|
||||
Offset(int(in.Page * in.Limit)).
|
||||
Limit(int(in.Limit)).
|
||||
All(l.ctx)
|
||||
|
||||
@@ -12,14 +12,14 @@ var (
|
||||
UserVerificationsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "user_id", Type: field.TypeInt64, Unique: true},
|
||||
{Name: "role", Type: field.TypeString, Unique: true},
|
||||
{Name: "role", Type: field.TypeString},
|
||||
{Name: "status", Type: field.TypeString, Default: "pending"},
|
||||
{Name: "materials", Type: field.TypeJSON},
|
||||
{Name: "reject_reason", Type: field.TypeString, Default: ""},
|
||||
{Name: "reviewed_by", Type: field.TypeInt64},
|
||||
{Name: "reviewed_at", Type: field.TypeTime},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "reject_reason", Type: field.TypeString, Nullable: true},
|
||||
{Name: "reviewed_by", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "reviewed_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
}
|
||||
// UserVerificationsTable holds the schema information for the "user_verifications" table.
|
||||
UserVerificationsTable = &schema.Table{
|
||||
|
||||
@@ -336,7 +336,7 @@ func (m *UserVerificationsMutation) RejectReason() (r string, exists bool) {
|
||||
// OldRejectReason returns the old "reject_reason" field's value of the UserVerifications entity.
|
||||
// If the UserVerifications object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *UserVerificationsMutation) OldRejectReason(ctx context.Context) (v string, err error) {
|
||||
func (m *UserVerificationsMutation) OldRejectReason(ctx context.Context) (v *string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldRejectReason is only allowed on UpdateOne operations")
|
||||
}
|
||||
@@ -350,9 +350,22 @@ func (m *UserVerificationsMutation) OldRejectReason(ctx context.Context) (v stri
|
||||
return oldValue.RejectReason, nil
|
||||
}
|
||||
|
||||
// ClearRejectReason clears the value of the "reject_reason" field.
|
||||
func (m *UserVerificationsMutation) ClearRejectReason() {
|
||||
m.reject_reason = nil
|
||||
m.clearedFields[userverifications.FieldRejectReason] = struct{}{}
|
||||
}
|
||||
|
||||
// RejectReasonCleared returns if the "reject_reason" field was cleared in this mutation.
|
||||
func (m *UserVerificationsMutation) RejectReasonCleared() bool {
|
||||
_, ok := m.clearedFields[userverifications.FieldRejectReason]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetRejectReason resets all changes to the "reject_reason" field.
|
||||
func (m *UserVerificationsMutation) ResetRejectReason() {
|
||||
m.reject_reason = nil
|
||||
delete(m.clearedFields, userverifications.FieldRejectReason)
|
||||
}
|
||||
|
||||
// SetReviewedBy sets the "reviewed_by" field.
|
||||
@@ -373,7 +386,7 @@ func (m *UserVerificationsMutation) ReviewedBy() (r int64, exists bool) {
|
||||
// OldReviewedBy returns the old "reviewed_by" field's value of the UserVerifications entity.
|
||||
// If the UserVerifications object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *UserVerificationsMutation) OldReviewedBy(ctx context.Context) (v int64, err error) {
|
||||
func (m *UserVerificationsMutation) OldReviewedBy(ctx context.Context) (v *int64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldReviewedBy is only allowed on UpdateOne operations")
|
||||
}
|
||||
@@ -405,10 +418,24 @@ func (m *UserVerificationsMutation) AddedReviewedBy() (r int64, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearReviewedBy clears the value of the "reviewed_by" field.
|
||||
func (m *UserVerificationsMutation) ClearReviewedBy() {
|
||||
m.reviewed_by = nil
|
||||
m.addreviewed_by = nil
|
||||
m.clearedFields[userverifications.FieldReviewedBy] = struct{}{}
|
||||
}
|
||||
|
||||
// ReviewedByCleared returns if the "reviewed_by" field was cleared in this mutation.
|
||||
func (m *UserVerificationsMutation) ReviewedByCleared() bool {
|
||||
_, ok := m.clearedFields[userverifications.FieldReviewedBy]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetReviewedBy resets all changes to the "reviewed_by" field.
|
||||
func (m *UserVerificationsMutation) ResetReviewedBy() {
|
||||
m.reviewed_by = nil
|
||||
m.addreviewed_by = nil
|
||||
delete(m.clearedFields, userverifications.FieldReviewedBy)
|
||||
}
|
||||
|
||||
// SetReviewedAt sets the "reviewed_at" field.
|
||||
@@ -428,7 +455,7 @@ func (m *UserVerificationsMutation) ReviewedAt() (r time.Time, exists bool) {
|
||||
// OldReviewedAt returns the old "reviewed_at" field's value of the UserVerifications entity.
|
||||
// If the UserVerifications object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *UserVerificationsMutation) OldReviewedAt(ctx context.Context) (v time.Time, err error) {
|
||||
func (m *UserVerificationsMutation) OldReviewedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldReviewedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
@@ -442,9 +469,22 @@ func (m *UserVerificationsMutation) OldReviewedAt(ctx context.Context) (v time.T
|
||||
return oldValue.ReviewedAt, nil
|
||||
}
|
||||
|
||||
// ClearReviewedAt clears the value of the "reviewed_at" field.
|
||||
func (m *UserVerificationsMutation) ClearReviewedAt() {
|
||||
m.reviewed_at = nil
|
||||
m.clearedFields[userverifications.FieldReviewedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// ReviewedAtCleared returns if the "reviewed_at" field was cleared in this mutation.
|
||||
func (m *UserVerificationsMutation) ReviewedAtCleared() bool {
|
||||
_, ok := m.clearedFields[userverifications.FieldReviewedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetReviewedAt resets all changes to the "reviewed_at" field.
|
||||
func (m *UserVerificationsMutation) ResetReviewedAt() {
|
||||
m.reviewed_at = nil
|
||||
delete(m.clearedFields, userverifications.FieldReviewedAt)
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
@@ -478,9 +518,22 @@ func (m *UserVerificationsMutation) OldCreatedAt(ctx context.Context) (v time.Ti
|
||||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *UserVerificationsMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[userverifications.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *UserVerificationsMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[userverifications.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *UserVerificationsMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, userverifications.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
@@ -514,9 +567,22 @@ func (m *UserVerificationsMutation) OldUpdatedAt(ctx context.Context) (v time.Ti
|
||||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *UserVerificationsMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[userverifications.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *UserVerificationsMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[userverifications.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *UserVerificationsMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, userverifications.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the UserVerificationsMutation builder.
|
||||
@@ -762,7 +828,23 @@ func (m *UserVerificationsMutation) AddField(name string, value ent.Value) error
|
||||
// ClearedFields returns all nullable fields that were cleared during this
|
||||
// mutation.
|
||||
func (m *UserVerificationsMutation) ClearedFields() []string {
|
||||
return nil
|
||||
var fields []string
|
||||
if m.FieldCleared(userverifications.FieldRejectReason) {
|
||||
fields = append(fields, userverifications.FieldRejectReason)
|
||||
}
|
||||
if m.FieldCleared(userverifications.FieldReviewedBy) {
|
||||
fields = append(fields, userverifications.FieldReviewedBy)
|
||||
}
|
||||
if m.FieldCleared(userverifications.FieldReviewedAt) {
|
||||
fields = append(fields, userverifications.FieldReviewedAt)
|
||||
}
|
||||
if m.FieldCleared(userverifications.FieldCreatedAt) {
|
||||
fields = append(fields, userverifications.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(userverifications.FieldUpdatedAt) {
|
||||
fields = append(fields, userverifications.FieldUpdatedAt)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// FieldCleared returns a boolean indicating if a field with the given name was
|
||||
@@ -775,6 +857,23 @@ func (m *UserVerificationsMutation) FieldCleared(name string) bool {
|
||||
// ClearField clears the value of the field with the given name. It returns an
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *UserVerificationsMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case userverifications.FieldRejectReason:
|
||||
m.ClearRejectReason()
|
||||
return nil
|
||||
case userverifications.FieldReviewedBy:
|
||||
m.ClearReviewedBy()
|
||||
return nil
|
||||
case userverifications.FieldReviewedAt:
|
||||
m.ClearReviewedAt()
|
||||
return nil
|
||||
case userverifications.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case userverifications.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserVerifications nullable field %s", name)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ package models
|
||||
import (
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/schema"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/userverifications"
|
||||
"time"
|
||||
)
|
||||
|
||||
// The init function reads all schema descriptors with runtime code
|
||||
@@ -17,8 +18,12 @@ func init() {
|
||||
userverificationsDescStatus := userverificationsFields[3].Descriptor()
|
||||
// userverifications.DefaultStatus holds the default value on creation for the status field.
|
||||
userverifications.DefaultStatus = userverificationsDescStatus.Default.(string)
|
||||
// userverificationsDescRejectReason is the schema descriptor for reject_reason field.
|
||||
userverificationsDescRejectReason := userverificationsFields[5].Descriptor()
|
||||
// userverifications.DefaultRejectReason holds the default value on creation for the reject_reason field.
|
||||
userverifications.DefaultRejectReason = userverificationsDescRejectReason.Default.(string)
|
||||
// userverificationsDescCreatedAt is the schema descriptor for created_at field.
|
||||
userverificationsDescCreatedAt := userverificationsFields[8].Descriptor()
|
||||
// userverifications.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
userverifications.DefaultCreatedAt = userverificationsDescCreatedAt.Default.(func() time.Time)
|
||||
// userverificationsDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
userverificationsDescUpdatedAt := userverificationsFields[9].Descriptor()
|
||||
// userverifications.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
userverifications.DefaultUpdatedAt = userverificationsDescUpdatedAt.Default.(func() time.Time)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
@@ -13,8 +15,8 @@ type UserVerifications struct {
|
||||
type MaterialStruct struct {
|
||||
IdCardFront string `json:"idCardFront"`
|
||||
IdCardBack string `json:"idCardBack"`
|
||||
GameScreenshots []string `json:"gameScreenshots"`
|
||||
VoiceDemo string `json:"voiceDemo"`
|
||||
GameScreenshots []string `json:"gameScreenshots,omitempty"`
|
||||
VoiceDemo string `json:"voiceDemo,omitempty"`
|
||||
}
|
||||
|
||||
// Fields of the UserVerifications.
|
||||
@@ -22,14 +24,14 @@ func (UserVerifications) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.Int64("user_id").Immutable().Unique(),
|
||||
field.String("role").Unique(),
|
||||
field.String("role"),
|
||||
field.String("status").Default("pending"),
|
||||
field.JSON("materials", MaterialStruct{}),
|
||||
field.String("reject_reason").Default(""),
|
||||
field.Int64("reviewed_by"),
|
||||
field.Time("reviewed_at").Immutable(),
|
||||
field.Time("created_at").Immutable(),
|
||||
field.Time("updated_at").Immutable(),
|
||||
field.String("reject_reason").Nillable().Optional(),
|
||||
field.Int64("reviewed_by").Nillable().Optional(),
|
||||
field.Time("reviewed_at").Nillable().Optional(),
|
||||
field.Time("created_at").Immutable().Optional().Default(time.Now),
|
||||
field.Time("updated_at").Immutable().Optional().Default(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// UserVerifications is the models entity for the UserVerifications schema.
|
||||
// UserVerifications is the model entity for the UserVerifications schema.
|
||||
type UserVerifications struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
@@ -28,11 +28,11 @@ type UserVerifications struct {
|
||||
// Materials holds the value of the "materials" field.
|
||||
Materials schema.MaterialStruct `json:"materials,omitempty"`
|
||||
// RejectReason holds the value of the "reject_reason" field.
|
||||
RejectReason string `json:"reject_reason,omitempty"`
|
||||
RejectReason *string `json:"reject_reason,omitempty"`
|
||||
// ReviewedBy holds the value of the "reviewed_by" field.
|
||||
ReviewedBy int64 `json:"reviewed_by,omitempty"`
|
||||
ReviewedBy *int64 `json:"reviewed_by,omitempty"`
|
||||
// ReviewedAt holds the value of the "reviewed_at" field.
|
||||
ReviewedAt time.Time `json:"reviewed_at,omitempty"`
|
||||
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
@@ -104,19 +104,22 @@ func (_m *UserVerifications) assignValues(columns []string, values []any) error
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field reject_reason", values[i])
|
||||
} else if value.Valid {
|
||||
_m.RejectReason = value.String
|
||||
_m.RejectReason = new(string)
|
||||
*_m.RejectReason = value.String
|
||||
}
|
||||
case userverifications.FieldReviewedBy:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field reviewed_by", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ReviewedBy = value.Int64
|
||||
_m.ReviewedBy = new(int64)
|
||||
*_m.ReviewedBy = value.Int64
|
||||
}
|
||||
case userverifications.FieldReviewedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field reviewed_at", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ReviewedAt = value.Time
|
||||
_m.ReviewedAt = new(time.Time)
|
||||
*_m.ReviewedAt = value.Time
|
||||
}
|
||||
case userverifications.FieldCreatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
@@ -178,14 +181,20 @@ func (_m *UserVerifications) String() string {
|
||||
builder.WriteString("materials=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Materials))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("reject_reason=")
|
||||
builder.WriteString(_m.RejectReason)
|
||||
if v := _m.RejectReason; v != nil {
|
||||
builder.WriteString("reject_reason=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("reviewed_by=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.ReviewedBy))
|
||||
if v := _m.ReviewedBy; v != nil {
|
||||
builder.WriteString("reviewed_by=")
|
||||
builder.WriteString(fmt.Sprintf("%v", *v))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("reviewed_at=")
|
||||
builder.WriteString(_m.ReviewedAt.Format(time.ANSIC))
|
||||
if v := _m.ReviewedAt; v != nil {
|
||||
builder.WriteString("reviewed_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
package userverifications
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@@ -60,8 +62,10 @@ func ValidColumn(column string) bool {
|
||||
var (
|
||||
// DefaultStatus holds the default value on creation for the "status" field.
|
||||
DefaultStatus string
|
||||
// DefaultRejectReason holds the default value on creation for the "reject_reason" field.
|
||||
DefaultRejectReason string
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the UserVerifications queries.
|
||||
|
||||
@@ -319,6 +319,16 @@ func RejectReasonHasSuffix(v string) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldHasSuffix(FieldRejectReason, v))
|
||||
}
|
||||
|
||||
// RejectReasonIsNil applies the IsNil predicate on the "reject_reason" field.
|
||||
func RejectReasonIsNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldIsNull(FieldRejectReason))
|
||||
}
|
||||
|
||||
// RejectReasonNotNil applies the NotNil predicate on the "reject_reason" field.
|
||||
func RejectReasonNotNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldNotNull(FieldRejectReason))
|
||||
}
|
||||
|
||||
// RejectReasonEqualFold applies the EqualFold predicate on the "reject_reason" field.
|
||||
func RejectReasonEqualFold(v string) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldEqualFold(FieldRejectReason, v))
|
||||
@@ -369,6 +379,16 @@ func ReviewedByLTE(v int64) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldLTE(FieldReviewedBy, v))
|
||||
}
|
||||
|
||||
// ReviewedByIsNil applies the IsNil predicate on the "reviewed_by" field.
|
||||
func ReviewedByIsNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldIsNull(FieldReviewedBy))
|
||||
}
|
||||
|
||||
// ReviewedByNotNil applies the NotNil predicate on the "reviewed_by" field.
|
||||
func ReviewedByNotNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldNotNull(FieldReviewedBy))
|
||||
}
|
||||
|
||||
// ReviewedAtEQ applies the EQ predicate on the "reviewed_at" field.
|
||||
func ReviewedAtEQ(v time.Time) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldEQ(FieldReviewedAt, v))
|
||||
@@ -409,6 +429,16 @@ func ReviewedAtLTE(v time.Time) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldLTE(FieldReviewedAt, v))
|
||||
}
|
||||
|
||||
// ReviewedAtIsNil applies the IsNil predicate on the "reviewed_at" field.
|
||||
func ReviewedAtIsNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldIsNull(FieldReviewedAt))
|
||||
}
|
||||
|
||||
// ReviewedAtNotNil applies the NotNil predicate on the "reviewed_at" field.
|
||||
func ReviewedAtNotNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldNotNull(FieldReviewedAt))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldEQ(FieldCreatedAt, v))
|
||||
@@ -449,6 +479,16 @@ func CreatedAtLTE(v time.Time) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
@@ -489,6 +529,16 @@ func UpdatedAtLTE(v time.Time) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.UserVerifications) predicate.UserVerifications {
|
||||
return predicate.UserVerifications(sql.AndPredicates(predicates...))
|
||||
|
||||
@@ -73,24 +73,56 @@ func (_c *UserVerificationsCreate) SetReviewedBy(v int64) *UserVerificationsCrea
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableReviewedBy sets the "reviewed_by" field if the given value is not nil.
|
||||
func (_c *UserVerificationsCreate) SetNillableReviewedBy(v *int64) *UserVerificationsCreate {
|
||||
if v != nil {
|
||||
_c.SetReviewedBy(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetReviewedAt sets the "reviewed_at" field.
|
||||
func (_c *UserVerificationsCreate) SetReviewedAt(v time.Time) *UserVerificationsCreate {
|
||||
_c.mutation.SetReviewedAt(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableReviewedAt sets the "reviewed_at" field if the given value is not nil.
|
||||
func (_c *UserVerificationsCreate) SetNillableReviewedAt(v *time.Time) *UserVerificationsCreate {
|
||||
if v != nil {
|
||||
_c.SetReviewedAt(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (_c *UserVerificationsCreate) SetCreatedAt(v time.Time) *UserVerificationsCreate {
|
||||
_c.mutation.SetCreatedAt(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||
func (_c *UserVerificationsCreate) SetNillableCreatedAt(v *time.Time) *UserVerificationsCreate {
|
||||
if v != nil {
|
||||
_c.SetCreatedAt(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (_c *UserVerificationsCreate) SetUpdatedAt(v time.Time) *UserVerificationsCreate {
|
||||
_c.mutation.SetUpdatedAt(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
||||
func (_c *UserVerificationsCreate) SetNillableUpdatedAt(v *time.Time) *UserVerificationsCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdatedAt(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *UserVerificationsCreate) SetID(v int64) *UserVerificationsCreate {
|
||||
_c.mutation.SetID(v)
|
||||
@@ -136,9 +168,13 @@ func (_c *UserVerificationsCreate) defaults() {
|
||||
v := userverifications.DefaultStatus
|
||||
_c.mutation.SetStatus(v)
|
||||
}
|
||||
if _, ok := _c.mutation.RejectReason(); !ok {
|
||||
v := userverifications.DefaultRejectReason
|
||||
_c.mutation.SetRejectReason(v)
|
||||
if _, ok := _c.mutation.CreatedAt(); !ok {
|
||||
v := userverifications.DefaultCreatedAt()
|
||||
_c.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
||||
v := userverifications.DefaultUpdatedAt()
|
||||
_c.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,21 +192,6 @@ func (_c *UserVerificationsCreate) check() error {
|
||||
if _, ok := _c.mutation.Materials(); !ok {
|
||||
return &ValidationError{Name: "materials", err: errors.New(`models: missing required field "UserVerifications.materials"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.RejectReason(); !ok {
|
||||
return &ValidationError{Name: "reject_reason", err: errors.New(`models: missing required field "UserVerifications.reject_reason"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.ReviewedBy(); !ok {
|
||||
return &ValidationError{Name: "reviewed_by", err: errors.New(`models: missing required field "UserVerifications.reviewed_by"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.ReviewedAt(); !ok {
|
||||
return &ValidationError{Name: "reviewed_at", err: errors.New(`models: missing required field "UserVerifications.reviewed_at"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`models: missing required field "UserVerifications.created_at"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`models: missing required field "UserVerifications.updated_at"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -221,15 +242,15 @@ func (_c *UserVerificationsCreate) createSpec() (*UserVerifications, *sqlgraph.C
|
||||
}
|
||||
if value, ok := _c.mutation.RejectReason(); ok {
|
||||
_spec.SetField(userverifications.FieldRejectReason, field.TypeString, value)
|
||||
_node.RejectReason = value
|
||||
_node.RejectReason = &value
|
||||
}
|
||||
if value, ok := _c.mutation.ReviewedBy(); ok {
|
||||
_spec.SetField(userverifications.FieldReviewedBy, field.TypeInt64, value)
|
||||
_node.ReviewedBy = value
|
||||
_node.ReviewedBy = &value
|
||||
}
|
||||
if value, ok := _c.mutation.ReviewedAt(); ok {
|
||||
_spec.SetField(userverifications.FieldReviewedAt, field.TypeTime, value)
|
||||
_node.ReviewedAt = value
|
||||
_node.ReviewedAt = &value
|
||||
}
|
||||
if value, ok := _c.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(userverifications.FieldCreatedAt, field.TypeTime, value)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/predicate"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/schema"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models/userverifications"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -84,6 +85,12 @@ func (_u *UserVerificationsUpdate) SetNillableRejectReason(v *string) *UserVerif
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearRejectReason clears the value of the "reject_reason" field.
|
||||
func (_u *UserVerificationsUpdate) ClearRejectReason() *UserVerificationsUpdate {
|
||||
_u.mutation.ClearRejectReason()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetReviewedBy sets the "reviewed_by" field.
|
||||
func (_u *UserVerificationsUpdate) SetReviewedBy(v int64) *UserVerificationsUpdate {
|
||||
_u.mutation.ResetReviewedBy()
|
||||
@@ -105,6 +112,32 @@ func (_u *UserVerificationsUpdate) AddReviewedBy(v int64) *UserVerificationsUpda
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearReviewedBy clears the value of the "reviewed_by" field.
|
||||
func (_u *UserVerificationsUpdate) ClearReviewedBy() *UserVerificationsUpdate {
|
||||
_u.mutation.ClearReviewedBy()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetReviewedAt sets the "reviewed_at" field.
|
||||
func (_u *UserVerificationsUpdate) SetReviewedAt(v time.Time) *UserVerificationsUpdate {
|
||||
_u.mutation.SetReviewedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableReviewedAt sets the "reviewed_at" field if the given value is not nil.
|
||||
func (_u *UserVerificationsUpdate) SetNillableReviewedAt(v *time.Time) *UserVerificationsUpdate {
|
||||
if v != nil {
|
||||
_u.SetReviewedAt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearReviewedAt clears the value of the "reviewed_at" field.
|
||||
func (_u *UserVerificationsUpdate) ClearReviewedAt() *UserVerificationsUpdate {
|
||||
_u.mutation.ClearReviewedAt()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the UserVerificationsMutation object of the builder.
|
||||
func (_u *UserVerificationsUpdate) Mutation() *UserVerificationsMutation {
|
||||
return _u.mutation
|
||||
@@ -158,12 +191,30 @@ func (_u *UserVerificationsUpdate) sqlSave(ctx context.Context) (_node int, err
|
||||
if value, ok := _u.mutation.RejectReason(); ok {
|
||||
_spec.SetField(userverifications.FieldRejectReason, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.RejectReasonCleared() {
|
||||
_spec.ClearField(userverifications.FieldRejectReason, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.ReviewedBy(); ok {
|
||||
_spec.SetField(userverifications.FieldReviewedBy, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedReviewedBy(); ok {
|
||||
_spec.AddField(userverifications.FieldReviewedBy, field.TypeInt64, value)
|
||||
}
|
||||
if _u.mutation.ReviewedByCleared() {
|
||||
_spec.ClearField(userverifications.FieldReviewedBy, field.TypeInt64)
|
||||
}
|
||||
if value, ok := _u.mutation.ReviewedAt(); ok {
|
||||
_spec.SetField(userverifications.FieldReviewedAt, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.ReviewedAtCleared() {
|
||||
_spec.ClearField(userverifications.FieldReviewedAt, field.TypeTime)
|
||||
}
|
||||
if _u.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(userverifications.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if _u.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(userverifications.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{userverifications.Label}
|
||||
@@ -240,6 +291,12 @@ func (_u *UserVerificationsUpdateOne) SetNillableRejectReason(v *string) *UserVe
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearRejectReason clears the value of the "reject_reason" field.
|
||||
func (_u *UserVerificationsUpdateOne) ClearRejectReason() *UserVerificationsUpdateOne {
|
||||
_u.mutation.ClearRejectReason()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetReviewedBy sets the "reviewed_by" field.
|
||||
func (_u *UserVerificationsUpdateOne) SetReviewedBy(v int64) *UserVerificationsUpdateOne {
|
||||
_u.mutation.ResetReviewedBy()
|
||||
@@ -261,6 +318,32 @@ func (_u *UserVerificationsUpdateOne) AddReviewedBy(v int64) *UserVerificationsU
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearReviewedBy clears the value of the "reviewed_by" field.
|
||||
func (_u *UserVerificationsUpdateOne) ClearReviewedBy() *UserVerificationsUpdateOne {
|
||||
_u.mutation.ClearReviewedBy()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetReviewedAt sets the "reviewed_at" field.
|
||||
func (_u *UserVerificationsUpdateOne) SetReviewedAt(v time.Time) *UserVerificationsUpdateOne {
|
||||
_u.mutation.SetReviewedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableReviewedAt sets the "reviewed_at" field if the given value is not nil.
|
||||
func (_u *UserVerificationsUpdateOne) SetNillableReviewedAt(v *time.Time) *UserVerificationsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetReviewedAt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearReviewedAt clears the value of the "reviewed_at" field.
|
||||
func (_u *UserVerificationsUpdateOne) ClearReviewedAt() *UserVerificationsUpdateOne {
|
||||
_u.mutation.ClearReviewedAt()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the UserVerificationsMutation object of the builder.
|
||||
func (_u *UserVerificationsUpdateOne) Mutation() *UserVerificationsMutation {
|
||||
return _u.mutation
|
||||
@@ -344,12 +427,30 @@ func (_u *UserVerificationsUpdateOne) sqlSave(ctx context.Context) (_node *UserV
|
||||
if value, ok := _u.mutation.RejectReason(); ok {
|
||||
_spec.SetField(userverifications.FieldRejectReason, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.RejectReasonCleared() {
|
||||
_spec.ClearField(userverifications.FieldRejectReason, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.ReviewedBy(); ok {
|
||||
_spec.SetField(userverifications.FieldReviewedBy, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedReviewedBy(); ok {
|
||||
_spec.AddField(userverifications.FieldReviewedBy, field.TypeInt64, value)
|
||||
}
|
||||
if _u.mutation.ReviewedByCleared() {
|
||||
_spec.ClearField(userverifications.FieldReviewedBy, field.TypeInt64)
|
||||
}
|
||||
if value, ok := _u.mutation.ReviewedAt(); ok {
|
||||
_spec.SetField(userverifications.FieldReviewedAt, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.ReviewedAtCleared() {
|
||||
_spec.ClearField(userverifications.FieldReviewedAt, field.TypeTime)
|
||||
}
|
||||
if _u.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(userverifications.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if _u.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(userverifications.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
_node = &UserVerifications{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
|
||||
@@ -48,3 +48,13 @@ func (s *UserVerificationsServer) SearchUserVerifications(ctx context.Context, i
|
||||
l := logic.NewSearchUserVerificationsLogic(ctx, s.svcCtx)
|
||||
return l.SearchUserVerifications(in)
|
||||
}
|
||||
|
||||
func (s *UserVerificationsServer) AddOrUpdateUserVerifications(ctx context.Context, in *pb.AddOrUpdateUserVerificationsReq) (*pb.AddOrUpdateUserVerificationsResp, error) {
|
||||
l := logic.NewAddOrUpdateUserVerificationsLogic(ctx, s.svcCtx)
|
||||
return l.AddOrUpdateUserVerifications(in)
|
||||
}
|
||||
|
||||
func (s *UserVerificationsServer) ListUserVerificationsByUserId(ctx context.Context, in *pb.ListUserVerificationsByUserIdReq) (*pb.ListUserVerificationsByUserIdResp, error) {
|
||||
l := logic.NewListUserVerificationsByUserIdLogic(ctx, s.svcCtx)
|
||||
return l.ListUserVerificationsByUserId(in)
|
||||
}
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
stdsql "database/sql"
|
||||
"juwan-backend/app/snowflake/rpc/snowflake"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/config"
|
||||
"juwan-backend/app/user_verifications/rpc/internal/models"
|
||||
"juwan-backend/app/user_verifications/rpc/userverifications"
|
||||
"juwan-backend/app/users/rpc/usercenter"
|
||||
"juwan-backend/common/redisx"
|
||||
"juwan-backend/common/snowflakex"
|
||||
"juwan-backend/pkg/adapter"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
_ "github.com/jackc/pgx/v5/stdlib"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
"ariga.io/entcache"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
@@ -22,19 +26,23 @@ type ServiceContext struct {
|
||||
UserVeriModelRW *models.UserVerificationsClient
|
||||
UserVeriModelRO *models.UserVerificationsClient
|
||||
RedisClient *redis.ClusterClient
|
||||
UserVeriRpc userverifications.UserVerificationsZrpcClient
|
||||
SnowflakeRpc snowflake.SnowflakeServiceClient
|
||||
UserRpc usercenter.Usercenter
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
RWConn, err := sql.Open("pgx", c.DB.Master)
|
||||
rawRW, err := stdsql.Open("pgx", c.DB.Master)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ROConn, err := sql.Open("pgx", c.DB.Slave)
|
||||
rawRO, err := stdsql.Open("pgx", c.DB.Slave)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RWConn := sql.OpenDB(dialect.Postgres, rawRW)
|
||||
ROConn := sql.OpenDB(dialect.Postgres, rawRO)
|
||||
|
||||
logx.Infof("success to connect to postgres~")
|
||||
|
||||
redisConn, err := redisx.ConnectMasterSlaveCluster(c.CacheConf, 5*time.Second)
|
||||
if err != nil || redisConn == nil {
|
||||
@@ -49,7 +57,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
UserVeriModelRW: models.NewClient(models.Driver(RWDrv)).UserVerifications,
|
||||
UserVeriModelRO: models.NewClient(models.Driver(RODrv)).UserVerifications,
|
||||
RedisClient: redisConn.Client,
|
||||
UserVeriRpc: userverifications.NewUserVerificationsZrpcClient(zrpc.MustNewClient(c.UserVeriRpcConf)),
|
||||
SnowflakeRpc: snowflakex.NewClient(c.SnowflakeRpcConf),
|
||||
UserRpc: usercenter.NewUsercenter(zrpc.MustNewClient(c.UserRpcConf)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v3.19.4
|
||||
// protoc v5.29.6
|
||||
// source: user_verifications.proto
|
||||
|
||||
package pb
|
||||
@@ -778,6 +778,198 @@ func (x *SearchUserVerificationsResp) GetUserVerifications() []*UserVerification
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddOrUpdateUserVerificationsReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // userId
|
||||
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
|
||||
Material string `protobuf:"bytes,3,opt,name=material,proto3" json:"material,omitempty"` // material
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsReq) Reset() {
|
||||
*x = AddOrUpdateUserVerificationsReq{}
|
||||
mi := &file_user_verifications_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddOrUpdateUserVerificationsReq) ProtoMessage() {}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_verifications_proto_msgTypes[11]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddOrUpdateUserVerificationsReq.ProtoReflect.Descriptor instead.
|
||||
func (*AddOrUpdateUserVerificationsReq) Descriptor() ([]byte, []int) {
|
||||
return file_user_verifications_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsReq) GetUserId() int64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsReq) GetRole() string {
|
||||
if x != nil {
|
||||
return x.Role
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsReq) GetMaterial() string {
|
||||
if x != nil {
|
||||
return x.Material
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AddOrUpdateUserVerificationsResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // success
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsResp) Reset() {
|
||||
*x = AddOrUpdateUserVerificationsResp{}
|
||||
mi := &file_user_verifications_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddOrUpdateUserVerificationsResp) ProtoMessage() {}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_verifications_proto_msgTypes[12]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddOrUpdateUserVerificationsResp.ProtoReflect.Descriptor instead.
|
||||
func (*AddOrUpdateUserVerificationsResp) Descriptor() ([]byte, []int) {
|
||||
return file_user_verifications_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *AddOrUpdateUserVerificationsResp) GetSuccess() bool {
|
||||
if x != nil {
|
||||
return x.Success
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ListUserVerificationsByUserIdReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // userId
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdReq) Reset() {
|
||||
*x = ListUserVerificationsByUserIdReq{}
|
||||
mi := &file_user_verifications_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListUserVerificationsByUserIdReq) ProtoMessage() {}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_verifications_proto_msgTypes[13]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListUserVerificationsByUserIdReq.ProtoReflect.Descriptor instead.
|
||||
func (*ListUserVerificationsByUserIdReq) Descriptor() ([]byte, []int) {
|
||||
return file_user_verifications_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdReq) GetUserId() int64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListUserVerificationsByUserIdResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserVerifications []*UserVerifications `protobuf:"bytes,1,rep,name=userVerifications,proto3" json:"userVerifications,omitempty"` // userVerifications
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdResp) Reset() {
|
||||
*x = ListUserVerificationsByUserIdResp{}
|
||||
mi := &file_user_verifications_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListUserVerificationsByUserIdResp) ProtoMessage() {}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_verifications_proto_msgTypes[14]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListUserVerificationsByUserIdResp.ProtoReflect.Descriptor instead.
|
||||
func (*ListUserVerificationsByUserIdResp) Descriptor() ([]byte, []int) {
|
||||
return file_user_verifications_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *ListUserVerificationsByUserIdResp) GetUserVerifications() []*UserVerifications {
|
||||
if x != nil {
|
||||
return x.UserVerifications
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_user_verifications_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_user_verifications_proto_rawDesc = "" +
|
||||
@@ -863,13 +1055,25 @@ const file_user_verifications_proto_rawDesc = "" +
|
||||
"\tcreatedAt\x18\v \x01(\x03R\tcreatedAt\x12\x1c\n" +
|
||||
"\tupdatedAt\x18\f \x01(\x03R\tupdatedAt\"b\n" +
|
||||
"\x1bSearchUserVerificationsResp\x12C\n" +
|
||||
"\x11userVerifications\x18\x01 \x03(\v2\x15.pb.UserVerificationsR\x11userVerifications2\xd1\x03\n" +
|
||||
"\x11userVerifications\x18\x01 \x03(\v2\x15.pb.UserVerificationsR\x11userVerifications\"i\n" +
|
||||
"\x1fAddOrUpdateUserVerificationsReq\x12\x16\n" +
|
||||
"\x06userId\x18\x01 \x01(\x03R\x06userId\x12\x12\n" +
|
||||
"\x04role\x18\x02 \x01(\tR\x04role\x12\x1a\n" +
|
||||
"\bmaterial\x18\x03 \x01(\tR\bmaterial\"<\n" +
|
||||
" AddOrUpdateUserVerificationsResp\x12\x18\n" +
|
||||
"\asuccess\x18\x01 \x01(\bR\asuccess\":\n" +
|
||||
" ListUserVerificationsByUserIdReq\x12\x16\n" +
|
||||
"\x06userId\x18\x01 \x01(\x03R\x06userId\"h\n" +
|
||||
"!ListUserVerificationsByUserIdResp\x12C\n" +
|
||||
"\x11userVerifications\x18\x01 \x03(\v2\x15.pb.UserVerificationsR\x11userVerifications2\xaa\x05\n" +
|
||||
"\x12user_verifications\x12Q\n" +
|
||||
"\x14AddUserVerifications\x12\x1b.pb.AddUserVerificationsReq\x1a\x1c.pb.AddUserVerificationsResp\x12Z\n" +
|
||||
"\x17UpdateUserVerifications\x12\x1e.pb.UpdateUserVerificationsReq\x1a\x1f.pb.UpdateUserVerificationsResp\x12Q\n" +
|
||||
"\x14DelUserVerifications\x12\x1b.pb.DelUserVerificationsReq\x1a\x1c.pb.DelUserVerificationsResp\x12]\n" +
|
||||
"\x18GetUserVerificationsById\x12\x1f.pb.GetUserVerificationsByIdReq\x1a .pb.GetUserVerificationsByIdResp\x12Z\n" +
|
||||
"\x17SearchUserVerifications\x12\x1e.pb.SearchUserVerificationsReq\x1a\x1f.pb.SearchUserVerificationsRespB\x06Z\x04./pbb\x06proto3"
|
||||
"\x17SearchUserVerifications\x12\x1e.pb.SearchUserVerificationsReq\x1a\x1f.pb.SearchUserVerificationsResp\x12i\n" +
|
||||
"\x1cAddOrUpdateUserVerifications\x12#.pb.AddOrUpdateUserVerificationsReq\x1a$.pb.AddOrUpdateUserVerificationsResp\x12l\n" +
|
||||
"\x1dListUserVerificationsByUserId\x12$.pb.ListUserVerificationsByUserIdReq\x1a%.pb.ListUserVerificationsByUserIdRespB\x06Z\x04./pbb\x06proto3"
|
||||
|
||||
var (
|
||||
file_user_verifications_proto_rawDescOnce sync.Once
|
||||
@@ -883,38 +1087,47 @@ func file_user_verifications_proto_rawDescGZIP() []byte {
|
||||
return file_user_verifications_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_user_verifications_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_user_verifications_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_user_verifications_proto_goTypes = []any{
|
||||
(*UserVerifications)(nil), // 0: pb.UserVerifications
|
||||
(*AddUserVerificationsReq)(nil), // 1: pb.AddUserVerificationsReq
|
||||
(*AddUserVerificationsResp)(nil), // 2: pb.AddUserVerificationsResp
|
||||
(*UpdateUserVerificationsReq)(nil), // 3: pb.UpdateUserVerificationsReq
|
||||
(*UpdateUserVerificationsResp)(nil), // 4: pb.UpdateUserVerificationsResp
|
||||
(*DelUserVerificationsReq)(nil), // 5: pb.DelUserVerificationsReq
|
||||
(*DelUserVerificationsResp)(nil), // 6: pb.DelUserVerificationsResp
|
||||
(*GetUserVerificationsByIdReq)(nil), // 7: pb.GetUserVerificationsByIdReq
|
||||
(*GetUserVerificationsByIdResp)(nil), // 8: pb.GetUserVerificationsByIdResp
|
||||
(*SearchUserVerificationsReq)(nil), // 9: pb.SearchUserVerificationsReq
|
||||
(*SearchUserVerificationsResp)(nil), // 10: pb.SearchUserVerificationsResp
|
||||
(*UserVerifications)(nil), // 0: pb.UserVerifications
|
||||
(*AddUserVerificationsReq)(nil), // 1: pb.AddUserVerificationsReq
|
||||
(*AddUserVerificationsResp)(nil), // 2: pb.AddUserVerificationsResp
|
||||
(*UpdateUserVerificationsReq)(nil), // 3: pb.UpdateUserVerificationsReq
|
||||
(*UpdateUserVerificationsResp)(nil), // 4: pb.UpdateUserVerificationsResp
|
||||
(*DelUserVerificationsReq)(nil), // 5: pb.DelUserVerificationsReq
|
||||
(*DelUserVerificationsResp)(nil), // 6: pb.DelUserVerificationsResp
|
||||
(*GetUserVerificationsByIdReq)(nil), // 7: pb.GetUserVerificationsByIdReq
|
||||
(*GetUserVerificationsByIdResp)(nil), // 8: pb.GetUserVerificationsByIdResp
|
||||
(*SearchUserVerificationsReq)(nil), // 9: pb.SearchUserVerificationsReq
|
||||
(*SearchUserVerificationsResp)(nil), // 10: pb.SearchUserVerificationsResp
|
||||
(*AddOrUpdateUserVerificationsReq)(nil), // 11: pb.AddOrUpdateUserVerificationsReq
|
||||
(*AddOrUpdateUserVerificationsResp)(nil), // 12: pb.AddOrUpdateUserVerificationsResp
|
||||
(*ListUserVerificationsByUserIdReq)(nil), // 13: pb.ListUserVerificationsByUserIdReq
|
||||
(*ListUserVerificationsByUserIdResp)(nil), // 14: pb.ListUserVerificationsByUserIdResp
|
||||
}
|
||||
var file_user_verifications_proto_depIdxs = []int32{
|
||||
0, // 0: pb.GetUserVerificationsByIdResp.userVerifications:type_name -> pb.UserVerifications
|
||||
0, // 1: pb.SearchUserVerificationsResp.userVerifications:type_name -> pb.UserVerifications
|
||||
1, // 2: pb.user_verifications.AddUserVerifications:input_type -> pb.AddUserVerificationsReq
|
||||
3, // 3: pb.user_verifications.UpdateUserVerifications:input_type -> pb.UpdateUserVerificationsReq
|
||||
5, // 4: pb.user_verifications.DelUserVerifications:input_type -> pb.DelUserVerificationsReq
|
||||
7, // 5: pb.user_verifications.GetUserVerificationsById:input_type -> pb.GetUserVerificationsByIdReq
|
||||
9, // 6: pb.user_verifications.SearchUserVerifications:input_type -> pb.SearchUserVerificationsReq
|
||||
2, // 7: pb.user_verifications.AddUserVerifications:output_type -> pb.AddUserVerificationsResp
|
||||
4, // 8: pb.user_verifications.UpdateUserVerifications:output_type -> pb.UpdateUserVerificationsResp
|
||||
6, // 9: pb.user_verifications.DelUserVerifications:output_type -> pb.DelUserVerificationsResp
|
||||
8, // 10: pb.user_verifications.GetUserVerificationsById:output_type -> pb.GetUserVerificationsByIdResp
|
||||
10, // 11: pb.user_verifications.SearchUserVerifications:output_type -> pb.SearchUserVerificationsResp
|
||||
7, // [7:12] is the sub-list for method output_type
|
||||
2, // [2:7] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
0, // 2: pb.ListUserVerificationsByUserIdResp.userVerifications:type_name -> pb.UserVerifications
|
||||
1, // 3: pb.user_verifications.AddUserVerifications:input_type -> pb.AddUserVerificationsReq
|
||||
3, // 4: pb.user_verifications.UpdateUserVerifications:input_type -> pb.UpdateUserVerificationsReq
|
||||
5, // 5: pb.user_verifications.DelUserVerifications:input_type -> pb.DelUserVerificationsReq
|
||||
7, // 6: pb.user_verifications.GetUserVerificationsById:input_type -> pb.GetUserVerificationsByIdReq
|
||||
9, // 7: pb.user_verifications.SearchUserVerifications:input_type -> pb.SearchUserVerificationsReq
|
||||
11, // 8: pb.user_verifications.AddOrUpdateUserVerifications:input_type -> pb.AddOrUpdateUserVerificationsReq
|
||||
13, // 9: pb.user_verifications.ListUserVerificationsByUserId:input_type -> pb.ListUserVerificationsByUserIdReq
|
||||
2, // 10: pb.user_verifications.AddUserVerifications:output_type -> pb.AddUserVerificationsResp
|
||||
4, // 11: pb.user_verifications.UpdateUserVerifications:output_type -> pb.UpdateUserVerificationsResp
|
||||
6, // 12: pb.user_verifications.DelUserVerifications:output_type -> pb.DelUserVerificationsResp
|
||||
8, // 13: pb.user_verifications.GetUserVerificationsById:output_type -> pb.GetUserVerificationsByIdResp
|
||||
10, // 14: pb.user_verifications.SearchUserVerifications:output_type -> pb.SearchUserVerificationsResp
|
||||
12, // 15: pb.user_verifications.AddOrUpdateUserVerifications:output_type -> pb.AddOrUpdateUserVerificationsResp
|
||||
14, // 16: pb.user_verifications.ListUserVerificationsByUserId:output_type -> pb.ListUserVerificationsByUserIdResp
|
||||
10, // [10:17] is the sub-list for method output_type
|
||||
3, // [3:10] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_user_verifications_proto_init() }
|
||||
@@ -929,7 +1142,7 @@ func file_user_verifications_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_verifications_proto_rawDesc), len(file_user_verifications_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 11,
|
||||
NumMessages: 15,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v3.19.4
|
||||
// - protoc v5.29.6
|
||||
// source: user_verifications.proto
|
||||
|
||||
package pb
|
||||
@@ -19,11 +19,13 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
UserVerifications_AddUserVerifications_FullMethodName = "/pb.user_verifications/AddUserVerifications"
|
||||
UserVerifications_UpdateUserVerifications_FullMethodName = "/pb.user_verifications/UpdateUserVerifications"
|
||||
UserVerifications_DelUserVerifications_FullMethodName = "/pb.user_verifications/DelUserVerifications"
|
||||
UserVerifications_GetUserVerificationsById_FullMethodName = "/pb.user_verifications/GetUserVerificationsById"
|
||||
UserVerifications_SearchUserVerifications_FullMethodName = "/pb.user_verifications/SearchUserVerifications"
|
||||
UserVerifications_AddUserVerifications_FullMethodName = "/pb.user_verifications/AddUserVerifications"
|
||||
UserVerifications_UpdateUserVerifications_FullMethodName = "/pb.user_verifications/UpdateUserVerifications"
|
||||
UserVerifications_DelUserVerifications_FullMethodName = "/pb.user_verifications/DelUserVerifications"
|
||||
UserVerifications_GetUserVerificationsById_FullMethodName = "/pb.user_verifications/GetUserVerificationsById"
|
||||
UserVerifications_SearchUserVerifications_FullMethodName = "/pb.user_verifications/SearchUserVerifications"
|
||||
UserVerifications_AddOrUpdateUserVerifications_FullMethodName = "/pb.user_verifications/AddOrUpdateUserVerifications"
|
||||
UserVerifications_ListUserVerificationsByUserId_FullMethodName = "/pb.user_verifications/ListUserVerificationsByUserId"
|
||||
)
|
||||
|
||||
// UserVerificationsClient is the client API for UserVerifications service.
|
||||
@@ -36,6 +38,8 @@ type UserVerificationsClient interface {
|
||||
DelUserVerifications(ctx context.Context, in *DelUserVerificationsReq, opts ...grpc.CallOption) (*DelUserVerificationsResp, error)
|
||||
GetUserVerificationsById(ctx context.Context, in *GetUserVerificationsByIdReq, opts ...grpc.CallOption) (*GetUserVerificationsByIdResp, error)
|
||||
SearchUserVerifications(ctx context.Context, in *SearchUserVerificationsReq, opts ...grpc.CallOption) (*SearchUserVerificationsResp, error)
|
||||
AddOrUpdateUserVerifications(ctx context.Context, in *AddOrUpdateUserVerificationsReq, opts ...grpc.CallOption) (*AddOrUpdateUserVerificationsResp, error)
|
||||
ListUserVerificationsByUserId(ctx context.Context, in *ListUserVerificationsByUserIdReq, opts ...grpc.CallOption) (*ListUserVerificationsByUserIdResp, error)
|
||||
}
|
||||
|
||||
type userVerificationsClient struct {
|
||||
@@ -96,6 +100,26 @@ func (c *userVerificationsClient) SearchUserVerifications(ctx context.Context, i
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userVerificationsClient) AddOrUpdateUserVerifications(ctx context.Context, in *AddOrUpdateUserVerificationsReq, opts ...grpc.CallOption) (*AddOrUpdateUserVerificationsResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AddOrUpdateUserVerificationsResp)
|
||||
err := c.cc.Invoke(ctx, UserVerifications_AddOrUpdateUserVerifications_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userVerificationsClient) ListUserVerificationsByUserId(ctx context.Context, in *ListUserVerificationsByUserIdReq, opts ...grpc.CallOption) (*ListUserVerificationsByUserIdResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListUserVerificationsByUserIdResp)
|
||||
err := c.cc.Invoke(ctx, UserVerifications_ListUserVerificationsByUserId_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UserVerificationsServer is the server API for UserVerifications service.
|
||||
// All implementations must embed UnimplementedUserVerificationsServer
|
||||
// for forward compatibility.
|
||||
@@ -106,6 +130,8 @@ type UserVerificationsServer interface {
|
||||
DelUserVerifications(context.Context, *DelUserVerificationsReq) (*DelUserVerificationsResp, error)
|
||||
GetUserVerificationsById(context.Context, *GetUserVerificationsByIdReq) (*GetUserVerificationsByIdResp, error)
|
||||
SearchUserVerifications(context.Context, *SearchUserVerificationsReq) (*SearchUserVerificationsResp, error)
|
||||
AddOrUpdateUserVerifications(context.Context, *AddOrUpdateUserVerificationsReq) (*AddOrUpdateUserVerificationsResp, error)
|
||||
ListUserVerificationsByUserId(context.Context, *ListUserVerificationsByUserIdReq) (*ListUserVerificationsByUserIdResp, error)
|
||||
mustEmbedUnimplementedUserVerificationsServer()
|
||||
}
|
||||
|
||||
@@ -131,6 +157,12 @@ func (UnimplementedUserVerificationsServer) GetUserVerificationsById(context.Con
|
||||
func (UnimplementedUserVerificationsServer) SearchUserVerifications(context.Context, *SearchUserVerificationsReq) (*SearchUserVerificationsResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SearchUserVerifications not implemented")
|
||||
}
|
||||
func (UnimplementedUserVerificationsServer) AddOrUpdateUserVerifications(context.Context, *AddOrUpdateUserVerificationsReq) (*AddOrUpdateUserVerificationsResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method AddOrUpdateUserVerifications not implemented")
|
||||
}
|
||||
func (UnimplementedUserVerificationsServer) ListUserVerificationsByUserId(context.Context, *ListUserVerificationsByUserIdReq) (*ListUserVerificationsByUserIdResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ListUserVerificationsByUserId not implemented")
|
||||
}
|
||||
func (UnimplementedUserVerificationsServer) mustEmbedUnimplementedUserVerificationsServer() {}
|
||||
func (UnimplementedUserVerificationsServer) testEmbeddedByValue() {}
|
||||
|
||||
@@ -242,6 +274,42 @@ func _UserVerifications_SearchUserVerifications_Handler(srv interface{}, ctx con
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserVerifications_AddOrUpdateUserVerifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddOrUpdateUserVerificationsReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserVerificationsServer).AddOrUpdateUserVerifications(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserVerifications_AddOrUpdateUserVerifications_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserVerificationsServer).AddOrUpdateUserVerifications(ctx, req.(*AddOrUpdateUserVerificationsReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserVerifications_ListUserVerificationsByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListUserVerificationsByUserIdReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserVerificationsServer).ListUserVerificationsByUserId(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserVerifications_ListUserVerificationsByUserId_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserVerificationsServer).ListUserVerificationsByUserId(ctx, req.(*ListUserVerificationsByUserIdReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// UserVerifications_ServiceDesc is the grpc.ServiceDesc for UserVerifications service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -269,6 +337,14 @@ var UserVerifications_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "SearchUserVerifications",
|
||||
Handler: _UserVerifications_SearchUserVerifications_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AddOrUpdateUserVerifications",
|
||||
Handler: _UserVerifications_AddOrUpdateUserVerifications_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListUserVerificationsByUserId",
|
||||
Handler: _UserVerifications_ListUserVerificationsByUserId_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "user_verifications.proto",
|
||||
|
||||
@@ -14,17 +14,21 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
AddUserVerificationsReq = pb.AddUserVerificationsReq
|
||||
AddUserVerificationsResp = pb.AddUserVerificationsResp
|
||||
DelUserVerificationsReq = pb.DelUserVerificationsReq
|
||||
DelUserVerificationsResp = pb.DelUserVerificationsResp
|
||||
GetUserVerificationsByIdReq = pb.GetUserVerificationsByIdReq
|
||||
GetUserVerificationsByIdResp = pb.GetUserVerificationsByIdResp
|
||||
SearchUserVerificationsReq = pb.SearchUserVerificationsReq
|
||||
SearchUserVerificationsResp = pb.SearchUserVerificationsResp
|
||||
UpdateUserVerificationsReq = pb.UpdateUserVerificationsReq
|
||||
UpdateUserVerificationsResp = pb.UpdateUserVerificationsResp
|
||||
UserVerifications = pb.UserVerifications
|
||||
AddOrUpdateUserVerificationsReq = pb.AddOrUpdateUserVerificationsReq
|
||||
AddOrUpdateUserVerificationsResp = pb.AddOrUpdateUserVerificationsResp
|
||||
AddUserVerificationsReq = pb.AddUserVerificationsReq
|
||||
AddUserVerificationsResp = pb.AddUserVerificationsResp
|
||||
DelUserVerificationsReq = pb.DelUserVerificationsReq
|
||||
DelUserVerificationsResp = pb.DelUserVerificationsResp
|
||||
GetUserVerificationsByIdReq = pb.GetUserVerificationsByIdReq
|
||||
GetUserVerificationsByIdResp = pb.GetUserVerificationsByIdResp
|
||||
ListUserVerificationsByUserIdReq = pb.ListUserVerificationsByUserIdReq
|
||||
ListUserVerificationsByUserIdResp = pb.ListUserVerificationsByUserIdResp
|
||||
SearchUserVerificationsReq = pb.SearchUserVerificationsReq
|
||||
SearchUserVerificationsResp = pb.SearchUserVerificationsResp
|
||||
UpdateUserVerificationsReq = pb.UpdateUserVerificationsReq
|
||||
UpdateUserVerificationsResp = pb.UpdateUserVerificationsResp
|
||||
UserVerifications = pb.UserVerifications
|
||||
|
||||
UserVerificationsZrpcClient interface {
|
||||
// -----------------------userVerifications-----------------------
|
||||
@@ -33,6 +37,8 @@ type (
|
||||
DelUserVerifications(ctx context.Context, in *DelUserVerificationsReq, opts ...grpc.CallOption) (*DelUserVerificationsResp, error)
|
||||
GetUserVerificationsById(ctx context.Context, in *GetUserVerificationsByIdReq, opts ...grpc.CallOption) (*GetUserVerificationsByIdResp, error)
|
||||
SearchUserVerifications(ctx context.Context, in *SearchUserVerificationsReq, opts ...grpc.CallOption) (*SearchUserVerificationsResp, error)
|
||||
AddOrUpdateUserVerifications(ctx context.Context, in *AddOrUpdateUserVerificationsReq, opts ...grpc.CallOption) (*AddOrUpdateUserVerificationsResp, error)
|
||||
ListUserVerificationsByUserId(ctx context.Context, in *ListUserVerificationsByUserIdReq, opts ...grpc.CallOption) (*ListUserVerificationsByUserIdResp, error)
|
||||
}
|
||||
|
||||
defaultUserVerificationsZrpcClient struct {
|
||||
@@ -71,3 +77,13 @@ func (m *defaultUserVerificationsZrpcClient) SearchUserVerifications(ctx context
|
||||
client := pb.NewUserVerificationsClient(m.cli.Conn())
|
||||
return client.SearchUserVerifications(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultUserVerificationsZrpcClient) AddOrUpdateUserVerifications(ctx context.Context, in *AddOrUpdateUserVerificationsReq, opts ...grpc.CallOption) (*AddOrUpdateUserVerificationsResp, error) {
|
||||
client := pb.NewUserVerificationsClient(m.cli.Conn())
|
||||
return client.AddOrUpdateUserVerifications(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultUserVerificationsZrpcClient) ListUserVerificationsByUserId(ctx context.Context, in *ListUserVerificationsByUserIdReq, opts ...grpc.CallOption) (*ListUserVerificationsByUserIdResp, error) {
|
||||
client := pb.NewUserVerificationsClient(m.cli.Conn())
|
||||
return client.ListUserVerificationsByUserId(ctx, in, opts...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user