35 lines
631 B
Go
35 lines
631 B
Go
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(),
|
|
field.String("description"),
|
|
field.String("url"),
|
|
field.String("image_url"),
|
|
field.String("doc_url"),
|
|
}
|
|
}
|
|
|
|
// Edges of the Project.
|
|
func (Project) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.From("users", User.Type).
|
|
Ref("projects"),
|
|
edge.From("teams", Team.Type).
|
|
Ref("projects"),
|
|
}
|
|
}
|