fix: some api bug
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user