Add IDs to the various connector structs

This commit is contained in:
Melody Becker 2025-03-31 15:23:24 +02:00
parent 582988add2
commit c9e1881f55
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
11 changed files with 13 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package models
// A binding of one note to one media attachment
type NoteToAttachment struct {
ID uint64 `gorm:"primarykey"`
Note Note
NoteId string
Attachment MediaMetadata

View file

@ -2,6 +2,7 @@ package models
// A binding of one note to one emote
type NoteToEmote struct {
ID uint64 `gorm:"primarykey"`
Note Note
NoteId string
Emote Emote

View file

@ -2,6 +2,7 @@ package models
// A binding of one note to one mentioned account
type NoteToPing struct {
ID uint64 `gorm:"primarykey"`
Note Note
NoteId string
PingTarget User

View file

@ -2,6 +2,7 @@ package models
// A binding of one note to one string (hash)tag
type NoteTag struct {
ID uint64 `gorm:"primarykey"`
Note Note
NoteId string
Tag string

View file

@ -7,8 +7,10 @@ import "time"
// Technically, that could be used to permanently block someone from logging in
// by starting a new login process every time the target has just started one
type LoginProcessToken struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string `gorm:"unique"`
Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
Token string `gorm:"type:uuid;default:gen_random_uuid()"`
Name string
ExpiresAt time.Time
}

View file

@ -8,6 +8,7 @@ package models
//
// Password hashes may only exist at most once per user, the rest 0-m
type UserAuthMethod struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string
AuthMethod AuthenticationMethodType `gorm:"type:auth_method_type"`

View file

@ -3,6 +3,7 @@ package models
// Defines an account to be a being of the set type
// Multiple are possible for combination
type UserToBeing struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string
Being BeingType `gorm:"type:being_type"`

View file

@ -3,6 +3,7 @@ package models
// A (hash)tag appearing on an account's profile description
// Accounts may have multiple tags, but each tag may only be stored once at most
type UserToTag struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string
Tag string

View file

@ -1,6 +1,7 @@
package models
type UserToPronoun struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string
Pronoung string

View file

@ -4,6 +4,7 @@ package models
// There may be multiple of these links per user and per role
// But a role may only be linked at most once to the same user
type UserToRole struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string
Role Role

View file

@ -4,6 +4,7 @@ package models
// There may be multiple relations from an account X to an account Y,
// each describing a different aspect
type UserToUserRelation struct {
ID uint64 `gorm:"primarykey"`
User User
UserId string
TargetUser User