Rename cavage singing func, add import for server
All checks were successful
/ docker (push) Successful in 4m1s
All checks were successful
/ docker (push) Successful in 4m1s
This commit is contained in:
parent
5e13817563
commit
08f6de0bd7
39 changed files with 2035 additions and 364 deletions
|
@ -15,6 +15,7 @@ var AllTypes = []any{
|
|||
&Notification{},
|
||||
&Reaction{},
|
||||
&RemoteServer{},
|
||||
&RemoteServerMetadata{},
|
||||
&Role{},
|
||||
&AccessToken{},
|
||||
&LoginProcessToken{},
|
||||
|
|
|
@ -10,10 +10,15 @@ import (
|
|||
// This includes self too
|
||||
type RemoteServer struct {
|
||||
gorm.Model
|
||||
ServerType ServerSoftwareType // What software the server is running. Useful for formatting
|
||||
Domain string // `gorm:"primaryKey"` // Domain the server exists under. Additional primary key
|
||||
Name string // What the server wants to be known as (usually same as url)
|
||||
Icon *MediaMetadata // The icon used by the server. May be empty
|
||||
IconId sql.NullString // ID of a media file
|
||||
IsSelf bool // Whether this server is yours truly
|
||||
// What software type the server is running. Useful for formatting.
|
||||
// Groups various types together (ex. firefish, iceshrimp, sharkey, misskey => misskey)
|
||||
ServerType ServerSoftwareType
|
||||
SpecificType string // Specific type
|
||||
Version string
|
||||
Domain string // `gorm:"primaryKey"` // Domain the server exists under. Additional primary key
|
||||
Name string // What the server wants to be known as (usually same as url)
|
||||
Icon *MediaMetadata // The icon used by the server. May be empty
|
||||
IconId sql.NullString // ID of a media file
|
||||
IsSelf bool // Whether this server is yours truly
|
||||
Metadata []RemoteServerMetadata
|
||||
}
|
||||
|
|
13
storage-new/models/RemoteServerMetadata.go
Normal file
13
storage-new/models/RemoteServerMetadata.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type RemoteServerMetadata struct {
|
||||
gorm.Model
|
||||
RemoteServer RemoteServer
|
||||
RemoteServerId uint
|
||||
Key string
|
||||
Value string
|
||||
}
|
|
@ -25,60 +25,60 @@ type User struct {
|
|||
// identifier for users and other servers, especially when changing the username
|
||||
// (username != display name) might be a future feature
|
||||
// Same also applies for other types that use a UUID as primary key
|
||||
ID string `gorm:"primarykey;default:gen_random_uuid()" json:"id"`
|
||||
ID string `gorm:"primarykey;default:gen_random_uuid()"`
|
||||
// Username of the user (eg "max" if the full username is @max@example.com)
|
||||
// Assume unchangable (once set by a user) to be kind to other implementations
|
||||
// Would be an easy avenue to fuck with them though
|
||||
Username string `gorm:"unique" json:"username"`
|
||||
CreatedAt time.Time ` json:"created_at"` // When this entry was created. Automatically set by gorm
|
||||
Username string `gorm:"unique"`
|
||||
CreatedAt time.Time // When this entry was created. Automatically set by gorm
|
||||
// When this account was last updated. Will also be used for refreshing remote accounts. Automatically set by gorm
|
||||
UpdatedAt time.Time ` json:"updated_at"`
|
||||
UpdatedAt time.Time
|
||||
// When this entry was deleted (for soft deletions)
|
||||
// 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" json:"deleted_at"`
|
||||
Server RemoteServer ` json:"-"`
|
||||
ServerId uint ` json:"server_id"` // Id of the server this user is from, needed for including RemoteServer
|
||||
DisplayName string ` json:"display_name"` // The display name of the user. Can be different from the handle
|
||||
Description string ` json:"description"` // The description of a user account
|
||||
IsBot bool ` json:"is_bot"` // Whether to mark this account as a script controlled one
|
||||
Icon *MediaMetadata ` json:"-"`
|
||||
IconId sql.NullString ` json:"icon_id"` // ID of a media file used as icon
|
||||
Background *MediaMetadata ` json:"-"`
|
||||
BackgroundId sql.NullString ` json:"background_id"` // ID of a media file used as background image
|
||||
Banner *MediaMetadata ` json:"-"`
|
||||
BannerId sql.NullString ` json:"banner_id"` // ID of a media file used as banner
|
||||
Indexable bool ` json:"indexable"` // Whether this account can be found by crawlers
|
||||
PublicKeyRsa []byte ` json:"public_key_rsa"` // The public RSA key of the account
|
||||
PublicKeyEd []byte ` json:"public_key_ed"` // The public Ed25519 key of the account
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
Server RemoteServer
|
||||
ServerId uint // Id of the server this user is from, needed for including RemoteServer
|
||||
DisplayName string // The display name of the user. Can be different from the handle
|
||||
Description string // The description of a user account
|
||||
IsBot bool // Whether to mark this account as a script controlled one
|
||||
Icon *MediaMetadata
|
||||
IconId sql.NullString // ID of a media file used as icon
|
||||
Background *MediaMetadata
|
||||
BackgroundId sql.NullString // ID of a media file used as background image
|
||||
Banner *MediaMetadata
|
||||
BannerId sql.NullString // ID of a media file used as banner
|
||||
Indexable bool // Whether this account can be found by crawlers
|
||||
PublicKeyRsa []byte // The public RSA key of the account
|
||||
PublicKeyEd []byte // The public Ed25519 key of the account
|
||||
// Whether this account restricts following
|
||||
// If true, the owner must approve of a follow request first
|
||||
RestrictedFollow bool ` json:"restricted_follow"`
|
||||
RestrictedFollow bool
|
||||
|
||||
Location sql.NullString `json:"location"`
|
||||
Birthday sql.NullTime `json:"birthday"`
|
||||
Location sql.NullString
|
||||
Birthday sql.NullTime
|
||||
|
||||
// Whether the account got verified and is allowed to be active
|
||||
// For local accounts being active means being allowed to login and perform interactions
|
||||
// For remote users, if an account is not verified, any interactions it sends are discarded
|
||||
Verified bool `json:"verified"`
|
||||
Verified bool
|
||||
// 64 byte unique id for passkeys, because UUIDs are 128 bytes and passkey spec says 64 bytes max
|
||||
// In theory, could also slash Id in half, but that would be a lot more calculations than the
|
||||
// saved space is worth
|
||||
PasskeyId []byte `json:"-"`
|
||||
FinishedRegistration bool `json:"-"` // Whether this account has completed registration yet
|
||||
PrivateKeyRsa []byte `json:"-"`
|
||||
PrivateKeyEd []byte `json:"-"`
|
||||
PasskeyId []byte
|
||||
FinishedRegistration bool // Whether this account has completed registration yet
|
||||
PrivateKeyRsa []byte
|
||||
PrivateKeyEd []byte
|
||||
|
||||
// ---- "Remote" linked values
|
||||
InfoFields []UserInfoField `json:"-"`
|
||||
BeingTypes []UserToBeing `json:"-"`
|
||||
Tags []UserToTag `json:"-"`
|
||||
Relations []UserToUserRelation `json:"-"`
|
||||
Pronouns []UserToPronoun `json:"-"`
|
||||
Roles []UserToRole `json:"-"`
|
||||
RemoteInfo *UserRemoteLinks `json:"-"`
|
||||
AuthMethods []UserAuthMethod `json:"-"`
|
||||
InfoFields []UserInfoField
|
||||
BeingTypes []UserToBeing
|
||||
Tags []UserToTag
|
||||
Relations []UserToUserRelation
|
||||
Pronouns []UserToPronoun
|
||||
Roles []UserToRole
|
||||
RemoteInfo *UserRemoteLinks
|
||||
AuthMethods []UserAuthMethod
|
||||
}
|
||||
|
||||
type IUser interface {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue