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
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
@ -21,14 +22,25 @@ type Note struct {
|
||||||
// Raw content of the note. So without additional formatting applied
|
// Raw content of the note. So without additional formatting applied
|
||||||
// Might already have formatting applied beforehand from the origin server
|
// Might already have formatting applied beforehand from the origin server
|
||||||
RawContent string
|
RawContent string
|
||||||
ContentWarning *string // Content warnings of the note, if it contains any
|
ContentWarning sql.NullString // Content warnings of the note, if it contains any
|
||||||
RepliesTo *string // Url of the message this replies to
|
RepliesTo sql.NullString // Url of the message this replies to
|
||||||
Quotes *string // url of the message this note quotes
|
Quotes sql.NullString // url of the message this note quotes
|
||||||
AccessLevel NoteAccessLevel // Where to send this message to (public, home, followers, dm)
|
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
|
AttachmentRelations []NoteToAttachment `gorm:"foreignKey:NoteId"` // Attachments added on to this note
|
||||||
EmoteRelations []NoteToEmote `gorm:"foreignKey:NoteId"` // Emotes used in this note
|
EmoteRelations []NoteToEmote `gorm:"foreignKey:NoteId"` // Emotes used in this note
|
||||||
PingRelations []NoteToPing `gorm:"foreignKey:NoteId"` // Pings/mentions this note performs
|
PingRelations []NoteToPing `gorm:"foreignKey:NoteId"` // Pings/mentions this note performs
|
||||||
Tags []NoteTag `gorm:"foreignKey:NoteId"` // Tags this note contains
|
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