Skip to content

Commit

Permalink
decrease returned columns for asset search route
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Mar 17, 2024
1 parent 8c808b5 commit 18f0647
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions src/v2/routes/asset/search-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,28 @@ import { type AppHandler } from "../handler"
export const assetSearchAllFilterResponseSchema = z.object({
success: z.literal(true),
assets: z.array(
selectAssetSchema.extend({
assetTagAsset: z.array(
selectAssetTagAssetSchema.extend({
assetTag: selectAssetTagSchema,
})
),
})
selectAssetSchema
.pick({
id: true,
name: true,
extension: true,
url: true,
viewCount: true,
downloadCount: true,
fileSize: true,
width: true,
height: true,
})
.extend({
assetTagAsset: z.array(
selectAssetTagAssetSchema.pick({}).extend({
assetTag: selectAssetTagSchema.pick({
id: true,
formattedName: true,
}),
})
),
})
),
})

Expand Down Expand Up @@ -142,10 +157,30 @@ export const AssetSearchAllFilterRoute = (handler: AppHandler) => {
),
limit: 100,
offset: offset ? parseInt(offset) : 0,
columns: {
id: true,
name: true,
extension: true,
url: true,
viewCount: true,
downloadCount: true,
fileSize: true,
width: true,
height: true,
},
with: {
assetTagAsset: {
columns: {
assetTagId: false,
assetId: false,
},
with: {
assetTag: true,
assetTag: {
columns: {
id: true,
formattedName: true,
},
},
},
},
},
Expand Down

0 comments on commit 18f0647

Please sign in to comment.