v1 blog API routes
This commit is contained in:
parent
fec3325503
commit
eaa2f6587d
9 changed files with 286 additions and 34 deletions
|
|
@ -11,17 +11,17 @@ import (
|
|||
|
||||
type (
|
||||
BlogPost struct {
|
||||
ID string `db:"id"`
|
||||
Title string `db:"title"`
|
||||
Description string `db:"description"`
|
||||
Visible bool `db:"visible"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
ModifiedAt sql.NullTime `db:"modified_at"`
|
||||
AuthorID string `db:"author"`
|
||||
Markdown string `db:"markdown"`
|
||||
HTML template.HTML `db:"html"`
|
||||
BlueskyActorID *string `db:"bluesky_actor"`
|
||||
BlueskyPostID *string `db:"bluesky_post"`
|
||||
ID string `json:"id" db:"id"`
|
||||
Title string `json:"title" db:"title"`
|
||||
Description string `json:"description" db:"description"`
|
||||
Visible bool `json:"visible" db:"visible"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
ModifiedAt sql.NullTime `json:"modified_at" db:"modified_at"`
|
||||
AuthorID string `json:"author" db:"author"`
|
||||
Markdown string `json:"markdown" db:"markdown"`
|
||||
HTML template.HTML `json:"html" db:"html"`
|
||||
BlueskyActorID *string `json:"bluesky_actor" db:"bluesky_actor"`
|
||||
BlueskyPostID *string `json:"bluesky_post" db:"bluesky_post"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -40,12 +40,12 @@ func (b *BlogPost) GetMonth() string {
|
|||
}
|
||||
|
||||
func (b *BlogPost) PrintDate() string {
|
||||
return b.CreatedAt.Format("2 January 2006, 03:04")
|
||||
return b.CreatedAt.Format("2 January 2006, 15:04")
|
||||
}
|
||||
|
||||
func (b *BlogPost) PrintModifiedDate() string {
|
||||
if !b.ModifiedAt.Valid {
|
||||
return ""
|
||||
}
|
||||
return b.ModifiedAt.Time.Format("2 January 2006, 03:04")
|
||||
return b.ModifiedAt.Time.Format("2 January 2006, 15:04")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue