portfolio/ent/schema/project.go

30 lines
480 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"
)
// Project holds the schema definition for the Project entity.
type Project struct {
ent.Schema
}
// Fields of the Project.
func (Project) Fields() []ent.Field {
return []ent.Field{
field.String("name").
Unique(),
}
}
// Edges of the Project.
func (Project) Edges() []ent.Edge {
return []ent.Edge{
edge.From("team", Team.Type).
Ref("projects").
Unique(),
}
}