feat: align ids to int64

This commit is contained in:
2026-01-08 09:57:04 +08:00
parent a1de16bc01
commit d98f41f1ac
39 changed files with 298 additions and 339 deletions

View File

@@ -37,120 +37,120 @@ func (c *Content) List(
// Get content detail
//
// @Router /v1/contents/:id [get]
// @Router /v1/contents/:id<int> [get]
// @Summary Get content detail
// @Description Get content detail by ID
// @Tags Content
// @Accept json
// @Produce json
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Success 200 {object} dto.ContentDetail
// @Bind id path
func (c *Content) Get(ctx fiber.Ctx, id string) (*dto.ContentDetail, error) {
func (c *Content) Get(ctx fiber.Ctx, id int64) (*dto.ContentDetail, error) {
uid := getUserID(ctx)
return services.Content.Get(ctx, uid, id)
}
// Get comments for a content
//
// @Router /v1/contents/:id/comments [get]
// @Router /v1/contents/:id<int>/comments [get]
// @Summary Get comments
// @Description Get comments for a content
// @Tags Content
// @Accept json
// @Produce json
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Param page query int false "Page number"
// @Success 200 {object} requests.Pager{items=[]dto.Comment}
// @Bind id path
// @Bind page query
func (c *Content) ListComments(ctx fiber.Ctx, id string, page int) (*requests.Pager, error) {
func (c *Content) ListComments(ctx fiber.Ctx, id int64, page int) (*requests.Pager, error) {
uid := getUserID(ctx)
return services.Content.ListComments(ctx, uid, id, page)
}
// Post a comment
//
// @Router /v1/contents/:id/comments [post]
// @Router /v1/contents/:id<int>/comments [post]
// @Summary Post comment
// @Description Post a comment to a content
// @Tags Content
// @Accept json
// @Produce json
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Param form body dto.CommentCreateForm true "Comment form"
// @Success 200 {string} string "Comment created"
// @Bind id path
// @Bind form body
func (c *Content) CreateComment(ctx fiber.Ctx, id string, form *dto.CommentCreateForm) error {
func (c *Content) CreateComment(ctx fiber.Ctx, id int64, form *dto.CommentCreateForm) error {
uid := getUserID(ctx)
return services.Content.CreateComment(ctx, uid, id, form)
}
// Like a comment
//
// @Router /v1/comments/:id/like [post]
// @Router /v1/comments/:id<int>/like [post]
// @Summary Like comment
// @Description Like a comment
// @Tags Content
// @Accept json
// @Produce json
// @Param id path string true "Comment ID"
// @Param id path int64 true "Comment ID"
// @Success 200 {string} string "Liked"
// @Bind id path
func (c *Content) LikeComment(ctx fiber.Ctx, id string) error {
func (c *Content) LikeComment(ctx fiber.Ctx, id int64) error {
uid := getUserID(ctx)
return services.Content.LikeComment(ctx, uid, id)
}
// Add like
//
// @Router /v1/contents/:id/like [post]
// @Router /v1/contents/:id<int>/like [post]
// @Summary Add like
// @Tags Content
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Success 200 {string} string "Liked"
// @Bind id path
func (c *Content) AddLike(ctx fiber.Ctx, id string) error {
func (c *Content) AddLike(ctx fiber.Ctx, id int64) error {
uid := getUserID(ctx)
return services.Content.AddLike(ctx, uid, id)
}
// Remove like
//
// @Router /v1/contents/:id/like [delete]
// @Router /v1/contents/:id<int>/like [delete]
// @Summary Remove like
// @Tags Content
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Success 200 {string} string "Unliked"
// @Bind id path
func (c *Content) RemoveLike(ctx fiber.Ctx, id string) error {
func (c *Content) RemoveLike(ctx fiber.Ctx, id int64) error {
uid := getUserID(ctx)
return services.Content.RemoveLike(ctx, uid, id)
}
// Add favorite
//
// @Router /v1/contents/:id/favorite [post]
// @Router /v1/contents/:id<int>/favorite [post]
// @Summary Add favorite
// @Tags Content
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Success 200 {string} string "Favorited"
// @Bind id path
func (c *Content) AddFavorite(ctx fiber.Ctx, id string) error {
func (c *Content) AddFavorite(ctx fiber.Ctx, id int64) error {
uid := getUserID(ctx)
return services.Content.AddFavorite(ctx, uid, id)
}
// Remove favorite
//
// @Router /v1/contents/:id/favorite [delete]
// @Router /v1/contents/:id<int>/favorite [delete]
// @Summary Remove favorite
// @Tags Content
// @Param id path string true "Content ID"
// @Param id path int64 true "Content ID"
// @Success 200 {string} string "Unfavorited"
// @Bind id path
func (c *Content) RemoveFavorite(ctx fiber.Ctx, id string) error {
func (c *Content) RemoveFavorite(ctx fiber.Ctx, id int64) error {
uid := getUserID(ctx)
return services.Content.RemoveFavorite(ctx, uid, id)
}