manager/ent/schema/account.go

36 lines
725 B
Go
Raw Normal View History

2022-04-08 21:23:41 +02:00
package schema
import (
2022-05-22 14:56:45 +02:00
"time"
2022-04-08 21:23:41 +02:00
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Account holds the schema definition for the Account entity.
type Account struct {
ent.Schema
}
// Fields of the Account.
func (Account) Fields() []ent.Field {
return []ent.Field{
field.Int64("id"),
field.Time("created").Default(time.Now).Immutable(),
field.Time("modified").Default(time.Now).UpdateDefault(time.Now).Optional(),
field.String("username"),
2022-05-22 14:56:45 +02:00
field.Bytes("password").Sensitive(),
2022-04-08 21:23:41 +02:00
field.Bool("super"),
field.Bool("active"),
}
}
// Edges of the Account.
func (Account) Edges() []ent.Edge {
return []ent.Edge{
edge.To("domains", Domain.Type),
edge.To("logs", Logentry.Type),
}
}