feat: start develop a comment logic

This commit is contained in:
d3m0k1d
2026-02-15 19:06:10 +03:00
parent 2c3e6578e9
commit 0eca2b1e68
7 changed files with 132 additions and 8 deletions

View File

@@ -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"`
}