end-to-end testing setup

This commit is contained in:
Hayden 2022-09-03 18:42:03 -08:00
parent b4eb7d8ddc
commit ad4c8c9ab4
41 changed files with 544 additions and 313 deletions

View file

@ -2,6 +2,7 @@ package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/hay-kot/content/backend/ent/schema/mixins"
@ -33,9 +34,17 @@ func (Group) Fields() []ent.Field {
// Edges of the Home.
func (Group) Edges() []ent.Edge {
return []ent.Edge{
edge.To("users", User.Type),
edge.To("locations", Location.Type),
edge.To("items", Item.Type),
edge.To("labels", Label.Type),
edge.To("users", User.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
edge.To("locations", Location.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
edge.To("items", Item.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
edge.To("labels", Label.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
}
}

View file

@ -2,6 +2,7 @@ package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/google/uuid"
@ -73,7 +74,9 @@ func (Item) Edges() []ent.Edge {
edge.From("location", Location.Type).
Ref("items").
Unique(),
edge.To("fields", ItemField.Type),
edge.To("fields", ItemField.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
edge.From("label", Label.Type).
Ref("items"),
}

View file

@ -2,6 +2,7 @@ package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/hay-kot/content/backend/ent/schema/mixins"
@ -44,6 +45,8 @@ func (User) Edges() []ent.Edge {
Ref("users").
Required().
Unique(),
edge.To("auth_tokens", AuthTokens.Type),
edge.To("auth_tokens", AuthTokens.Type).Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
}
}