feature: verify tokens

This commit is contained in:
2024-11-17 22:28:29 +05:30
parent 26a00c9f7c
commit 9d40c9d7ec
57 changed files with 4188 additions and 276 deletions

View File

@@ -49,6 +49,8 @@ const (
EdgeSessions = "sessions"
// EdgeAuditLogs holds the string denoting the audit_logs edge name in mutations.
EdgeAuditLogs = "audit_logs"
// EdgeVerifyTokens holds the string denoting the verify_tokens edge name in mutations.
EdgeVerifyTokens = "verify_tokens"
// Table holds the table name of the user in the database.
Table = "users"
// SessionsTable is the table that holds the sessions relation/edge.
@@ -65,6 +67,13 @@ const (
AuditLogsInverseTable = "audits"
// AuditLogsColumn is the table column denoting the audit_logs relation/edge.
AuditLogsColumn = "user_id"
// VerifyTokensTable is the table that holds the verify_tokens relation/edge.
VerifyTokensTable = "verify_tokens"
// VerifyTokensInverseTable is the table name for the VerifyToken entity.
// It exists in this package in order to avoid circular dependency with the "verifytoken" package.
VerifyTokensInverseTable = "verify_tokens"
// VerifyTokensColumn is the table column denoting the verify_tokens relation/edge.
VerifyTokensColumn = "user_id"
)
// Columns holds all SQL columns for user fields.
@@ -263,6 +272,20 @@ func ByAuditLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
sqlgraph.OrderByNeighborTerms(s, newAuditLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByVerifyTokensCount orders the results by verify_tokens count.
func ByVerifyTokensCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newVerifyTokensStep(), opts...)
}
}
// ByVerifyTokens orders the results by verify_tokens terms.
func ByVerifyTokens(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newVerifyTokensStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newSessionsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
@@ -277,3 +300,10 @@ func newAuditLogsStep() *sqlgraph.Step {
sqlgraph.Edge(sqlgraph.O2M, false, AuditLogsTable, AuditLogsColumn),
)
}
func newVerifyTokensStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(VerifyTokensInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, VerifyTokensTable, VerifyTokensColumn),
)
}