versia-go/ent/schema/attachment.go

43 lines
739 B
Go
Raw Normal View History

2024-08-11 03:51:22 +02:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
type Attachment struct{ ent.Schema }
func (Attachment) Fields() []ent.Field {
return []ent.Field{
field.String("description").MaxLen(384),
field.Bytes("sha256"),
field.Int("size"),
2024-08-20 22:43:26 +02:00
field.String("blurhash").
Optional().
Nillable(),
field.Int("height").
Optional().
Nillable(),
field.Int("width").
Optional().
Nillable(),
field.Int("fps").
Optional().
Nillable(),
2024-08-11 03:51:22 +02:00
field.String("mimeType"),
}
}
func (Attachment) Edges() []ent.Edge {
return []ent.Edge{
edge.To("author", User.Type).Unique().Required(),
}
}
func (Attachment) Mixin() []ent.Mixin {
return []ent.Mixin{LysandEntityMixin{}}
}