<commit_before>import { getUserId, Context } from '../utils';
import { OlympiadConnection } from '../generated/prisma';

export const Query = {
  city(parent, { id }, ctx: Context, info) {
    return ctx.db.city({ id });
  },

  cities(parent, args, ctx: Context, info) {
    return ctx.db.cities({});
  },

  olympiad(parent, { id }, ctx: Context, info) {
    return ctx.db.olympiad({ id });
  },

  async olympiads(parent, args, ctx: Context, info) {
    const olympiads = await ctx.db.olympiads({});
    return olympiads.map(o => ({
      ...o,
      createdBy: ctx.db.olympiad({ id: o.id }).createdBy(),
    }));
  },

  olympiadsFeed(parent, { first, after }, ctx: Context, info) {
    return ctx.db.olympiadsConnection({ first, after });
  },

  question(parent, { id }, ctx: Context) {
    return ctx.db.question({ id });
  },
<commit_msg>Fix question resolver to return relation 'choices'<commit_after>import { getUserId, Context } from '../utils';
import { OlympiadConnection } from '../generated/prisma';

export const Query = {
  city(parent, { id }, ctx: Context, info) {
    return ctx.db.city({ id });
  },

  cities(parent, args, ctx: Context, info) {
    return ctx.db.cities({});
  },

  olympiad(parent, { id }, ctx: Context, info) {
    return ctx.db.olympiad({ id });
  },

  async olympiads(parent, args, ctx: Context, info) {
    const olympiads = await ctx.db.olympiads({});
    return olympiads.map(o => ({
      ...o,
      createdBy: ctx.db.olympiad({ id: o.id }).createdBy(),
    }));
  },

  olympiadsFeed(parent, { first, after }, ctx: Context, info) {
    return ctx.db.olympiadsConnection({ first, after });
  },

  async question(parent, { id }, ctx: Context) {
    const question = await ctx.db.question({ id });
    return {
      ...question,
      choices: await ctx.db.question({ id }).choices(),
    };
  },

{'fraction_non_alphanumeric': 0.18039003250270855, 'fraction_numerical': 0.0, 'mean_word_length': 3.050438596491228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3196660', 'n_tokens_mistral': 629, 'n_tokens_neox': 635, 'n_words': 156}