online-order/ent/schema/businesscategory.go

32 lines
619 B
Go
Raw Normal View History

2023-10-27 09:51:58 +00:00
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.String("description").
Default("unknown"),
}
}
// Edges of the BusinessCategory.
func (BusinessCategory) Edges() []ent.Edge {
return []ent.Edge{
edge.To("businesses", Business.Type),
}
}