summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/mediaattachment.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-09-20 17:41:52 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-20 17:41:52 +0200
commitc7c9fff730d68bcddcd9d43614f744e91e1dd966 (patch)
treee689ab0bc13adcb945d56a083a79f8e6f9a12559 /internal/gtsmodel/mediaattachment.go
parentUpdate webfingering a little, add tests (#236) (diff)
downloadgotosocial-c7c9fff730d68bcddcd9d43614f744e91e1dd966.tar.xz
use timestamptz instead of timestamp (#237)
Diffstat (limited to 'internal/gtsmodel/mediaattachment.go')
-rw-r--r--internal/gtsmodel/mediaattachment.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/internal/gtsmodel/mediaattachment.go b/internal/gtsmodel/mediaattachment.go
index 4c7e0f843..5d4af8e68 100644
--- a/internal/gtsmodel/mediaattachment.go
+++ b/internal/gtsmodel/mediaattachment.go
@@ -26,8 +26,8 @@ import (
// somewhere in storage and that can be retrieved and served by the router.
type MediaAttachment struct {
ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
- CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created
- UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated
+ CreatedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
+ UpdatedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
StatusID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // ID of the status to which this is attached
URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on *this* server
RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media)
@@ -47,20 +47,20 @@ type MediaAttachment struct {
// File refers to the metadata for the whole file
type File struct {
- Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage.
- ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file.
- FileSize int `validate:"required" bun:",notnull"` // File size in bytes
- UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
+ Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage.
+ ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file.
+ FileSize int `validate:"required" bun:",notnull"` // File size in bytes
+ UpdatedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
}
// Thumbnail refers to a small image thumbnail derived from a larger image, video, or audio file.
type Thumbnail struct {
- Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage.
- ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file.
- FileSize int `validate:"required" bun:",notnull"` // File size in bytes
- UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
- URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // What is the URL of the thumbnail on the local server
- RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // What is the remote URL of the thumbnail (empty for local media)
+ Path string `validate:"required,file" bun:",nullzero,notnull"` // Path of the file in storage.
+ ContentType string `validate:"required" bun:",nullzero,notnull"` // MIME content type of the file.
+ FileSize int `validate:"required" bun:",notnull"` // File size in bytes
+ UpdatedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
+ URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // What is the URL of the thumbnail on the local server
+ RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // What is the remote URL of the thumbnail (empty for local media)
}
// ProcessingStatus refers to how far along in the processing stage the attachment is.