saasitone/ent/schema/passwordtoken.go
2021-12-17 21:10:35 -05:00

35 lines
592 B
Go

package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// PasswordToken holds the schema definition for the PasswordToken entity.
type PasswordToken struct {
ent.Schema
}
// Fields of the PasswordToken.
func (PasswordToken) Fields() []ent.Field {
return []ent.Field{
field.String("hash").
Sensitive().
NotEmpty(),
field.Time("created_at").
Default(time.Now),
}
}
// Edges of the PasswordToken.
func (PasswordToken) Edges() []ent.Edge {
return []ent.Edge{
edge.To("user", User.Type).
Required().
Unique(),
}
}