Moved away from local files to complete database driven articles
This commit is contained in:
38
database/schema.go
Normal file
38
database/schema.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user