mirror of
https://github.com/versia-pub/versia-go.git
synced 2025-12-06 06:28:18 +01:00
35 lines
707 B
Go
35 lines
707 B
Go
|
|
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"),
|
||
|
|
|
||
|
|
field.String("blurhash").Optional().Nillable(),
|
||
|
|
field.Int("height").Optional().Nillable(),
|
||
|
|
field.Int("width").Optional().Nillable(),
|
||
|
|
field.Int("fps").Optional().Nillable(),
|
||
|
|
|
||
|
|
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{}}
|
||
|
|
}
|