Add initial feed structure, fix passkey id usage
This commit is contained in:
parent
ef91558600
commit
420f6e46c0
6 changed files with 162 additions and 118 deletions
|
@ -1,11 +1,14 @@
|
|||
package models
|
||||
|
||||
// Just a list of all models stored in the database
|
||||
var AllTypes = []any{
|
||||
&Emote{},
|
||||
&Feed{},
|
||||
&MediaMetadata{},
|
||||
&Note{},
|
||||
&NoteToAttachment{},
|
||||
&NoteToEmote{},
|
||||
&NoteToFeed{},
|
||||
&NoteToPing{},
|
||||
&NoteTag{},
|
||||
&Reaction{},
|
||||
|
|
32
storage-new/models/Feed.go
Normal file
32
storage-new/models/Feed.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// A feed is the initial entry point for all inbound Activitypub events.
|
||||
// However, its primary and only user-facing use case is to be a collection
|
||||
// of inbound messages, nothing else.
|
||||
//
|
||||
// Thus, the flow for inbound events is the following:
|
||||
// If the event is a note:
|
||||
//
|
||||
// Add it to the receiving feed. If it's a reply and the feed is a default
|
||||
// create a notification for the owner
|
||||
//
|
||||
// If it's an event:
|
||||
//
|
||||
// If the feed is not a default feed for a user, discard the event
|
||||
// If it is the default feed for a user, create a notification for the owner
|
||||
type Feed struct {
|
||||
gorm.Model
|
||||
Name string
|
||||
Owner User
|
||||
OwnerId string
|
||||
IsDefault bool // Whether the feed is the default one for the user
|
||||
// If a feed is the default one for a user, use that user's public key.
|
||||
// Otherwise, use its own key
|
||||
PublicKey sql.NullString
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package models
|
||||
|
||||
// TODO: Struct for mapping a note to a user for their personal feed
|
||||
// Storing timeline info in redis could also be an idea, but I kinda like
|
||||
// everything being in one place
|
29
storage-new/models/NoteToFeed.go
Normal file
29
storage-new/models/NoteToFeed.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TODO: Struct for mapping a note to a user for their personal feed
|
||||
// Storing timeline info in redis could also be an idea, but I kinda like
|
||||
// everything being in one place
|
||||
// Data needed:
|
||||
// - Which note
|
||||
// - Who's feed
|
||||
// - Which feed (once separate feeds are implemented)
|
||||
// - Reason:
|
||||
// - Boost
|
||||
// - Follow person
|
||||
// - Follow tag
|
||||
//
|
||||
// Also need to store the boosts a user has performed somewhere
|
||||
// Maybe adjust Reaction? Though a separate table might be a better option
|
||||
|
||||
// Assigns a note to a feed
|
||||
type NoteToFeed struct {
|
||||
ID uint64 `gorm:"primarykey"`
|
||||
CreatedAt time.Time
|
||||
Note Note
|
||||
NoteId string
|
||||
// Feed Feed
|
||||
// FeedId uint64
|
||||
// Reason AppearanceReason
|
||||
}
|
|
@ -10,15 +10,8 @@ import (
|
|||
// A user describes an account for creating content.
|
||||
// This may be controlled by either a human or some external script
|
||||
//
|
||||
// Data stored in external types:
|
||||
// - Custom info fields
|
||||
// - Being types
|
||||
// - Tags
|
||||
// - Relations
|
||||
// - Pronouns
|
||||
// - Roles
|
||||
// - AP remote links
|
||||
// - Auth methods and tokens (hashed pw, totp key, passkey id)
|
||||
// Data stored externally:
|
||||
// - Feed connections (which note belongs in the feed of this user, for what reason)
|
||||
type User struct {
|
||||
// ID is a uuid for this account
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue