rano/db/ent/schema/verifyToken.go

30 lines
585 B
Go
Raw Permalink Normal View History

2024-11-17 16:58:29 +00:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Verify holds the schema definition for the Verify entity.
type VerifyToken struct {
ent.Schema
}
// Fields of the Verify.
func (VerifyToken) Fields() []ent.Field {
return []ent.Field{
fieldID,
fieldCreated,
field.Time("expires_at").Immutable(),
field.String("token").MaxLen(50).Unique(),
field.String("purpose").MaxLen(50).Optional(),
}
}
func (VerifyToken) Edges() []ent.Edge {
return []ent.Edge{
edge.From("user", User.Type).Ref("verify_tokens").Unique(),
}
}