Fix optional types and access func
This commit is contained in:
parent
fb95ee48cc
commit
b0db12490c
1 changed files with 16 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
@ -21,14 +22,25 @@ type Note struct {
|
|||
// Raw content of the note. So without additional formatting applied
|
||||
// Might already have formatting applied beforehand from the origin server
|
||||
RawContent string
|
||||
ContentWarning *string // Content warnings of the note, if it contains any
|
||||
RepliesTo *string // Url of the message this replies to
|
||||
Quotes *string // url of the message this note quotes
|
||||
ContentWarning sql.NullString // Content warnings of the note, if it contains any
|
||||
RepliesTo sql.NullString // Url of the message this replies to
|
||||
Quotes sql.NullString // url of the message this note quotes
|
||||
AccessLevel NoteAccessLevel // Where to send this message to (public, home, followers, dm)
|
||||
OriginServer string // Url of the origin server. Also the primary key for those
|
||||
Origin RemoteServer
|
||||
OriginId uint
|
||||
|
||||
AttachmentRelations []NoteToAttachment `gorm:"foreignKey:NoteId"` // Attachments added on to this note
|
||||
EmoteRelations []NoteToEmote `gorm:"foreignKey:NoteId"` // Emotes used in this note
|
||||
PingRelations []NoteToPing `gorm:"foreignKey:NoteId"` // Pings/mentions this note performs
|
||||
Tags []NoteTag `gorm:"foreignKey:NoteId"` // Tags this note contains
|
||||
}
|
||||
|
||||
type INote interface {
|
||||
// Get all notes by a user, paged, that are a specific access level.
|
||||
// Ordered by age, descending (newest first)
|
||||
//
|
||||
// SELECT * FROM @@table
|
||||
// WHERE creator_id = @userId AND access_level = @accessLevel
|
||||
// ORDER BY created_at DESC LIMIT 50 OFFSET @pageNr * 50
|
||||
GetNotesPaged(userId string, pageNr uint, accessLevel uint8) ([]Note, error)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue