feat: start develop a comment logic
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
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 {
|
||||
@@ -13,14 +15,17 @@ type PostReq struct {
|
||||
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"`
|
||||
@@ -35,3 +40,26 @@ type UserReg struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user