Moved away from local files to complete database driven articles

This commit is contained in:
2021-12-20 23:10:04 +01:00
parent bc3ec64b3c
commit c909339a73
20 changed files with 302 additions and 299 deletions

38
database/schema.go Normal file
View File

@@ -0,0 +1,38 @@
package database
import "fmt"
type Article struct {
ID int
Name string
Title string
Summary string
Image string
Added int64
Modified int64
Markdown string
Html string
}
func (a Article) ToArticleSummary() ArticleSummary {
return ArticleSummary{
Title: a.Title,
Summary: a.Summary,
Image: a.Image,
Link: fmt.Sprintf("/article/%s", a.Name),
}
}
type ArticleSummary struct {
Title string `json:"title"`
Summary string `json:"summary"`
Image string `json:"image"`
Link string `json:"link"`
}
type Author struct {
ID int
Name string
Email string
Password string
}