feat: rebuild auth identity foundation flow
This commit is contained in:
@@ -43,6 +43,12 @@ const (
|
||||
FieldTotpEnabled = "totp_enabled"
|
||||
// FieldTotpEnabledAt holds the string denoting the totp_enabled_at field in the database.
|
||||
FieldTotpEnabledAt = "totp_enabled_at"
|
||||
// FieldSignupSource holds the string denoting the signup_source field in the database.
|
||||
FieldSignupSource = "signup_source"
|
||||
// FieldLastLoginAt holds the string denoting the last_login_at field in the database.
|
||||
FieldLastLoginAt = "last_login_at"
|
||||
// FieldLastActiveAt holds the string denoting the last_active_at field in the database.
|
||||
FieldLastActiveAt = "last_active_at"
|
||||
// FieldBalanceNotifyEnabled holds the string denoting the balance_notify_enabled field in the database.
|
||||
FieldBalanceNotifyEnabled = "balance_notify_enabled"
|
||||
// FieldBalanceNotifyThresholdType holds the string denoting the balance_notify_threshold_type field in the database.
|
||||
@@ -73,6 +79,10 @@ const (
|
||||
EdgePromoCodeUsages = "promo_code_usages"
|
||||
// EdgePaymentOrders holds the string denoting the payment_orders edge name in mutations.
|
||||
EdgePaymentOrders = "payment_orders"
|
||||
// EdgeAuthIdentities holds the string denoting the auth_identities edge name in mutations.
|
||||
EdgeAuthIdentities = "auth_identities"
|
||||
// EdgePendingAuthSessions holds the string denoting the pending_auth_sessions edge name in mutations.
|
||||
EdgePendingAuthSessions = "pending_auth_sessions"
|
||||
// EdgeUserAllowedGroups holds the string denoting the user_allowed_groups edge name in mutations.
|
||||
EdgeUserAllowedGroups = "user_allowed_groups"
|
||||
// Table holds the table name of the user in the database.
|
||||
@@ -145,6 +155,20 @@ const (
|
||||
PaymentOrdersInverseTable = "payment_orders"
|
||||
// PaymentOrdersColumn is the table column denoting the payment_orders relation/edge.
|
||||
PaymentOrdersColumn = "user_id"
|
||||
// AuthIdentitiesTable is the table that holds the auth_identities relation/edge.
|
||||
AuthIdentitiesTable = "auth_identities"
|
||||
// AuthIdentitiesInverseTable is the table name for the AuthIdentity entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "authidentity" package.
|
||||
AuthIdentitiesInverseTable = "auth_identities"
|
||||
// AuthIdentitiesColumn is the table column denoting the auth_identities relation/edge.
|
||||
AuthIdentitiesColumn = "user_id"
|
||||
// PendingAuthSessionsTable is the table that holds the pending_auth_sessions relation/edge.
|
||||
PendingAuthSessionsTable = "pending_auth_sessions"
|
||||
// PendingAuthSessionsInverseTable is the table name for the PendingAuthSession entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "pendingauthsession" package.
|
||||
PendingAuthSessionsInverseTable = "pending_auth_sessions"
|
||||
// PendingAuthSessionsColumn is the table column denoting the pending_auth_sessions relation/edge.
|
||||
PendingAuthSessionsColumn = "target_user_id"
|
||||
// UserAllowedGroupsTable is the table that holds the user_allowed_groups relation/edge.
|
||||
UserAllowedGroupsTable = "user_allowed_groups"
|
||||
// UserAllowedGroupsInverseTable is the table name for the UserAllowedGroup entity.
|
||||
@@ -171,6 +195,9 @@ var Columns = []string{
|
||||
FieldTotpSecretEncrypted,
|
||||
FieldTotpEnabled,
|
||||
FieldTotpEnabledAt,
|
||||
FieldSignupSource,
|
||||
FieldLastLoginAt,
|
||||
FieldLastActiveAt,
|
||||
FieldBalanceNotifyEnabled,
|
||||
FieldBalanceNotifyThresholdType,
|
||||
FieldBalanceNotifyThreshold,
|
||||
@@ -232,6 +259,10 @@ var (
|
||||
DefaultNotes string
|
||||
// DefaultTotpEnabled holds the default value on creation for the "totp_enabled" field.
|
||||
DefaultTotpEnabled bool
|
||||
// DefaultSignupSource holds the default value on creation for the "signup_source" field.
|
||||
DefaultSignupSource string
|
||||
// SignupSourceValidator is a validator for the "signup_source" field. It is called by the builders before save.
|
||||
SignupSourceValidator func(string) error
|
||||
// DefaultBalanceNotifyEnabled holds the default value on creation for the "balance_notify_enabled" field.
|
||||
DefaultBalanceNotifyEnabled bool
|
||||
// DefaultBalanceNotifyThresholdType holds the default value on creation for the "balance_notify_threshold_type" field.
|
||||
@@ -320,6 +351,21 @@ func ByTotpEnabledAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTotpEnabledAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySignupSource orders the results by the signup_source field.
|
||||
func BySignupSource(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSignupSource, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLastLoginAt orders the results by the last_login_at field.
|
||||
func ByLastLoginAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLastLoginAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLastActiveAt orders the results by the last_active_at field.
|
||||
func ByLastActiveAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLastActiveAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBalanceNotifyEnabled orders the results by the balance_notify_enabled field.
|
||||
func ByBalanceNotifyEnabled(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBalanceNotifyEnabled, opts...).ToFunc()
|
||||
@@ -485,6 +531,34 @@ func ByPaymentOrders(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
}
|
||||
}
|
||||
|
||||
// ByAuthIdentitiesCount orders the results by auth_identities count.
|
||||
func ByAuthIdentitiesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newAuthIdentitiesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByAuthIdentities orders the results by auth_identities terms.
|
||||
func ByAuthIdentities(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newAuthIdentitiesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByPendingAuthSessionsCount orders the results by pending_auth_sessions count.
|
||||
func ByPendingAuthSessionsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newPendingAuthSessionsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByPendingAuthSessions orders the results by pending_auth_sessions terms.
|
||||
func ByPendingAuthSessions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newPendingAuthSessionsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByUserAllowedGroupsCount orders the results by user_allowed_groups count.
|
||||
func ByUserAllowedGroupsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
@@ -568,6 +642,20 @@ func newPaymentOrdersStep() *sqlgraph.Step {
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, PaymentOrdersTable, PaymentOrdersColumn),
|
||||
)
|
||||
}
|
||||
func newAuthIdentitiesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(AuthIdentitiesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, AuthIdentitiesTable, AuthIdentitiesColumn),
|
||||
)
|
||||
}
|
||||
func newPendingAuthSessionsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PendingAuthSessionsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, PendingAuthSessionsTable, PendingAuthSessionsColumn),
|
||||
)
|
||||
}
|
||||
func newUserAllowedGroupsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
|
||||
@@ -125,6 +125,21 @@ func TotpEnabledAt(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldTotpEnabledAt, v))
|
||||
}
|
||||
|
||||
// SignupSource applies equality check predicate on the "signup_source" field. It's identical to SignupSourceEQ.
|
||||
func SignupSource(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// LastLoginAt applies equality check predicate on the "last_login_at" field. It's identical to LastLoginAtEQ.
|
||||
func LastLoginAt(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAt applies equality check predicate on the "last_active_at" field. It's identical to LastActiveAtEQ.
|
||||
func LastActiveAt(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// BalanceNotifyEnabled applies equality check predicate on the "balance_notify_enabled" field. It's identical to BalanceNotifyEnabledEQ.
|
||||
func BalanceNotifyEnabled(v bool) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldBalanceNotifyEnabled, v))
|
||||
@@ -885,6 +900,171 @@ func TotpEnabledAtNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldTotpEnabledAt))
|
||||
}
|
||||
|
||||
// SignupSourceEQ applies the EQ predicate on the "signup_source" field.
|
||||
func SignupSourceEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceNEQ applies the NEQ predicate on the "signup_source" field.
|
||||
func SignupSourceNEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceIn applies the In predicate on the "signup_source" field.
|
||||
func SignupSourceIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldSignupSource, vs...))
|
||||
}
|
||||
|
||||
// SignupSourceNotIn applies the NotIn predicate on the "signup_source" field.
|
||||
func SignupSourceNotIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldSignupSource, vs...))
|
||||
}
|
||||
|
||||
// SignupSourceGT applies the GT predicate on the "signup_source" field.
|
||||
func SignupSourceGT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceGTE applies the GTE predicate on the "signup_source" field.
|
||||
func SignupSourceGTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceLT applies the LT predicate on the "signup_source" field.
|
||||
func SignupSourceLT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceLTE applies the LTE predicate on the "signup_source" field.
|
||||
func SignupSourceLTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceContains applies the Contains predicate on the "signup_source" field.
|
||||
func SignupSourceContains(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContains(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceHasPrefix applies the HasPrefix predicate on the "signup_source" field.
|
||||
func SignupSourceHasPrefix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasPrefix(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceHasSuffix applies the HasSuffix predicate on the "signup_source" field.
|
||||
func SignupSourceHasSuffix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasSuffix(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceEqualFold applies the EqualFold predicate on the "signup_source" field.
|
||||
func SignupSourceEqualFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEqualFold(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// SignupSourceContainsFold applies the ContainsFold predicate on the "signup_source" field.
|
||||
func SignupSourceContainsFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContainsFold(FieldSignupSource, v))
|
||||
}
|
||||
|
||||
// LastLoginAtEQ applies the EQ predicate on the "last_login_at" field.
|
||||
func LastLoginAtEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastLoginAtNEQ applies the NEQ predicate on the "last_login_at" field.
|
||||
func LastLoginAtNEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastLoginAtIn applies the In predicate on the "last_login_at" field.
|
||||
func LastLoginAtIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldLastLoginAt, vs...))
|
||||
}
|
||||
|
||||
// LastLoginAtNotIn applies the NotIn predicate on the "last_login_at" field.
|
||||
func LastLoginAtNotIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldLastLoginAt, vs...))
|
||||
}
|
||||
|
||||
// LastLoginAtGT applies the GT predicate on the "last_login_at" field.
|
||||
func LastLoginAtGT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastLoginAtGTE applies the GTE predicate on the "last_login_at" field.
|
||||
func LastLoginAtGTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastLoginAtLT applies the LT predicate on the "last_login_at" field.
|
||||
func LastLoginAtLT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastLoginAtLTE applies the LTE predicate on the "last_login_at" field.
|
||||
func LastLoginAtLTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// LastLoginAtIsNil applies the IsNil predicate on the "last_login_at" field.
|
||||
func LastLoginAtIsNil() predicate.User {
|
||||
return predicate.User(sql.FieldIsNull(FieldLastLoginAt))
|
||||
}
|
||||
|
||||
// LastLoginAtNotNil applies the NotNil predicate on the "last_login_at" field.
|
||||
func LastLoginAtNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldLastLoginAt))
|
||||
}
|
||||
|
||||
// LastActiveAtEQ applies the EQ predicate on the "last_active_at" field.
|
||||
func LastActiveAtEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAtNEQ applies the NEQ predicate on the "last_active_at" field.
|
||||
func LastActiveAtNEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAtIn applies the In predicate on the "last_active_at" field.
|
||||
func LastActiveAtIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldLastActiveAt, vs...))
|
||||
}
|
||||
|
||||
// LastActiveAtNotIn applies the NotIn predicate on the "last_active_at" field.
|
||||
func LastActiveAtNotIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldLastActiveAt, vs...))
|
||||
}
|
||||
|
||||
// LastActiveAtGT applies the GT predicate on the "last_active_at" field.
|
||||
func LastActiveAtGT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAtGTE applies the GTE predicate on the "last_active_at" field.
|
||||
func LastActiveAtGTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAtLT applies the LT predicate on the "last_active_at" field.
|
||||
func LastActiveAtLT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAtLTE applies the LTE predicate on the "last_active_at" field.
|
||||
func LastActiveAtLTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldLastActiveAt, v))
|
||||
}
|
||||
|
||||
// LastActiveAtIsNil applies the IsNil predicate on the "last_active_at" field.
|
||||
func LastActiveAtIsNil() predicate.User {
|
||||
return predicate.User(sql.FieldIsNull(FieldLastActiveAt))
|
||||
}
|
||||
|
||||
// LastActiveAtNotNil applies the NotNil predicate on the "last_active_at" field.
|
||||
func LastActiveAtNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldLastActiveAt))
|
||||
}
|
||||
|
||||
// BalanceNotifyEnabledEQ applies the EQ predicate on the "balance_notify_enabled" field.
|
||||
func BalanceNotifyEnabledEQ(v bool) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldBalanceNotifyEnabled, v))
|
||||
@@ -1345,6 +1525,52 @@ func HasPaymentOrdersWith(preds ...predicate.PaymentOrder) predicate.User {
|
||||
})
|
||||
}
|
||||
|
||||
// HasAuthIdentities applies the HasEdge predicate on the "auth_identities" edge.
|
||||
func HasAuthIdentities() predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, AuthIdentitiesTable, AuthIdentitiesColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasAuthIdentitiesWith applies the HasEdge predicate on the "auth_identities" edge with a given conditions (other predicates).
|
||||
func HasAuthIdentitiesWith(preds ...predicate.AuthIdentity) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := newAuthIdentitiesStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasPendingAuthSessions applies the HasEdge predicate on the "pending_auth_sessions" edge.
|
||||
func HasPendingAuthSessions() predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, PendingAuthSessionsTable, PendingAuthSessionsColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasPendingAuthSessionsWith applies the HasEdge predicate on the "pending_auth_sessions" edge with a given conditions (other predicates).
|
||||
func HasPendingAuthSessionsWith(preds ...predicate.PendingAuthSession) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := newPendingAuthSessionsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasUserAllowedGroups applies the HasEdge predicate on the "user_allowed_groups" edge.
|
||||
func HasUserAllowedGroups() predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
|
||||
Reference in New Issue
Block a user