manager/ent/schema/account.go

35 lines
712 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"time"
)
// 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"),
field.Bytes("password"),
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),
}
}