fix: some api bug

This commit is contained in:
wwweww
2026-03-31 22:12:06 +08:00
parent c5ff4f0216
commit e7970ac25f
219 changed files with 16195 additions and 2126 deletions
+18 -3
View File
@@ -29,8 +29,6 @@ const (
FieldBio = "bio"
// FieldCurrentRole holds the string denoting the current_role field in the database.
FieldCurrentRole = "current_role"
// FieldVerifiedRoles holds the string denoting the verified_roles field in the database.
FieldVerifiedRoles = "verified_roles"
// FieldVerificationStatus holds the string denoting the verificationstatus field in the database.
FieldVerificationStatus = "verification_status"
// FieldIsAdmin holds the string denoting the is_admin field in the database.
@@ -41,6 +39,8 @@ const (
FieldUpdatedAt = "updated_at"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldVerifiedRoles holds the string denoting the verified_roles field in the database.
FieldVerifiedRoles = "verified_roles"
// Table holds the table name of the users in the database.
Table = "users"
)
@@ -56,12 +56,12 @@ var Columns = []string{
FieldAvatar,
FieldBio,
FieldCurrentRole,
FieldVerifiedRoles,
FieldVerificationStatus,
FieldIsAdmin,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
FieldVerifiedRoles,
}
// ValidColumn reports if the column name is valid (part of the table columns).
@@ -75,6 +75,16 @@ func ValidColumn(column string) bool {
}
var (
// DefaultNickname holds the default value on creation for the "nickname" field.
DefaultNickname string
// DefaultAvatar holds the default value on creation for the "avatar" field.
DefaultAvatar string
// DefaultBio holds the default value on creation for the "bio" field.
DefaultBio string
// DefaultCurrentRole holds the default value on creation for the "current_role" field.
DefaultCurrentRole string
// CurrentRoleValidator is a validator for the "current_role" field. It is called by the builders before save.
CurrentRoleValidator func(string) error
// DefaultIsAdmin holds the default value on creation for the "is_admin" field.
DefaultIsAdmin bool
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
@@ -150,3 +160,8 @@ func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByVerifiedRoles orders the results by the verified_roles field.
func ByVerifiedRoles(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVerifiedRoles, opts...).ToFunc()
}
@@ -4,6 +4,7 @@ package users
import (
"juwan-backend/app/users/rpc/internal/models/predicate"
"juwan-backend/pkg/types"
"time"
"entgo.io/ent/dialect/sql"
@@ -114,6 +115,11 @@ func DeletedAt(v time.Time) predicate.Users {
return predicate.Users(sql.FieldEQ(FieldDeletedAt, v))
}
// VerifiedRoles applies equality check predicate on the "verified_roles" field. It's identical to VerifiedRolesEQ.
func VerifiedRoles(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldEQ(FieldVerifiedRoles, v))
}
// UsernameEQ applies the EQ predicate on the "username" field.
func UsernameEQ(v string) predicate.Users {
return predicate.Users(sql.FieldEQ(FieldUsername, v))
@@ -634,6 +640,16 @@ func CurrentRoleContainsFold(v string) predicate.Users {
return predicate.Users(sql.FieldContainsFold(FieldCurrentRole, v))
}
// VerificationStatusIsNil applies the IsNil predicate on the "verificationStatus" field.
func VerificationStatusIsNil() predicate.Users {
return predicate.Users(sql.FieldIsNull(FieldVerificationStatus))
}
// VerificationStatusNotNil applies the NotNil predicate on the "verificationStatus" field.
func VerificationStatusNotNil() predicate.Users {
return predicate.Users(sql.FieldNotNull(FieldVerificationStatus))
}
// IsAdminEQ applies the EQ predicate on the "is_admin" field.
func IsAdminEQ(v bool) predicate.Users {
return predicate.Users(sql.FieldEQ(FieldIsAdmin, v))
@@ -764,6 +780,66 @@ func DeletedAtLTE(v time.Time) predicate.Users {
return predicate.Users(sql.FieldLTE(FieldDeletedAt, v))
}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
func DeletedAtIsNil() predicate.Users {
return predicate.Users(sql.FieldIsNull(FieldDeletedAt))
}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
func DeletedAtNotNil() predicate.Users {
return predicate.Users(sql.FieldNotNull(FieldDeletedAt))
}
// VerifiedRolesEQ applies the EQ predicate on the "verified_roles" field.
func VerifiedRolesEQ(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldEQ(FieldVerifiedRoles, v))
}
// VerifiedRolesNEQ applies the NEQ predicate on the "verified_roles" field.
func VerifiedRolesNEQ(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldNEQ(FieldVerifiedRoles, v))
}
// VerifiedRolesIn applies the In predicate on the "verified_roles" field.
func VerifiedRolesIn(vs ...types.TextArray) predicate.Users {
return predicate.Users(sql.FieldIn(FieldVerifiedRoles, vs...))
}
// VerifiedRolesNotIn applies the NotIn predicate on the "verified_roles" field.
func VerifiedRolesNotIn(vs ...types.TextArray) predicate.Users {
return predicate.Users(sql.FieldNotIn(FieldVerifiedRoles, vs...))
}
// VerifiedRolesGT applies the GT predicate on the "verified_roles" field.
func VerifiedRolesGT(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldGT(FieldVerifiedRoles, v))
}
// VerifiedRolesGTE applies the GTE predicate on the "verified_roles" field.
func VerifiedRolesGTE(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldGTE(FieldVerifiedRoles, v))
}
// VerifiedRolesLT applies the LT predicate on the "verified_roles" field.
func VerifiedRolesLT(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldLT(FieldVerifiedRoles, v))
}
// VerifiedRolesLTE applies the LTE predicate on the "verified_roles" field.
func VerifiedRolesLTE(v types.TextArray) predicate.Users {
return predicate.Users(sql.FieldLTE(FieldVerifiedRoles, v))
}
// VerifiedRolesIsNil applies the IsNil predicate on the "verified_roles" field.
func VerifiedRolesIsNil() predicate.Users {
return predicate.Users(sql.FieldIsNull(FieldVerifiedRoles))
}
// VerifiedRolesNotNil applies the NotNil predicate on the "verified_roles" field.
func VerifiedRolesNotNil() predicate.Users {
return predicate.Users(sql.FieldNotNull(FieldVerifiedRoles))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.Users) predicate.Users {
return predicate.Users(sql.AndPredicates(predicates...))