hmn/src/models/post.go

57 lines
1.4 KiB
Go
Raw Normal View History

package models
import (
"net"
"time"
)
type Post struct {
ID int `db:"id"`
// TODO: Document each of these
AuthorID *int `db:"author_id"`
CategoryID int `db:"category_id"`
ParentID *int `db:"parent_id"`
2021-04-27 01:49:46 +00:00
ThreadID int `db:"thread_id"`
CurrentID int `db:"current_id"`
2021-04-27 01:49:46 +00:00
ProjectID int `db:"project_id"`
CategoryType CategoryType `db:"category_kind"`
Depth int `db:"depth"`
Slug string `db:"slug"`
2021-04-22 23:02:50 +00:00
AuthorName string `db:"author_name"` // TODO: Drop this.
PostDate time.Time `db:"postdate"`
IP net.IPNet `db:"ip"`
Sticky bool `db:"sticky"`
Moderated bool `db:"moderated"` // TODO: I'm not sure this is ever meaningfully used. It always seems to be 0 / false?
Hits int `db:"hits"`
Featured bool `db:"featured"`
FeatureVotes int `db:"featurevotes"` // TODO: Remove this column from the db, it's never used
Preview string `db:"preview"`
ReadOnly bool `db:"readonly"`
}
2021-04-23 04:07:44 +00:00
type Parser int
const (
ParserBBCode Parser = 1
ParserCleanHTML = 2
ParserMarkdown = 3
)
type PostVersion struct {
ID int `db:"id"`
PostID int `db:"post_id"`
TextRaw string `db:"text_raw"`
TextParsed string `db:"text_parsed"`
Parser Parser `db:"parser"`
EditIP *net.IPNet `db:"edit_ip"`
EditDate time.Time `db:"edit_date"`
EditReason string `db:"edit_reason"`
EditorID *int `db:"editor_id"`
}