This commit is contained in:
parent
08f6de0bd7
commit
5e93ecee73
12 changed files with 241 additions and 109 deletions
|
@ -55,12 +55,14 @@ type User struct {
|
|||
// If true, the owner must approve of a follow request first
|
||||
RestrictedFollow bool
|
||||
|
||||
// Technically should be a timestamp, but can't trust other implementations
|
||||
// to enforce this in a consistent format
|
||||
Birthday sql.NullString
|
||||
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
|
||||
// No impact on remote accounts
|
||||
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
|
||||
|
@ -71,14 +73,15 @@ type User struct {
|
|||
PrivateKeyEd []byte
|
||||
|
||||
// ---- "Remote" linked values
|
||||
InfoFields []UserInfoField
|
||||
BeingTypes []UserToBeing
|
||||
Tags []UserToTag
|
||||
Relations []UserToUserRelation
|
||||
Pronouns []UserToPronoun
|
||||
Roles []UserToRole
|
||||
RemoteInfo *UserRemoteLinks
|
||||
AuthMethods []UserAuthMethod
|
||||
InfoFields []UserInfoField
|
||||
BeingTypes []UserToBeing
|
||||
Tags []UserToTag
|
||||
Relations []UserToUserRelation
|
||||
Pronouns []UserToPronoun
|
||||
Roles []UserToRole
|
||||
RemoteInfo *UserRemoteLinks
|
||||
RemoteInfoId sql.NullInt64
|
||||
AuthMethods []UserAuthMethod
|
||||
}
|
||||
|
||||
type IUser interface {
|
||||
|
|
|
@ -21,7 +21,7 @@ const (
|
|||
var AllBeings = []BeingType{BEING_HUMAN, BEING_CAT, BEING_FOX, BEING_DOG, BEING_ROBOT, BEING_DOLL}
|
||||
|
||||
func (ct *BeingType) Scan(value any) error {
|
||||
*ct = BeingType(value.([]byte))
|
||||
*ct = BeingType(value.(string))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@ type UserToBeing struct {
|
|||
ID uint64 `gorm:"primarykey"`
|
||||
User User
|
||||
UserId string
|
||||
Being BeingType `gorm:"type:being_type"`
|
||||
Being string
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package models
|
||||
|
||||
import "gorm.io/gorm"
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// UserRemoteLinks contains cached links for remote users
|
||||
type UserRemoteLinks struct {
|
||||
|
@ -13,11 +17,11 @@ type UserRemoteLinks struct {
|
|||
// Just about every link here is optional to accomodate for servers with only minimal accounts
|
||||
// Minimal being handle, ap link and inbox
|
||||
ApLink string
|
||||
ViewLink *string
|
||||
FollowersLink *string
|
||||
FollowingLink *string
|
||||
ViewLink sql.NullString
|
||||
FollowersLink sql.NullString
|
||||
FollowingLink sql.NullString
|
||||
InboxLink string
|
||||
OutboxLink *string
|
||||
FeaturedLink *string
|
||||
FeaturedTagsLink *string
|
||||
OutboxLink sql.NullString
|
||||
FeaturedLink sql.NullString
|
||||
FeaturedTagsLink sql.NullString
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue