Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C-3478] Backlink to album from track page #7074

Merged
merged 22 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 135 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"web:dev": "npm run start:dev -w audius-client",
"web:prod": "npm run start:prod -w audius-client",
"web:stage": "npm run start:stage -w audius-client",
"web:stage-local-trpc": "npm run start:stage-local-trpc -w audius-client",
"DESKTOP====================================": "",
"desktop:dev": "concurrently -k 'BROWSER=none npm run start:dev -w audius-client' 'wait-on http://0.0.0.0:3000 && npm run electron:localhost -w audius-client -- 3000'",
"desktop:prod": "concurrently -k 'BROWSER=none npm run start:prod -w audius-client' 'wait-on http://0.0.0.0:3002 && npm run electron:localhost -w audius-client -- 3002'",
Expand Down
26 changes: 13 additions & 13 deletions packages/trpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
"test": "vitest"
},
"dependencies": {
"@elastic/elasticsearch": "^8.10.0",
"@elastic/elasticsearch": "8.11.0",
"@trpc/server": "10.38.4",
"cors": "2.8.5",
"dataloader": "2.2.2",
"debug": "^4.3.4",
"dotenv": "^16.3.1",
"debug": "4.3.4",
"dotenv": "16.3.1",
"express": "4.18.2",
"postgres": "3.3.5",
"postgres": "3.4.3",
"swagger-ui-express": "5.0.0",
"trpc-openapi": "1.2.0",
"zod": "3.22.2"
},
"devDependencies": {
"@rmp135/sql-ts": "^1.18.0",
"@types/cors": "^2.8.13",
"@types/node": "^18.16.16",
"@types/swagger-ui-express": "^4.1.4",
"eslint": "^8.40.0",
"tsx": "^3.12.7",
"typescript": "^5.1.3",
"vite-node": "^0.34.6",
"vitest": "^0.34.6"
"@rmp135/sql-ts": "1.18.0",
"@types/cors": "2.8.13",
"@types/node": "18.16.16",
"@types/swagger-ui-express": "4.1.4",
"eslint": "8.56.0",
"tsx": "3.12.7",
"typescript": "5.0.4",
"vite-node": "0.34.6",
"vitest": "0.34.6"
}
}
41 changes: 0 additions & 41 deletions packages/trpc-server/src/routers/playlist-router.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { z } from 'zod'
import { publicProcedure, router } from '../trpc'
import { TRPCError } from '@trpc/server'
import { esc } from './search-router'
import { PlaylistRow } from '../db-tables'

export type PlaylistRouteData = {
playlist_id: number
name: string
permalink: string
artist_id: number
}

export const playlistRouter = router({
get: publicProcedure.input(z.string()).query(async ({ ctx, input }) => {
Expand All @@ -19,36 +10,4 @@ export const playlistRouter = router({
}
return row
}),

containTrackId: publicProcedure
.input(
z.object({ trackId: z.number(), collectionType: z.string().optional() })
)
.query(async ({ ctx, input }) => {
const found = await esc.search<PlaylistRow>({
index: 'playlists',
query: {
bool: {
must: [
{ term: { 'playlist_contents.track_ids.track': input.trackId } },
{ term: { is_delete: false } },
{ term: { is_private: false } },
...(input.collectionType === 'album'
? [{ term: { is_album: true } }]
: []),
...(input.collectionType === 'playlist'
? [{ term: { is_album: false } }]
: []),
],
must_not: [],
should: [],
},
},
_source: false,
})

return await ctx.loaders.playlistLoader.loadMany(
found.hits.hits.map((h) => parseInt(h._id))
)
}),
})
Loading