homebox/backend/ent/schema/location.go
Hayden ca36e3b080
fix: csv-importer (#10)
* update item fields to support import_ref

* add additional rows to CSV importer

* add CSV import documentation

* update readme

* update readme

* fix failed test
2022-09-12 20:54:30 -08:00

39 lines
728 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"github.com/hay-kot/content/backend/ent/schema/mixins"
)
// Location holds the schema definition for the Location entity.
type Location struct {
ent.Schema
}
func (Location) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.BaseMixin{},
mixins.DetailsMixin{},
}
}
// Fields of the Location.
func (Location) Fields() []ent.Field {
return nil
}
// Edges of the Location.
func (Location) Edges() []ent.Edge {
return []ent.Edge{
edge.From("group", Group.Type).
Ref("locations").
Unique().
Required(),
edge.To("items", Item.Type).
Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
}
}