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 // A binding of one note to one media attachment
type NoteToAttachment struct { type NoteToAttachment struct {
ID uint64 `gorm:"primarykey"`
Note Note Note Note
NoteId string NoteId string
Attachment MediaMetadata Attachment MediaMetadata

View file

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

View file

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

View file

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

View file

@ -7,8 +7,10 @@ import "time"
// Technically, that could be used to permanently block someone from logging in // 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 // by starting a new login process every time the target has just started one
type LoginProcessToken struct { type LoginProcessToken struct {
ID uint64 `gorm:"primarykey"`
User User User User
UserId string `gorm:"unique"` 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 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 // Password hashes may only exist at most once per user, the rest 0-m
type UserAuthMethod struct { type UserAuthMethod struct {
ID uint64 `gorm:"primarykey"`
User User User User
UserId string UserId string
AuthMethod AuthenticationMethodType `gorm:"type:auth_method_type"` 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 // Defines an account to be a being of the set type
// Multiple are possible for combination // Multiple are possible for combination
type UserToBeing struct { type UserToBeing struct {
ID uint64 `gorm:"primarykey"`
User User User User
UserId string UserId string
Being BeingType `gorm:"type:being_type"` Being BeingType `gorm:"type:being_type"`

View file

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

View file

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

View file

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

View file

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