refactor(dramas): 重构短剧预搜索功能,改为搜索短剧本身
1. 将预搜索接口从剧集维度改为短剧维度,移除剧集相关逻辑 2. 新增短剧列表按标题筛选的能力 3. 更新测试用例与接口文档,修正命名与逻辑
This commit is contained in:
@@ -419,8 +419,8 @@ describe('Dramas and episodes', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('presearches published approved videos by keyword for mini app clients', async () => {
|
||||
const drama = await request(app.getHttpServer())
|
||||
it('presearches published dramas by drama title for mini app clients', async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post('/api/admin/v1/dramas')
|
||||
.set('Authorization', `Bearer ${adminToken}`)
|
||||
.send({
|
||||
@@ -432,14 +432,25 @@ describe('Dramas and episodes', () => {
|
||||
})
|
||||
.expect(201);
|
||||
|
||||
const episodeOnlyDrama = await request(app.getHttpServer())
|
||||
.post('/api/admin/v1/dramas')
|
||||
.set('Authorization', `Bearer ${adminToken}`)
|
||||
.send({
|
||||
title: 'Episode Only Drama',
|
||||
coverUrl: 'https://cdn.example.com/episode-only-drama.jpg',
|
||||
type: 'romance',
|
||||
status: 'published',
|
||||
})
|
||||
.expect(201);
|
||||
|
||||
await request(app.getHttpServer())
|
||||
.post('/api/admin/v1/episodes')
|
||||
.set('Authorization', `Bearer ${adminToken}`)
|
||||
.send({
|
||||
dramaId: drama.body.data.id,
|
||||
dramaId: episodeOnlyDrama.body.data.id,
|
||||
episodeNo: 1,
|
||||
title: 'Pilot Video Match',
|
||||
description: 'The first skyline episode.',
|
||||
title: 'Skyline Episode Title Only',
|
||||
description: 'This should not make the drama match.',
|
||||
coverUrl: 'https://cdn.example.com/skyline-ep1.jpg',
|
||||
videoUrl: 'https://cdn.example.com/skyline-ep1.mp4',
|
||||
byteplusVid: 'vid_skyline_001',
|
||||
@@ -453,20 +464,13 @@ describe('Dramas and episodes', () => {
|
||||
.expect(201);
|
||||
|
||||
await request(app.getHttpServer())
|
||||
.post('/api/admin/v1/episodes')
|
||||
.post('/api/admin/v1/dramas')
|
||||
.set('Authorization', `Bearer ${adminToken}`)
|
||||
.send({
|
||||
dramaId: drama.body.data.id,
|
||||
episodeNo: 2,
|
||||
title: 'Hidden Draft Video',
|
||||
description: 'Contains skyline but is not published.',
|
||||
coverUrl: 'https://cdn.example.com/skyline-ep2.jpg',
|
||||
videoUrl: 'https://cdn.example.com/skyline-ep2.mp4',
|
||||
byteplusVid: 'vid_skyline_002',
|
||||
durationSeconds: 180,
|
||||
title: 'Skyline Draft Drama',
|
||||
coverUrl: 'https://cdn.example.com/skyline-draft-drama.jpg',
|
||||
type: 'romance',
|
||||
status: 'draft',
|
||||
publishStatus: 'draft',
|
||||
reviewStatus: 'approved',
|
||||
})
|
||||
.expect(201);
|
||||
|
||||
@@ -478,19 +482,17 @@ describe('Dramas and episodes', () => {
|
||||
expect(response.body.data.pagination.pageSize).toBe(10);
|
||||
expect(response.body.data.list).toEqual([
|
||||
expect.objectContaining({
|
||||
dramaId: drama.body.data.id,
|
||||
episodeNo: 1,
|
||||
title: 'Pilot Video Match',
|
||||
coverUrl: 'https://cdn.example.com/skyline-ep1.jpg',
|
||||
videoUrl: 'https://cdn.example.com/skyline-ep1.mp4',
|
||||
byteplusVid: 'vid_skyline_001',
|
||||
durationSeconds: 180,
|
||||
freeType: 'free',
|
||||
price: 0,
|
||||
dramaTitle: 'Skyline Keyword Saga',
|
||||
dramaCoverUrl: 'https://cdn.example.com/skyline-drama.jpg',
|
||||
title: 'Skyline Keyword Saga',
|
||||
coverUrl: 'https://cdn.example.com/skyline-drama.jpg',
|
||||
status: 'published',
|
||||
}),
|
||||
]);
|
||||
expect(response.body.data.list).not.toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ title: 'Episode Only Drama' }),
|
||||
expect.objectContaining({ title: 'Skyline Draft Drama' }),
|
||||
]),
|
||||
);
|
||||
|
||||
const emptyKeyword = await request(app.getHttpServer())
|
||||
.get('/api/app/v1/dramas/presearch')
|
||||
|
||||
Reference in New Issue
Block a user