online-order/ent/schema/businesscategory.go
2023-10-29 02:42:07 +03:30

29 lines
605 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// BusinessCategory holds the schema definition for the BusinessCategory entity.
type BusinessCategory struct {
ent.Schema
}
// Fields of the BusinessCategory.
func (BusinessCategory) Fields() []ent.Field {
return []ent.Field{
field.String("slug").Unique(),
field.String("name").Default("unknown"),
field.Text("description").Default("unknown"),
}
}
// Edges of the BusinessCategory.
func (BusinessCategory) Edges() []ent.Edge {
return []ent.Edge{
edge.To("businesses", Business.Type),
}
}