hmn/src/models/education.go

43 lines
936 B
Go
Raw Normal View History

2022-06-23 04:09:20 +00:00
package models
import "time"
type EduArticle struct {
2022-06-23 04:09:20 +00:00
ID int `db:"id"`
Title string `db:"title"`
Slug string `db:"slug"`
Description string `db:"description"`
Published bool `db:"published"` // Unpublished articles are visible to authors and beta testers.
2022-06-23 04:09:20 +00:00
Type EduArticleType `db:"type"`
2022-06-23 04:09:20 +00:00
CurrentVersionID int `db:"current_version"`
CurrentVersion *EduArticleVersion // not in DB, set by helpers
2022-06-23 04:09:20 +00:00
}
type EduArticleType int
2022-06-23 04:09:20 +00:00
const (
EduArticleTypeArticle EduArticleType = iota + 1
EduArticleTypeGlossary
2022-06-23 04:09:20 +00:00
)
type EduArticleVersion struct {
2022-06-23 04:09:20 +00:00
ID int `db:"id"`
ArticleID int `db:"article_id"`
Date time.Time `db:"date"`
EditorID *int `db:"editor_id"`
ContentRaw string `db:"content_raw"`
ContentHTML string `db:"content_html"`
}
type EduRole int
const (
EduRoleNone EduRole = iota
EduRoleBeta
EduRoleAuthor
)