refactor: stop spreading challenge over the node (#44499)

* refactor: stop spreading challenge over the node

Instead of creating a Gatsby node with id of challenge.id, we create a
single node field that has all the challenge data.

While this makes the GraphQL queries more verbose, it means we're free
to create multiple nodes with the same challenge.id.

* test: update time-line test for new GQL schema

* test: update mocks with new GQL schema
This commit is contained in:
Oliver Eyton-Williams
2021-12-14 19:11:20 +01:00
committed by GitHub
parent 755f27093c
commit 3b560deab6
18 changed files with 593 additions and 440 deletions

View File

@@ -128,55 +128,57 @@ export interface VideoLocaleIds {
}
export type ChallengeNode = {
block: string;
challengeOrder: number;
challengeType: number;
dashedName: string;
description: string;
challengeFiles: ChallengeFiles;
fields: Fields;
forumTopicId: number;
guideUrl: string;
head: string[];
helpCategory: string;
id: string;
instructions: string;
isComingSoon: boolean;
internal?: {
content: string;
contentDigest: string;
challenge: {
block: string;
challengeOrder: number;
challengeType: number;
dashedName: string;
description: string;
fieldOwners: string[];
ignoreType: boolean | null;
mediaType: string;
owner: string;
type: string;
challengeFiles: ChallengeFiles;
fields: Fields;
forumTopicId: number;
guideUrl: string;
head: string[];
helpCategory: string;
id: string;
instructions: string;
isComingSoon: boolean;
internal?: {
content: string;
contentDigest: string;
description: string;
fieldOwners: string[];
ignoreType: boolean | null;
mediaType: string;
owner: string;
type: string;
};
notes: string;
removeComments: boolean;
isLocked: boolean;
isPrivate: boolean;
order: number;
question: Question;
required: Required[];
solutions: {
[T in FileKey]: FileKeyChallenge;
};
sourceInstanceName: string;
superOrder: number;
superBlock: SuperBlocks;
tail: string[];
template: string;
tests: Test[];
time: string;
title: string;
translationPending: boolean;
url: string;
usesMultifileEditor: boolean;
videoId: string;
videoLocaleIds?: VideoLocaleIds;
bilibiliIds?: BilibiliIds;
videoUrl: string;
};
notes: string;
removeComments: boolean;
isLocked: boolean;
isPrivate: boolean;
order: number;
question: Question;
required: Required[];
solutions: {
[T in FileKey]: FileKeyChallenge;
};
sourceInstanceName: string;
superOrder: number;
superBlock: SuperBlocks;
tail: string[];
template: string;
tests: Test[];
time: string;
title: string;
translationPending: boolean;
url: string;
usesMultifileEditor: boolean;
videoId: string;
videoLocaleIds?: VideoLocaleIds;
bilibiliIds?: BilibiliIds;
videoUrl: string;
};
export type AllChallengeNode = {