feat: rebuild auth identity foundation flow

This commit is contained in:
IanShaw027
2026-04-20 17:39:57 +08:00
parent fbd0a2e3c4
commit e9de839d87
123 changed files with 33599 additions and 772 deletions

View File

@@ -0,0 +1,159 @@
// Code generated by ent, DO NOT EDIT.
package identityadoptiondecision
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the identityadoptiondecision type in the database.
Label = "identity_adoption_decision"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldPendingAuthSessionID holds the string denoting the pending_auth_session_id field in the database.
FieldPendingAuthSessionID = "pending_auth_session_id"
// FieldIdentityID holds the string denoting the identity_id field in the database.
FieldIdentityID = "identity_id"
// FieldAdoptDisplayName holds the string denoting the adopt_display_name field in the database.
FieldAdoptDisplayName = "adopt_display_name"
// FieldAdoptAvatar holds the string denoting the adopt_avatar field in the database.
FieldAdoptAvatar = "adopt_avatar"
// FieldDecidedAt holds the string denoting the decided_at field in the database.
FieldDecidedAt = "decided_at"
// EdgePendingAuthSession holds the string denoting the pending_auth_session edge name in mutations.
EdgePendingAuthSession = "pending_auth_session"
// EdgeIdentity holds the string denoting the identity edge name in mutations.
EdgeIdentity = "identity"
// Table holds the table name of the identityadoptiondecision in the database.
Table = "identity_adoption_decisions"
// PendingAuthSessionTable is the table that holds the pending_auth_session relation/edge.
PendingAuthSessionTable = "identity_adoption_decisions"
// PendingAuthSessionInverseTable is the table name for the PendingAuthSession entity.
// It exists in this package in order to avoid circular dependency with the "pendingauthsession" package.
PendingAuthSessionInverseTable = "pending_auth_sessions"
// PendingAuthSessionColumn is the table column denoting the pending_auth_session relation/edge.
PendingAuthSessionColumn = "pending_auth_session_id"
// IdentityTable is the table that holds the identity relation/edge.
IdentityTable = "identity_adoption_decisions"
// IdentityInverseTable is the table name for the AuthIdentity entity.
// It exists in this package in order to avoid circular dependency with the "authidentity" package.
IdentityInverseTable = "auth_identities"
// IdentityColumn is the table column denoting the identity relation/edge.
IdentityColumn = "identity_id"
)
// Columns holds all SQL columns for identityadoptiondecision fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldPendingAuthSessionID,
FieldIdentityID,
FieldAdoptDisplayName,
FieldAdoptAvatar,
FieldDecidedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// 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
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultAdoptDisplayName holds the default value on creation for the "adopt_display_name" field.
DefaultAdoptDisplayName bool
// DefaultAdoptAvatar holds the default value on creation for the "adopt_avatar" field.
DefaultAdoptAvatar bool
// DefaultDecidedAt holds the default value on creation for the "decided_at" field.
DefaultDecidedAt func() time.Time
)
// OrderOption defines the ordering options for the IdentityAdoptionDecision queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByPendingAuthSessionID orders the results by the pending_auth_session_id field.
func ByPendingAuthSessionID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPendingAuthSessionID, opts...).ToFunc()
}
// ByIdentityID orders the results by the identity_id field.
func ByIdentityID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIdentityID, opts...).ToFunc()
}
// ByAdoptDisplayName orders the results by the adopt_display_name field.
func ByAdoptDisplayName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAdoptDisplayName, opts...).ToFunc()
}
// ByAdoptAvatar orders the results by the adopt_avatar field.
func ByAdoptAvatar(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAdoptAvatar, opts...).ToFunc()
}
// ByDecidedAt orders the results by the decided_at field.
func ByDecidedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDecidedAt, opts...).ToFunc()
}
// ByPendingAuthSessionField orders the results by pending_auth_session field.
func ByPendingAuthSessionField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPendingAuthSessionStep(), sql.OrderByField(field, opts...))
}
}
// ByIdentityField orders the results by identity field.
func ByIdentityField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newIdentityStep(), sql.OrderByField(field, opts...))
}
}
func newPendingAuthSessionStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PendingAuthSessionInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, PendingAuthSessionTable, PendingAuthSessionColumn),
)
}
func newIdentityStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(IdentityInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, IdentityTable, IdentityColumn),
)
}

View File

