30 lines
585 B
Go
30 lines
585 B
Go
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(),
|
|
}
|
|
}
|