chore:一些测试文件的小修改
This commit is contained in:
@@ -2,7 +2,7 @@ package feed
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"feedsystem_video_go/internal/video" // 引入视频实体
|
"feedsystem_video_go/internal/video"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@@ -32,9 +32,9 @@ func (repo *FeedRepository) ListLatest(ctx context.Context, limit int, latestBef
|
|||||||
func (repo *FeedRepository) ListLikesCount(ctx context.Context, limit int, likesCountBefore int64) ([]video.Video, error) {
|
func (repo *FeedRepository) ListLikesCount(ctx context.Context, limit int, likesCountBefore int64) ([]video.Video, error) {
|
||||||
var videos []video.Video
|
var videos []video.Video
|
||||||
query := repo.db.WithContext(ctx).Model(&video.Video{}).
|
query := repo.db.WithContext(ctx).Model(&video.Video{}).
|
||||||
Order("like_count DESC")
|
Order("likes_count DESC")
|
||||||
if likesCountBefore > 0 {
|
if likesCountBefore > 0 {
|
||||||
query = query.Where("like_count < ?", likesCountBefore)
|
query = query.Where("likes_count < ?", likesCountBefore)
|
||||||
}
|
}
|
||||||
if err := query.Limit(limit).Find(&videos).Error; err != nil {
|
if err := query.Limit(limit).Find(&videos).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -66,15 +66,11 @@
|
|||||||
{
|
{
|
||||||
"key": "Content-Type",
|
"key": "Content-Type",
|
||||||
"value": "application/json"
|
"value": "application/json"
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Authorization",
|
|
||||||
"value": "Bearer {{jwt_token}}"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\n \"old_password\": \"{{password}}\",\n \"new_password\": \"{{newPassword}}\"\n}"
|
"raw": "{\n \"username\": \"{{username}}\",\n \"old_password\": \"{{password}}\",\n \"new_password\": \"{{newPassword}}\"\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "{{host}}/account/changePassword",
|
"raw": "{{host}}/account/changePassword",
|
||||||
@@ -96,10 +92,6 @@
|
|||||||
{
|
{
|
||||||
"key": "Content-Type",
|
"key": "Content-Type",
|
||||||
"value": "application/json"
|
"value": "application/json"
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Authorization",
|
|
||||||
"value": "Bearer {{jwt_token}}"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
@@ -126,10 +118,6 @@
|
|||||||
{
|
{
|
||||||
"key": "Content-Type",
|
"key": "Content-Type",
|
||||||
"value": "application/json"
|
"value": "application/json"
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Authorization",
|
|
||||||
"value": "Bearer {{jwt_token}}"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"info": {
|
"info": {
|
||||||
"name": "FeedSystem Feed API",
|
"name": "FeedSystem Feed API",
|
||||||
"_postman_id": "4c2fd555-b880-4b14-8023-55a944936352",
|
"_postman_id": "4c2fd555-b880-4b14-8023-55a944936352",
|
||||||
"description": "Feed endpoints.\n\nPagination:\n- /feed/listLatest: copy response.next_time into feedLatestTime\n- /feed/listLikesCount: copy response.next_likes_count_before into feedLikesCountBefore",
|
"description": "Feed endpoints.\n\nPagination:\n- /feed/listLatest: copy response.next_time (unix seconds) into feedLatestTime\n- /feed/listLikesCount: copy response.next_likes_count_before into feedLikesCountBefore",
|
||||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||||
},
|
},
|
||||||
"item": [
|
"item": [
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\n \"title\": \"demo video\",\n \"description\": \"manual request\",\n \"play_url\": \"http://example.com/demo.mp4\"\n}"
|
"raw": "{\n \"title\": \"demo video\",\n \"description\": \"manual request\",\n \"play_url\": \"http://example.com/demo.mp4\",\n \"cover_url\": \"http://example.com/demo.jpg\"\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "{{host}}/video/publish",
|
"raw": "{{host}}/video/publish",
|
||||||
|
|||||||
Reference in New Issue
Block a user