feat: update post detail page
This commit is contained in:
@@ -18,7 +18,7 @@ type ListQuery struct {
|
||||
type posts struct{}
|
||||
|
||||
// List posts
|
||||
// @Router /v1/admin/posts [get]
|
||||
// @Router /admin/posts [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
func (ctl *posts) List(ctx fiber.Ctx, pagination *requests.Pagination, query *ListQuery) (*requests.Pager, error) {
|
||||
@@ -63,7 +63,7 @@ type PostForm struct {
|
||||
}
|
||||
|
||||
// Create
|
||||
// @Router /v1/admin/posts [post]
|
||||
// @Router /admin/posts [post]
|
||||
// @Bind form body
|
||||
func (ctl *posts) Create(ctx fiber.Ctx, form *PostForm) error {
|
||||
post := model.Posts{
|
||||
@@ -100,7 +100,7 @@ func (ctl *posts) Create(ctx fiber.Ctx, form *PostForm) error {
|
||||
}
|
||||
|
||||
// Update posts
|
||||
// @Router /v1/admin/posts/:id [put]
|
||||
// @Router /admin/posts/:id [put]
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (ctl *posts) Update(ctx fiber.Ctx, id int64, form *PostForm) error {
|
||||
@@ -148,7 +148,7 @@ func (ctl *posts) Update(ctx fiber.Ctx, id int64, form *PostForm) error {
|
||||
}
|
||||
|
||||
// Delete posts
|
||||
// @Router /v1/admin/posts/:id [delete]
|
||||
// @Router /admin/posts/:id [delete]
|
||||
// @Bind id path
|
||||
func (ctl *posts) Delete(ctx fiber.Ctx, id int64) error {
|
||||
post, err := models.Posts.GetByID(ctx.Context(), id)
|
||||
@@ -172,7 +172,7 @@ type PostItem struct {
|
||||
}
|
||||
|
||||
// Show posts by id
|
||||
// @Router /v1/admin/posts/:id [get]
|
||||
// @Router /admin/posts/:id [get]
|
||||
// @Bind id path
|
||||
func (ctl *posts) Show(ctx fiber.Ctx, id int64) (*PostItem, error) {
|
||||
post, err := models.Posts.GetByID(ctx.Context(), id)
|
||||
@@ -193,7 +193,7 @@ func (ctl *posts) Show(ctx fiber.Ctx, id int64) (*PostItem, error) {
|
||||
}
|
||||
|
||||
// SendTo
|
||||
// @Router /v1/admin/posts/:id/send-to/:userId [post]
|
||||
// @Router /admin/posts/:id/send-to/:userId [post]
|
||||
// @Bind id path
|
||||
// @Bind userId path
|
||||
func (ctl *posts) SendTo(ctx fiber.Ctx, id, userId int64) error {
|
||||
|
||||
Reference in New Issue
Block a user