From da899270213a609dc9bf83ec0bd9a6c373f9d6eb Mon Sep 17 00:00:00 2001 From: aaronshiel Date: Thu, 25 Jan 2024 23:06:37 -0800 Subject: [PATCH] defaultTopics --- node/src/gql/mutation/me/subject-update.ts | 4 ++-- node/src/gql/types/subject.ts | 2 +- node/src/models/Subject.ts | 4 ++-- node/test/fixtures/mongodb/data-default.js | 2 +- node/test/graphql/mutation/me/subject-update.spec.ts | 6 +++--- node/test/graphql/query/subjects.spec.ts | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/node/src/gql/mutation/me/subject-update.ts b/node/src/gql/mutation/me/subject-update.ts index c89120e..88bdc60 100644 --- a/node/src/gql/mutation/me/subject-update.ts +++ b/node/src/gql/mutation/me/subject-update.ts @@ -33,7 +33,7 @@ export interface CategoryUpdateInput { id: string; name: string; description: string; - defaultTopic: string; + defaultTopics: string[]; } export const CategoryInputType = new GraphQLInputObjectType({ @@ -42,7 +42,7 @@ export const CategoryInputType = new GraphQLInputObjectType({ id: { type: GraphQLID }, name: { type: GraphQLString }, description: { type: GraphQLString }, - defaultTopic: { type: GraphQLString }, + defaultTopics: { type: GraphQLList(GraphQLString) }, }), }); diff --git a/node/src/gql/types/subject.ts b/node/src/gql/types/subject.ts index f365203..03eb4e0 100644 --- a/node/src/gql/types/subject.ts +++ b/node/src/gql/types/subject.ts @@ -22,7 +22,7 @@ export const CategoryType = new GraphQLObjectType({ id: { type: GraphQLID }, name: { type: GraphQLString }, description: { type: GraphQLString }, - defaultTopic: { type: GraphQLString }, + defaultTopics: { type: GraphQLList(GraphQLString) }, }, }); diff --git a/node/src/models/Subject.ts b/node/src/models/Subject.ts index 40b374c..8848b64 100644 --- a/node/src/models/Subject.ts +++ b/node/src/models/Subject.ts @@ -24,7 +24,7 @@ export interface CategoryProps { id: string; name: string; description: string; - defaultTopic: string; + defaultTopics: string[]; } export interface Category extends CategoryProps, Document { @@ -35,7 +35,7 @@ const CategorySchema = new Schema({ id: { type: String }, name: { type: String }, description: { type: String }, - defaultTopic: { type: String, default: '' }, + defaultTopics: [{ type: String, default: '' }], }); export interface TopicProps { diff --git a/node/test/fixtures/mongodb/data-default.js b/node/test/fixtures/mongodb/data-default.js index 93cd0c8..ce87a30 100644 --- a/node/test/fixtures/mongodb/data-default.js +++ b/node/test/fixtures/mongodb/data-default.js @@ -297,7 +297,7 @@ module.exports = { id: 'category', name: 'Category', description: 'A test category', - defaultTopic: '5ffdf41a1ee2c62320b49ec2', + defaultTopics: ['5ffdf41a1ee2c62320b49ec2'], }, ], topics: [ diff --git a/node/test/graphql/mutation/me/subject-update.spec.ts b/node/test/graphql/mutation/me/subject-update.spec.ts index aebf01d..692f88a 100644 --- a/node/test/graphql/mutation/me/subject-update.spec.ts +++ b/node/test/graphql/mutation/me/subject-update.spec.ts @@ -100,7 +100,7 @@ describe('updateSubject', () => { { id: 'newcategory', name: 'New category', - defaultTopic: '5ffdf41a1ee2c62320b49ec3', + defaultTopics: ['5ffdf41a1ee2c62320b49ec3'], }, ], topics: [ @@ -160,7 +160,7 @@ describe('updateSubject', () => { categories { id name - defaultTopic + defaultTopics } topics { id @@ -197,7 +197,7 @@ describe('updateSubject', () => { { id: 'newcategory', name: 'New category', - defaultTopic: '5ffdf41a1ee2c62320b49ec3', + defaultTopics: ['5ffdf41a1ee2c62320b49ec3'], }, ], topics: [ diff --git a/node/test/graphql/query/subjects.spec.ts b/node/test/graphql/query/subjects.spec.ts index 9cf9d15..d1aa797 100644 --- a/node/test/graphql/query/subjects.spec.ts +++ b/node/test/graphql/query/subjects.spec.ts @@ -36,7 +36,7 @@ describe('subjects', () => { name isRequired categories{ - defaultTopic + defaultTopics } } } @@ -65,7 +65,7 @@ describe('subjects', () => { isRequired: true, categories: [ { - defaultTopic: '5ffdf41a1ee2c62320b49ec2', + defaultTopics: ['5ffdf41a1ee2c62320b49ec2'], }, ], },