66 lines
2.0 KiB
Go
66 lines
2.0 KiB
Go
package storage
|
|
|
|
// Post
|
|
type Post struct {
|
|
ID int `db:"id" json:"id"`
|
|
Title string `db:"title" json:"title"`
|
|
Published bool `db:"published" json:"published"`
|
|
Content string `db:"content" json:"content"`
|
|
CreatedAt string `db:"created_at" json:"created_at"`
|
|
Tags string `db:"tags" json:"tags"`
|
|
}
|
|
|
|
type PostReq struct {
|
|
ID int `db:"id" json:"id"`
|
|
Title string `db:"title" json:"title"`
|
|
Content string `db:"content" json:"content"`
|
|
CreatedAt string `db:"created" json:"created_at"`
|
|
Tags string `db:"tags" json:"tags"`
|
|
}
|
|
|
|
type PostCreate struct {
|
|
Title string `db:"title" json:"title"`
|
|
Published bool `db:"published" json:"published"`
|
|
Content string `db:"content" json:"content"`
|
|
Tags string `db:"tags" json:"tags"`
|
|
}
|
|
|
|
// User
|
|
type User struct {
|
|
ID int `db:"id" json:"id"`
|
|
Email string `db:"email" json:"email"`
|
|
GithubID int `db:"github_id" json:"github_id"`
|
|
GithubLogin string `db:"github_login" json:"github_login"`
|
|
AvatarURL string `db:"avatar_url" json:"avatar_url"`
|
|
}
|
|
|
|
type UserReg struct {
|
|
Email string `json:"email"`
|
|
GithubID int `json:"id"`
|
|
GithubLogin string `json:"login"`
|
|
AvatarURL string `json:"avatar_url"`
|
|
}
|
|
|
|
// Comment
|
|
type Comment struct {
|
|
ID int `db:"id" json:"id"`
|
|
PostID int `db:"post_id" json:"post_id"`
|
|
UserID int `db:"user_id" json:"user_id"`
|
|
Content string `db:"content" json:"content"`
|
|
CreatedAt string `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
type CommentReq struct {
|
|
ID int `db:"id" json:"id"`
|
|
PostID int `db:"post_id" json:"post_id"`
|
|
UserID int `db:"user_id" json:"user_id"`
|
|
Content string `db:"content" json:"content"`
|
|
CreatedAt string `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
type CommentCreate struct {
|
|
PostID int `db:"post_id" json:"post_id"`
|
|
UserID int `db:"user_id" json:"user_id"`
|
|
Content string `db:"content" json:"content"`
|
|
}
|