feat: align ids to int64
This commit is contained in:
@@ -125,17 +125,17 @@ func (c *Common) AbortUpload(ctx fiber.Ctx, user *models.User, uploadId string)
|
||||
return services.Common.AbortUpload(ctx.Context(), user.ID, uploadId)
|
||||
}
|
||||
|
||||
// @Router /v1/media-assets/:id [delete]
|
||||
// @Router /v1/media-assets/:id<int> [delete]
|
||||
// @Summary Delete media asset
|
||||
// @Description Delete media asset
|
||||
// @Tags Common
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Asset ID"
|
||||
// @Param id path int64 true "Asset ID"
|
||||
// @Success 200 {string} string "OK"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (c *Common) DeleteMediaAsset(ctx fiber.Ctx, user *models.User, id string) error {
|
||||
func (c *Common) DeleteMediaAsset(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Common.DeleteMediaAsset(ctx.Context(), user.ID, id)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -44,17 +44,17 @@ func (c *Creator) Dashboard(ctx fiber.Ctx, user *models.User) (*dto.DashboardSta
|
||||
|
||||
// Get content details for edit
|
||||
//
|
||||
// @Router /v1/creator/contents/:id [get]
|
||||
// @Router /v1/creator/contents/:id<int> [get]
|
||||
// @Summary Get content
|
||||
// @Description Get content details for edit
|
||||
// @Tags CreatorCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Content ID"
|
||||
// @Param id path int64 true "Content ID"
|
||||
// @Success 200 {object} dto.ContentEditDTO
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (c *Creator) GetContent(ctx fiber.Ctx, user *models.User, id string) (*dto.ContentEditDTO, error) {
|
||||
func (c *Creator) GetContent(ctx fiber.Ctx, user *models.User, id int64) (*dto.ContentEditDTO, error) {
|
||||
return services.Creator.GetContent(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
@@ -98,35 +98,35 @@ func (c *Creator) CreateContent(ctx fiber.Ctx, user *models.User, form *dto.Cont
|
||||
|
||||
// Update content
|
||||
//
|
||||
// @Router /v1/creator/contents/:id [put]
|
||||
// @Router /v1/creator/contents/:id<int> [put]
|
||||
// @Summary Update content
|
||||
// @Description Update content
|
||||
// @Tags CreatorCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Content ID"
|
||||
// @Param id path int64 true "Content ID"
|
||||
// @Param form body dto.ContentUpdateForm true "Update form"
|
||||
// @Success 200 {string} string "Updated"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Creator) UpdateContent(ctx fiber.Ctx, user *models.User, id string, form *dto.ContentUpdateForm) error {
|
||||
func (c *Creator) UpdateContent(ctx fiber.Ctx, user *models.User, id int64, form *dto.ContentUpdateForm) error {
|
||||
return services.Creator.UpdateContent(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
// Delete content
|
||||
//
|
||||
// @Router /v1/creator/contents/:id [delete]
|
||||
// @Router /v1/creator/contents/:id<int> [delete]
|
||||
// @Summary Delete content
|
||||
// @Description Delete content
|
||||
// @Tags CreatorCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Content ID"
|
||||
// @Param id path int64 true "Content ID"
|
||||
// @Success 200 {string} string "Deleted"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (c *Creator) DeleteContent(ctx fiber.Ctx, user *models.User, id string) error {
|
||||
func (c *Creator) DeleteContent(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Creator.DeleteContent(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
@@ -153,19 +153,19 @@ func (c *Creator) ListOrders(
|
||||
|
||||
// Process refund
|
||||
//
|
||||
// @Router /v1/creator/orders/:id/refund [post]
|
||||
// @Router /v1/creator/orders/:id<int>/refund [post]
|
||||
// @Summary Process refund
|
||||
// @Description Process refund
|
||||
// @Tags CreatorCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Order ID"
|
||||
// @Param id path int64 true "Order ID"
|
||||
// @Param form body dto.RefundForm true "Refund form"
|
||||
// @Success 200 {string} string "Processed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Creator) Refund(ctx fiber.Ctx, user *models.User, id string, form *dto.RefundForm) error {
|
||||
func (c *Creator) Refund(ctx fiber.Ctx, user *models.User, id int64, form *dto.RefundForm) error {
|
||||
return services.Creator.ProcessRefund(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
@@ -237,11 +237,11 @@ func (c *Creator) AddPayoutAccount(ctx fiber.Ctx, user *models.User, form *dto.P
|
||||
// @Tags CreatorCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id query string true "Account ID"
|
||||
// @Param id query int64 true "Account ID"
|
||||
// @Success 200 {string} string "Removed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id query
|
||||
func (c *Creator) RemovePayoutAccount(ctx fiber.Ctx, user *models.User, id string) error {
|
||||
func (c *Creator) RemovePayoutAccount(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Creator.RemovePayoutAccount(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ type LoginResponse struct {
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Phone string `json:"phone"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
|
||||
@@ -3,7 +3,7 @@ package dto
|
||||
import "quyun/v2/app/requests"
|
||||
|
||||
type UploadResult struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
URL string `json:"url"`
|
||||
Filename string `json:"filename"`
|
||||
Size int64 `json:"size"`
|
||||
|
||||
@@ -6,20 +6,20 @@ type ContentListFilter struct {
|
||||
requests.Pagination
|
||||
Keyword *string `query:"keyword"`
|
||||
Genre *string `query:"genre"`
|
||||
TenantID *string `query:"tenantId"`
|
||||
TenantID *int64 `query:"tenantId"`
|
||||
Sort *string `query:"sort"`
|
||||
IsPinned *bool `query:"is_pinned"`
|
||||
PriceType *string `query:"price_type"`
|
||||
}
|
||||
|
||||
type ContentItem struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Cover string `json:"cover"`
|
||||
Genre string `json:"genre"`
|
||||
Type string `json:"type"` // video, audio, article
|
||||
Price float64 `json:"price"`
|
||||
AuthorID string `json:"author_id"`
|
||||
AuthorID int64 `json:"author_id"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorAvatar string `json:"author_avatar"`
|
||||
AuthorIsFollowing bool `json:"author_is_following"`
|
||||
@@ -52,24 +52,24 @@ type Meta struct {
|
||||
}
|
||||
|
||||
type Comment struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Content string `json:"content"`
|
||||
UserID string `json:"user_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
UserNickname string `json:"user_nickname"`
|
||||
UserAvatar string `json:"user_avatar"`
|
||||
CreateTime string `json:"create_time"`
|
||||
Likes int `json:"likes"`
|
||||
IsLiked bool `json:"is_liked"`
|
||||
ReplyTo string `json:"reply_to"`
|
||||
ReplyTo int64 `json:"reply_to"`
|
||||
}
|
||||
|
||||
type CommentCreateForm struct {
|
||||
Content string `json:"content"`
|
||||
ReplyTo string `json:"reply_to"`
|
||||
ReplyTo int64 `json:"reply_to"`
|
||||
}
|
||||
|
||||
type Topic struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Cover string `json:"cover"`
|
||||
Tag string `json:"tag"`
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package dto
|
||||
|
||||
type UserCouponItem struct {
|
||||
ID string `json:"id"`
|
||||
CouponID string `json:"coupon_id"`
|
||||
ID int64 `json:"id"`
|
||||
CouponID int64 `json:"coupon_id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Type string `json:"type"`
|
||||
|
||||
@@ -26,13 +26,13 @@ type FloatStatItem struct {
|
||||
}
|
||||
|
||||
type ContentCreateForm struct {
|
||||
Title string `json:"title"`
|
||||
Genre string `json:"genre"`
|
||||
Key string `json:"key"`
|
||||
Price float64 `json:"price"`
|
||||
Status string `json:"status"`
|
||||
CoverIDs []string `json:"cover_ids"`
|
||||
MediaIDs []string `json:"media_ids"`
|
||||
Title string `json:"title"`
|
||||
Genre string `json:"genre"`
|
||||
Key string `json:"key"`
|
||||
Price float64 `json:"price"`
|
||||
Status string `json:"status"`
|
||||
CoverIDs []int64 `json:"cover_ids"`
|
||||
MediaIDs []int64 `json:"media_ids"`
|
||||
}
|
||||
|
||||
type ContentUpdateForm struct {
|
||||
@@ -42,12 +42,12 @@ type ContentUpdateForm struct {
|
||||
Price *float64 `json:"price"`
|
||||
Status string `json:"status"`
|
||||
IsPinned *bool `json:"is_pinned"`
|
||||
CoverIDs []string `json:"cover_ids"`
|
||||
MediaIDs []string `json:"media_ids"`
|
||||
CoverIDs []int64 `json:"cover_ids"`
|
||||
MediaIDs []int64 `json:"media_ids"`
|
||||
}
|
||||
|
||||
type ContentEditDTO struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Genre string `json:"genre"`
|
||||
Key string `json:"key"`
|
||||
@@ -60,7 +60,7 @@ type ContentEditDTO struct {
|
||||
}
|
||||
|
||||
type CreatorContentItem struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Genre string `json:"genre"`
|
||||
Key string `json:"key"`
|
||||
@@ -79,7 +79,7 @@ type CreatorContentItem struct {
|
||||
}
|
||||
|
||||
type AssetDTO struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Role string `json:"role"`
|
||||
Type string `json:"type"`
|
||||
URL string `json:"url"`
|
||||
@@ -110,7 +110,7 @@ type RefundForm struct {
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Bio string `json:"bio"`
|
||||
Avatar string `json:"avatar"`
|
||||
@@ -119,7 +119,7 @@ type Settings struct {
|
||||
}
|
||||
|
||||
type PayoutAccount struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Type string `json:"type"` // bank, alipay
|
||||
Name string `json:"name"`
|
||||
Account string `json:"account"`
|
||||
@@ -129,5 +129,5 @@ type PayoutAccount struct {
|
||||
type WithdrawForm struct {
|
||||
Amount float64 `json:"amount"`
|
||||
Method string `json:"method"` // wallet, external
|
||||
AccountID string `json:"account_id"`
|
||||
AccountID int64 `json:"account_id"`
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package dto
|
||||
|
||||
type OrderCreateForm struct {
|
||||
ContentID string `json:"content_id"`
|
||||
ContentID int64 `json:"content_id"`
|
||||
Sku string `json:"sku"`
|
||||
Quantity int `json:"quantity"`
|
||||
UserCouponID string `json:"user_coupon_id"`
|
||||
UserCouponID int64 `json:"user_coupon_id"`
|
||||
}
|
||||
|
||||
type OrderCreateResponse struct {
|
||||
OrderID string `json:"order_id"`
|
||||
OrderID int64 `json:"order_id"`
|
||||
}
|
||||
|
||||
type OrderPayForm struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ type TenantListFilter struct {
|
||||
}
|
||||
|
||||
type TenantProfile struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Avatar string `json:"avatar"`
|
||||
Cover string `json:"cover"`
|
||||
|
||||
@@ -22,7 +22,7 @@ type WalletResponse struct {
|
||||
}
|
||||
|
||||
type Transaction struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Amount float64 `json:"amount"`
|
||||
Type string `json:"type"` // income, expense
|
||||
@@ -40,7 +40,7 @@ type RechargeResponse struct {
|
||||
}
|
||||
|
||||
type Order struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Type string `json:"type"` // consts.OrderType...
|
||||
TypeDescription string `json:"type_description"`
|
||||
CreateTime string `json:"create_time"`
|
||||
@@ -50,7 +50,7 @@ type Order struct {
|
||||
Amount float64 `json:"amount"`
|
||||
Quantity int `json:"quantity"`
|
||||
Items []ContentItem `json:"items"`
|
||||
TenantID string `json:"tenant_id"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
TenantName string `json:"tenant_name"`
|
||||
IsVirtual bool `json:"is_virtual"`
|
||||
BuyerName string `json:"buyer_name"`
|
||||
@@ -60,7 +60,7 @@ type Order struct {
|
||||
}
|
||||
|
||||
type Notification struct {
|
||||
ID string `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
|
||||
@@ -14,19 +14,19 @@ type Tenant struct{}
|
||||
|
||||
// List creator contents
|
||||
//
|
||||
// @Router /v1/creators/:id/contents [get]
|
||||
// @Router /v1/creators/:id<int>/contents [get]
|
||||
// @Summary List creator contents
|
||||
// @Description List contents of a specific creator
|
||||
// @Tags TenantPublic
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Tenant ID"
|
||||
// @Param id path int64 true "Tenant ID"
|
||||
// @Param page query int false "Page"
|
||||
// @Param limit query int false "Limit"
|
||||
// @Success 200 {object} requests.Pager
|
||||
// @Bind id path
|
||||
// @Bind filter query
|
||||
func (t *Tenant) ListContents(ctx fiber.Ctx, id string, filter *dto.ContentListFilter) (*requests.Pager, error) {
|
||||
func (t *Tenant) ListContents(ctx fiber.Ctx, id int64, filter *dto.ContentListFilter) (*requests.Pager, error) {
|
||||
if filter == nil {
|
||||
filter = &dto.ContentListFilter{}
|
||||
}
|
||||
@@ -53,17 +53,17 @@ func (t *Tenant) List(ctx fiber.Ctx, filter *dto.TenantListFilter) (*requests.Pa
|
||||
|
||||
// Get tenant public profile
|
||||
//
|
||||
// @Router /v1/tenants/:id [get]
|
||||
// @Router /v1/tenants/:id<int> [get]
|
||||
// @Summary Get tenant profile
|
||||
// @Description Get tenant public profile
|
||||
// @Tags TenantPublic
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Tenant ID"
|
||||
// @Param id path int64 true "Tenant ID"
|
||||
// @Success 200 {object} dto.TenantProfile
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (t *Tenant) Get(ctx fiber.Ctx, user *models.User, id string) (*dto.TenantProfile, error) {
|
||||
func (t *Tenant) Get(ctx fiber.Ctx, user *models.User, id int64) (*dto.TenantProfile, error) {
|
||||
uid := int64(0)
|
||||
if user != nil {
|
||||
uid = user.ID
|
||||
@@ -73,32 +73,32 @@ func (t *Tenant) Get(ctx fiber.Ctx, user *models.User, id string) (*dto.TenantPr
|
||||
|
||||
// Follow a tenant
|
||||
//
|
||||
// @Router /v1/tenants/:id/follow [post]
|
||||
// @Router /v1/tenants/:id<int>/follow [post]
|
||||
// @Summary Follow tenant
|
||||
// @Description Follow a tenant
|
||||
// @Tags TenantPublic
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Tenant ID"
|
||||
// @Param id path int64 true "Tenant ID"
|
||||
// @Success 200 {string} string "Followed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (t *Tenant) Follow(ctx fiber.Ctx, user *models.User, id string) error {
|
||||
func (t *Tenant) Follow(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Tenant.Follow(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
// Unfollow a tenant
|
||||
//
|
||||
// @Router /v1/tenants/:id/follow [delete]
|
||||
// @Router /v1/tenants/:id<int>/follow [delete]
|
||||
// @Summary Unfollow tenant
|
||||
// @Description Unfollow a tenant
|
||||
// @Tags TenantPublic
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Tenant ID"
|
||||
// @Param id path int64 true "Tenant ID"
|
||||
// @Success 200 {string} string "Unfollowed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (t *Tenant) Unfollow(ctx fiber.Ctx, user *models.User, id string) error {
|
||||
func (t *Tenant) Unfollow(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Tenant.Unfollow(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ func (t *Transaction) Create(
|
||||
|
||||
// Pay for order
|
||||
//
|
||||
// @Router /v1/orders/:id/pay [post]
|
||||
// @Router /v1/orders/:id<int>/pay [post]
|
||||
// @Summary Pay for order
|
||||
// @Description Pay for order
|
||||
// @Tags Transaction
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Order ID"
|
||||
// @Param id path int64 true "Order ID"
|
||||
// @Param form body dto.OrderPayForm true "Pay form"
|
||||
// @Success 200 {object} dto.OrderPayResponse
|
||||
// @Bind user local key(__ctx_user)
|
||||
@@ -48,7 +48,7 @@ func (t *Transaction) Create(
|
||||
func (t *Transaction) Pay(
|
||||
ctx fiber.Ctx,
|
||||
user *models.User,
|
||||
id string,
|
||||
id int64,
|
||||
form *dto.OrderPayForm,
|
||||
) (*dto.OrderPayResponse, error) {
|
||||
return services.Order.Pay(ctx, user.ID, id, form)
|
||||
@@ -56,21 +56,21 @@ func (t *Transaction) Pay(
|
||||
|
||||
// Check order payment status
|
||||
//
|
||||
// @Router /v1/orders/:id/status [get]
|
||||
// @Router /v1/orders/:id<int>/status [get]
|
||||
// @Summary Check order status
|
||||
// @Description Check order payment status
|
||||
// @Tags Transaction
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Order ID"
|
||||
// @Param id path int64 true "Order ID"
|
||||
// @Success 200 {object} dto.OrderStatusResponse
|
||||
// @Bind id path
|
||||
func (t *Transaction) Status(ctx fiber.Ctx, id string) (*dto.OrderStatusResponse, error) {
|
||||
func (t *Transaction) Status(ctx fiber.Ctx, id int64) (*dto.OrderStatusResponse, error) {
|
||||
return services.Order.Status(ctx, id)
|
||||
}
|
||||
|
||||
type WebhookForm struct {
|
||||
OrderID string `json:"order_id"`
|
||||
OrderID int64 `json:"order_id"`
|
||||
ExternalID string `json:"external_id"`
|
||||
}
|
||||
|
||||
|
||||
@@ -108,17 +108,17 @@ func (u *User) ListOrders(ctx fiber.Ctx, user *models.User, status string) ([]dt
|
||||
|
||||
// Get user order detail
|
||||
//
|
||||
// @Router /v1/me/orders/:id [get]
|
||||
// @Router /v1/me/orders/:id<int> [get]
|
||||
// @Summary Get order detail
|
||||
// @Description Get user order detail
|
||||
// @Tags UserCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Order ID"
|
||||
// @Param id path int64 true "Order ID"
|
||||
// @Success 200 {object} dto.Order
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (u *User) GetOrder(ctx fiber.Ctx, user *models.User, id string) (*dto.Order, error) {
|
||||
func (u *User) GetOrder(ctx fiber.Ctx, user *models.User, id int64) (*dto.Order, error) {
|
||||
return services.Order.GetUserOrder(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
@@ -158,27 +158,27 @@ func (u *User) Favorites(ctx fiber.Ctx, user *models.User) ([]dto.ContentItem, e
|
||||
// @Tags UserCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param contentId query string true "Content ID"
|
||||
// @Param contentId query int64 true "Content ID"
|
||||
// @Success 200 {string} string "Added"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind contentId query
|
||||
func (u *User) AddFavorite(ctx fiber.Ctx, user *models.User, contentId string) error {
|
||||
func (u *User) AddFavorite(ctx fiber.Ctx, user *models.User, contentId int64) error {
|
||||
return services.Content.AddFavorite(ctx, user.ID, contentId)
|
||||
}
|
||||
|
||||
// Remove from favorites
|
||||
//
|
||||
// @Router /v1/me/favorites/:contentId [delete]
|
||||
// @Router /v1/me/favorites/:contentId<int> [delete]
|
||||
// @Summary Remove favorite
|
||||
// @Description Remove from favorites
|
||||
// @Tags UserCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param contentId path string true "Content ID"
|
||||
// @Param contentId path int64 true "Content ID"
|
||||
// @Success 200 {string} string "Removed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind contentId path
|
||||
func (u *User) RemoveFavorite(ctx fiber.Ctx, user *models.User, contentId string) error {
|
||||
func (u *User) RemoveFavorite(ctx fiber.Ctx, user *models.User, contentId int64) error {
|
||||
return services.Content.RemoveFavorite(ctx, user.ID, contentId)
|
||||
}
|
||||
|
||||
@@ -204,27 +204,27 @@ func (u *User) Likes(ctx fiber.Ctx, user *models.User) ([]dto.ContentItem, error
|
||||
// @Tags UserCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param contentId query string true "Content ID"
|
||||
// @Param contentId query int64 true "Content ID"
|
||||
// @Success 200 {string} string "Liked"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind contentId query
|
||||
func (u *User) AddLike(ctx fiber.Ctx, user *models.User, contentId string) error {
|
||||
func (u *User) AddLike(ctx fiber.Ctx, user *models.User, contentId int64) error {
|
||||
return services.Content.AddLike(ctx, user.ID, contentId)
|
||||
}
|
||||
|
||||
// Unlike content
|
||||
//
|
||||
// @Router /v1/me/likes/:contentId [delete]
|
||||
// @Router /v1/me/likes/:contentId<int> [delete]
|
||||
// @Summary Unlike content
|
||||
// @Description Unlike content
|
||||
// @Tags UserCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param contentId path string true "Content ID"
|
||||
// @Param contentId path int64 true "Content ID"
|
||||
// @Success 200 {string} string "Unliked"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind contentId path
|
||||
func (u *User) RemoveLike(ctx fiber.Ctx, user *models.User, contentId string) error {
|
||||
func (u *User) RemoveLike(ctx fiber.Ctx, user *models.User, contentId int64) error {
|
||||
return services.Content.RemoveLike(ctx, user.ID, contentId)
|
||||
}
|
||||
|
||||
@@ -262,16 +262,16 @@ func (u *User) Notifications(ctx fiber.Ctx, user *models.User, typeArg string, p
|
||||
|
||||
// Mark notification as read
|
||||
//
|
||||
// @Router /v1/me/notifications/:id/read [post]
|
||||
// @Router /v1/me/notifications/:id<int>/read [post]
|
||||
// @Summary Mark as read
|
||||
// @Tags UserCenter
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Notification ID"
|
||||
// @Param id path int64 true "Notification ID"
|
||||
// @Success 200 {string} string "OK"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (u *User) MarkNotificationRead(ctx fiber.Ctx, user *models.User, id string) error {
|
||||
func (u *User) MarkNotificationRead(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Notification.MarkRead(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user