Skip to content

Commit

Permalink
Small fixes to resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Jan 16, 2024
1 parent 91384ef commit 1626888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/server-extension/resolvers/VideosResolver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class VideosResolver {
@Info() info: GraphQLResolveInfo,
@Ctx() ctx: Context
): Promise<RecommendedVideosQuery> {
const { listQuery } = buildRecommendationsVideoQuery(info, ctx)
const listQuery = buildRecommendationsVideoQuery(info, ctx)
// get videosIds from recombee
let res

Expand Down Expand Up @@ -97,7 +97,7 @@ export class VideosResolver {
@Info() info: GraphQLResolveInfo,
@Ctx() ctx: Context
): Promise<RecommendedVideosQuery> {
const { listQuery } = buildRecommendationsVideoQuery(info, ctx)
const listQuery = buildRecommendationsVideoQuery(info, ctx)
// get videosIds from recombee
let res

Expand Down
10 changes: 2 additions & 8 deletions src/server-extension/resolvers/VideosResolver/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ export function buildRecommendationsVideoQuery(info: GraphQLResolveInfo, ctx: Co
const tree = getResolveTree(info)

// Extract subsquid-supported Channel fields
const videoSubTree = tree.fieldsByTypeName.HomepageVideosConnection.video
const videoSubTree = tree.fieldsByTypeName.RecommendedVideosQuery.video
const videoFields = parseAnyTree(model, 'Video', info.schema, videoSubTree)

// Generate query using subsquid's ListQuery
const listQuery = new ListQuery(model, ctx.openreader.dialect, 'Video', videoFields, {})

return {
listQuery,
recommId: tree.fieldsByTypeName.HomepageVideosConnection.recommId,
numberNextRecommsCalls: tree.fieldsByTypeName.HomepageVideosConnection.numberNextRecommsCalls,
}
return new ListQuery(model, ctx.openreader.dialect, 'Video', videoFields, {})
}

0 comments on commit 1626888

Please sign in to comment.