mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-08 19:48:35 +00:00
email improvements
This commit is contained in:
parent
6fd8457e5a
commit
29e30bfaba
47 changed files with 3710 additions and 95 deletions
42
backend/internal/data/ent/schema/actiontoken.go
Normal file
42
backend/internal/data/ent/schema/actiontoken.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
|
||||
"github.com/hay-kot/homebox/backend/internal/data/ent/schema/mixins"
|
||||
)
|
||||
|
||||
type ActionToken struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (ActionToken) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
UserMixin{
|
||||
ref: "action_tokens",
|
||||
field: "user_id",
|
||||
},
|
||||
mixins.BaseMixin{},
|
||||
}
|
||||
}
|
||||
|
||||
// Fields of the ActionToken.
|
||||
func (ActionToken) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Enum("action").
|
||||
Values("reset_password").
|
||||
Default("reset_password"),
|
||||
field.Bytes("token").
|
||||
Unique(),
|
||||
}
|
||||
}
|
||||
|
||||
func (ActionToken) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("token"),
|
||||
index.Fields("action"),
|
||||
index.Fields("user_id"),
|
||||
}
|
||||
}
|
|
@ -52,13 +52,11 @@ func (User) Fields() []ent.Field {
|
|||
func (User) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("auth_tokens", AuthTokens.Type).
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
Annotations(entsql.Annotation{OnDelete: entsql.Cascade}),
|
||||
edge.To("notifiers", Notifier.Type).
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
Annotations(entsql.Annotation{OnDelete: entsql.Cascade}),
|
||||
edge.To("action_tokens", ActionToken.Type).
|
||||
Annotations(entsql.Annotation{OnDelete: entsql.Cascade}),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue