Skip to content

Commit

Permalink
fix(worker): return wrong resource id
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Oct 7, 2023
1 parent f7014d3 commit b95167d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/worker/scripts/dev.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Content-Type: application/json
GET http://127.0.0.1:8787/resource/638270_Nemuri_THE_iDOLM_STER_CINDERELLA_GIRLS_2012-2023_Discography_Collection_268_CDs_FLAC.html
Content-Type: application/json

### Get the resource detail by id
GET http://127.0.0.1:8787/resource/652885
Content-Type: application/json

### List the second page of resources
GET http://127.0.0.1:8787/resources?page=2
Content-Type: application/json
Expand Down
17 changes: 15 additions & 2 deletions packages/worker/src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,25 @@ export const findResourcesFromDB = memoAsync(

const query = db
.selectFrom('Resource')
.selectAll()
.select([
'Resource.id',
'Resource.href',
'Resource.title',
'Resource.titleAlt',
'Resource.type',
'Resource.size',
'Resource.magnet',
'Resource.createdAt',
'Resource.anitomy',
'Resource.fansubId',
'Resource.publisherId',
'Resource.isDeleted'
])
.leftJoin('User', 'Resource.publisherId', 'User.id')
.leftJoin('Team', 'Resource.fansubId', 'Team.id')
.select('User.name as publisherName')
.select('Team.name as fansubName')
.where(({ and, or, not, eb }) =>
.where(({ and, or, eb }) =>
and(
[
eb('Resource.isDeleted', '=', 0),
Expand Down
2 changes: 1 addition & 1 deletion scripts/api.http
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GET https://garden.onekuma.cn/api/resource/638270_Nemuri_THE_iDOLM_STER_CINDEREL
Content-Type: application/json

### Get the resource detail by id
GET https://garden.onekuma.cn/api/resource/638270
GET https://garden.onekuma.cn/api/resource/652885
Content-Type: application/json

### List the second page of resources
Expand Down

0 comments on commit b95167d

Please sign in to comment.