47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
|
package schema
|
||
|
|
||
|
import (
|
||
|
"entgo.io/ent"
|
||
|
"entgo.io/ent/schema/edge"
|
||
|
"entgo.io/ent/schema/field"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// Domain holds the schema definition for the Domain entity.
|
||
|
type Domain struct {
|
||
|
ent.Schema
|
||
|
}
|
||
|
|
||
|
// Fields of the Domain.
|
||
|
func (Domain) 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).Nillable().Optional(),
|
||
|
field.String("domain"),
|
||
|
field.String("description").Nillable().Optional(),
|
||
|
field.Int64("max_aliases"),
|
||
|
field.Int64("max_mailboxes"),
|
||
|
field.Int64("max_quota"),
|
||
|
field.Int64("quota"),
|
||
|
field.String("transport"),
|
||
|
field.Bool("backup_mx"),
|
||
|
field.Bool("active"),
|
||
|
// field.String("homedir").Nillable().Optional(),
|
||
|
// field.String("maildir").Nillable().Optional(),
|
||
|
// field.Int32("uid").Nillable().Optional(),
|
||
|
// field.Int32("gid").Nillable().Optional(),
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// Edges of the Domain.
|
||
|
func (Domain) Edges() []ent.Edge {
|
||
|
return []ent.Edge{
|
||
|
edge.To("mailboxes", Mailbox.Type),
|
||
|
edge.To("aliases", Alias.Type),
|
||
|
edge.To("logs", Logentry.Type),
|
||
|
edge.From("accounts", Account.Type).Ref("domains"),
|
||
|
}
|
||
|
}
|