7c69f163b6
This reverts commit a1b93c0eba.
35 lines
642 B
Go
35 lines
642 B
Go
package schema
|
|
|
|
import (
|
|
"git.gorlug.de/code/golang/ersteller-lib/schema/ent"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
type Group struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (Group) Mixin() []ent.Mixin {
|
|
return []ent.Mixin{
|
|
ersteller_ent.TimeMixin{},
|
|
}
|
|
}
|
|
|
|
func (Group) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("name").Default(""),
|
|
}
|
|
}
|
|
|
|
func (Group) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
// Back-reference to users that belong to this group
|
|
edge.From("users", User.Type).Ref("group"),
|
|
// Back-reference to todos that belong to this group
|
|
edge.From("todos", Todo.Type).Ref("group"),
|
|
}
|
|
}
|