19 lines
707 B
Go
19 lines
707 B
Go
package models
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
type Media struct {
|
|
bun.BaseModel `bun:"table:media"`
|
|
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()" json:"id"`
|
|
AuthorID uuid.UUID `bun:"author_id,type:uuid,notnull" json:"authorID"`
|
|
Author *User `bun:"rel:belongs-to,join:author_id=user_id" json:"author,omitempty"`
|
|
Type string `bun:"media_type" json:"type"` // Image, Video, GIF etc. Add support for PDFs?
|
|
Alt string `bun:"media_alt" json:"alt"`
|
|
Path string `bun:"media_path" json:"path"`
|
|
Size int64 `bun:"media_size" json:"size"`
|
|
URL string `bun:"-" json:"url"`
|
|
}
|