36 lines
725 B
Go
36 lines
725 B
Go
package schema
|
|
|
|
import (
|
|
"time"
|
|
|
|
"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"),
|
|
field.Bytes("password").Sensitive(),
|
|
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),
|
|
}
|
|
}
|