mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-26 20:40:26 +00:00
add group_id to notifier
This commit is contained in:
parent
43b34e2899
commit
37857682e6
18 changed files with 919 additions and 18 deletions
|
@ -58,5 +58,9 @@ func (Group) Edges() []ent.Edge {
|
|||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
edge.To("notifiers", Notifier.Type).
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ func (Notifier) Mixin() []ent.Mixin {
|
|||
func (Notifier) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.UUID("user_id", uuid.UUID{}),
|
||||
field.UUID("group_id", uuid.UUID{}),
|
||||
field.String("name").
|
||||
MaxLen(255).
|
||||
NotEmpty(),
|
||||
|
@ -44,6 +45,11 @@ func (Notifier) Edges() []ent.Edge {
|
|||
Ref("notifiers").
|
||||
Required().
|
||||
Unique(),
|
||||
edge.From("group", Group.Type).
|
||||
Field("group_id").
|
||||
Ref("notifiers").
|
||||
Required().
|
||||
Unique(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,5 +57,8 @@ func (Notifier) Indexes() []ent.Index {
|
|||
return []ent.Index{
|
||||
index.Fields("user_id"),
|
||||
index.Fields("user_id", "is_active"),
|
||||
|
||||
index.Fields("group_id"),
|
||||
index.Fields("group_id", "is_active"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue