Remove default stuff from models

This commit is contained in:
Melody Becker 2025-04-05 22:01:00 +02:00
parent a943f229e6
commit 3f5df241db
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
2 changed files with 3 additions and 27 deletions

View file

@ -1,6 +1,7 @@
package models
import (
"database/sql"
"time"
"gorm.io/gorm"
@ -18,7 +19,8 @@ type MediaMetadata struct {
// Soft delete means that this entry still exists in the db, but gorm won't include it anymore unless specifically told to
// If not null, this entry is marked as deleted
DeletedAt gorm.DeletedAt `gorm:"index"`
OwnedById string // Account id this media belongs to
// OwnedBy User
OwnedById sql.NullString // Account id this media belongs to
Remote bool // whether the attachment is a remote one
// Where the media is stored. Url
Location string
@ -37,14 +39,3 @@ type MediaMetadata struct {
// or embedded data, such as the default duck
// For external users, transform them into normal http URIs with a "special" path
const DefaultDuckLocationName = "linstrom://default-media"
var DefaultDuckMedia = MediaMetadata{
ID: "3b562a45-36b7-4c42-a944-3672f319ff7b",
OwnedById: "", // FIXME: Add default user ID here
Remote: false,
Location: DefaultDuckLocationName,
Type: "image/webp",
Name: "default-duck.webp",
AltText: "a greyscale image of a pidgeon on some smooth surface, likely a liquid. It is captioned with the text \"Duck\"",
Blurred: false,
}

View file

@ -3,7 +3,6 @@ package models
import (
"database/sql"
"git.mstar.dev/mstar/linstrom/config"
"gorm.io/gorm"
)
@ -18,17 +17,3 @@ type RemoteServer struct {
IconId sql.NullString // ID of a media file
IsSelf bool // Whether this server is yours truly
}
func BuildDefaultServer() *RemoteServer {
return &RemoteServer{
Model: gorm.Model{
ID: 1,
},
ServerType: ServerSoftwareLinstrom,
Domain: config.GlobalConfig.General.GetFullDomain(),
Name: config.GlobalConfig.Self.ServerDisplayName,
Icon: &DefaultDuckMedia,
IconId: sql.NullString{String: DefaultDuckMedia.ID, Valid: true},
IsSelf: true,
}
}