Added api endpoints and tests

This commit is contained in:
2022-01-24 12:59:43 +01:00
parent 10b768743b
commit cfbdcc7f82
36 changed files with 1781 additions and 315 deletions

View File

@@ -1,38 +0,0 @@
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
}