telegram-commerce/ent/schema/businesscategory.go
2023-10-26 01:24:32 +03:30

32 lines
619 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.String("description").
Default("unknown"),
}
}
// Edges of the BusinessCategory.
func (BusinessCategory) Edges() []ent.Edge {
return []ent.Edge{
edge.To("businesses", Business.Type),
}
}