@@ -0,0 +1,342 @@
// Code generated by ent, DO NOT EDIT.
package identityadoptiondecision
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLTE(FieldID, id))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldUpdatedAt, v))
}
// PendingAuthSessionID applies equality check predicate on the "pending_auth_session_id" field. It's identical to PendingAuthSessionIDEQ.
func PendingAuthSessionID(v int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldPendingAuthSessionID, v))
}
// IdentityID applies equality check predicate on the "identity_id" field. It's identical to IdentityIDEQ.
func IdentityID(v int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldIdentityID, v))
}
// AdoptDisplayName applies equality check predicate on the "adopt_display_name" field. It's identical to AdoptDisplayNameEQ.
func AdoptDisplayName(v bool) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldAdoptDisplayName, v))
}
// AdoptAvatar applies equality check predicate on the "adopt_avatar" field. It's identical to AdoptAvatarEQ.
func AdoptAvatar(v bool) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldAdoptAvatar, v))
}
// DecidedAt applies equality check predicate on the "decided_at" field. It's identical to DecidedAtEQ.
func DecidedAt(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldDecidedAt, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLTE(FieldUpdatedAt, v))
}
// PendingAuthSessionIDEQ applies the EQ predicate on the "pending_auth_session_id" field.
func PendingAuthSessionIDEQ(v int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldPendingAuthSessionID, v))
}
// PendingAuthSessionIDNEQ applies the NEQ predicate on the "pending_auth_session_id" field.
func PendingAuthSessionIDNEQ(v int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldPendingAuthSessionID, v))
}
// PendingAuthSessionIDIn applies the In predicate on the "pending_auth_session_id" field.
func PendingAuthSessionIDIn(vs ...int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIn(FieldPendingAuthSessionID, vs...))
}
// PendingAuthSessionIDNotIn applies the NotIn predicate on the "pending_auth_session_id" field.
func PendingAuthSessionIDNotIn(vs ...int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotIn(FieldPendingAuthSessionID, vs...))
}
// IdentityIDEQ applies the EQ predicate on the "identity_id" field.
func IdentityIDEQ(v int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldIdentityID, v))
}
// IdentityIDNEQ applies the NEQ predicate on the "identity_id" field.
func IdentityIDNEQ(v int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldIdentityID, v))
}
// IdentityIDIn applies the In predicate on the "identity_id" field.
func IdentityIDIn(vs ...int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIn(FieldIdentityID, vs...))
}
// IdentityIDNotIn applies the NotIn predicate on the "identity_id" field.
func IdentityIDNotIn(vs ...int64) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotIn(FieldIdentityID, vs...))
}
// IdentityIDIsNil applies the IsNil predicate on the "identity_id" field.
func IdentityIDIsNil() predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIsNull(FieldIdentityID))
}
// IdentityIDNotNil applies the NotNil predicate on the "identity_id" field.
func IdentityIDNotNil() predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotNull(FieldIdentityID))
}
// AdoptDisplayNameEQ applies the EQ predicate on the "adopt_display_name" field.
func AdoptDisplayNameEQ(v bool) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldAdoptDisplayName, v))
}
// AdoptDisplayNameNEQ applies the NEQ predicate on the "adopt_display_name" field.
func AdoptDisplayNameNEQ(v bool) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldAdoptDisplayName, v))
}
// AdoptAvatarEQ applies the EQ predicate on the "adopt_avatar" field.
func AdoptAvatarEQ(v bool) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldAdoptAvatar, v))
}
// AdoptAvatarNEQ applies the NEQ predicate on the "adopt_avatar" field.
func AdoptAvatarNEQ(v bool) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldAdoptAvatar, v))
}
// DecidedAtEQ applies the EQ predicate on the "decided_at" field.
func DecidedAtEQ(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldEQ(FieldDecidedAt, v))
}
// DecidedAtNEQ applies the NEQ predicate on the "decided_at" field.
func DecidedAtNEQ(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNEQ(FieldDecidedAt, v))
}
// DecidedAtIn applies the In predicate on the "decided_at" field.
func DecidedAtIn(vs ...time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldIn(FieldDecidedAt, vs...))
}
// DecidedAtNotIn applies the NotIn predicate on the "decided_at" field.
func DecidedAtNotIn(vs ...time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldNotIn(FieldDecidedAt, vs...))
}
// DecidedAtGT applies the GT predicate on the "decided_at" field.
func DecidedAtGT(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGT(FieldDecidedAt, v))
}
// DecidedAtGTE applies the GTE predicate on the "decided_at" field.
func DecidedAtGTE(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldGTE(FieldDecidedAt, v))
}
// DecidedAtLT applies the LT predicate on the "decided_at" field.
func DecidedAtLT(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLT(FieldDecidedAt, v))
}
// DecidedAtLTE applies the LTE predicate on the "decided_at" field.
func DecidedAtLTE(v time.Time) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.FieldLTE(FieldDecidedAt, v))
}
// HasPendingAuthSession applies the HasEdge predicate on the "pending_auth_session" edge.
func HasPendingAuthSession() predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, PendingAuthSessionTable, PendingAuthSessionColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasPendingAuthSessionWith applies the HasEdge predicate on the "pending_auth_session" edge with a given conditions (other predicates).
func HasPendingAuthSessionWith(preds ...predicate.PendingAuthSession) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(func(s *sql.Selector) {
step := newPendingAuthSessionStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasIdentity applies the HasEdge predicate on the "identity" edge.
func HasIdentity() predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, IdentityTable, IdentityColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasIdentityWith applies the HasEdge predicate on the "identity" edge with a given conditions (other predicates).
func HasIdentityWith(preds ...predicate.AuthIdentity) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(func(s *sql.Selector) {
step := newIdentityStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.IdentityAdoptionDecision) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.IdentityAdoptionDecision) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.IdentityAdoptionDecision) predicate.IdentityAdoptionDecision {
return predicate.IdentityAdoptionDecision(sql.NotPredicates(p))
}