30 lines
481 B
Go
Raw Normal View History

2024-02-14 13:08:27 +01:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Team holds the schema definition for the Team entity.
type Team struct {
ent.Schema
}
// Fields of the Team.
func (Team) Fields() []ent.Field {
return []ent.Field{
2024-05-19 17:49:20 +02:00
field.String("name").
Unique(),
2024-02-14 13:08:27 +01:00
}
}
// Edges of the Team.
func (Team) Edges() []ent.Edge {
return []ent.Edge{
2024-05-19 17:04:15 +02:00
edge.To("projects", Project.Type),
edge.From("users", User.Type).
Ref("teams"),
2024-02-14 13:08:27 +01:00
}
}