diff --git a/client/src/components/TagPicker/TagPicker.jsx b/client/src/components/TagPicker/TagPicker.jsx index d36f71028..0b25a89ea 100644 --- a/client/src/components/TagPicker/TagPicker.jsx +++ b/client/src/components/TagPicker/TagPicker.jsx @@ -16,7 +16,7 @@ const TagPicker = ({ label, icon, tags, onChange }) => { const [opened, setOpened] = useState(false) const ref = useClickOutside(() => setOpened(false)) - const tagCategories = conf ? conf.tagCategories : [] + const subjectCategories = conf ? conf.subjectCategories : [] return (
@@ -45,7 +45,7 @@ const TagPicker = ({ label, icon, tags, onChange }) => { />
- {sortBy(tagCategories, ['order']).map(category => ( + {sortBy(subjectCategories, ['order']).map(category => (
{sortBy(category.labels, ['order']).map(label => { const isSelected = !!tags.find(t => t.id === label.id) diff --git a/client/src/components/UsersList/UsersList.jsx b/client/src/components/UsersList/UsersList.jsx index e80588647..aa2f53451 100644 --- a/client/src/components/UsersList/UsersList.jsx +++ b/client/src/components/UsersList/UsersList.jsx @@ -18,7 +18,7 @@ const UsersList = () => { const users = usersData ? usersData.users : [] const specialists = usersData ? usersData.users.filter(user => user.specialties.length > 0) : [] const services = servicesData - ? servicesData.configuration.tagCategories.find(category => category.name === 'services') + ? servicesData.configuration.subjectCategories.find(category => category.name === 'services') ?.labels : null diff --git a/client/src/components/UsersList/queries.js b/client/src/components/UsersList/queries.js index e9a956d2e..e92076fdc 100644 --- a/client/src/components/UsersList/queries.js +++ b/client/src/components/UsersList/queries.js @@ -4,7 +4,7 @@ export const GET_TAG_CATEGORIES = gql` query { configuration { id - tagCategories { + subjectCategories { id name labels { diff --git a/client/src/scenes/Home/components/Searchbar/Searchbar.jsx b/client/src/scenes/Home/components/Searchbar/Searchbar.jsx index d01d5ca70..8f38a0324 100644 --- a/client/src/scenes/Home/components/Searchbar/Searchbar.jsx +++ b/client/src/scenes/Home/components/Searchbar/Searchbar.jsx @@ -13,9 +13,9 @@ const Searchbar = ({ text, tags, loading, onTextChange, onTagsChange }) => { const intl = getIntl(Searchbar) const conf = useConfiguration() - const tagLabels = tags + const subjects = tags .map(tag => - conf.tagCategories + conf.subjectCategories .reduce((acc, cat) => acc.concat(cat.labels), []) .find(label => label.name === tag) ) @@ -45,7 +45,7 @@ const Searchbar = ({ text, tags, loading, onTextChange, onTagsChange }) => {
diff --git a/client/src/scenes/Settings/Settings.jsx b/client/src/scenes/Settings/Settings.jsx index dcb53b2a1..0bb85a05e 100644 --- a/client/src/scenes/Settings/Settings.jsx +++ b/client/src/scenes/Settings/Settings.jsx @@ -55,7 +55,7 @@ const Settings = ({ configuration: conf }) => { mutate({ variables: { title: state.title, - tagCategories: serializeTags(state.tagCategories), + subjectCategories: serializeTags(state.subjectCategories), algoliaSynonyms: listToSynonyms(state.synonyms), workplaceSharing: state.workplaceSharing, authorizedDomains: state.authorizedDomains diff --git a/client/src/scenes/Settings/helpers.js b/client/src/scenes/Settings/helpers.js index c12b0aa32..b54914b28 100644 --- a/client/src/scenes/Settings/helpers.js +++ b/client/src/scenes/Settings/helpers.js @@ -18,7 +18,7 @@ export const reducer = (state, action) => { case 'change_slack_commandkey': return { ...state, slackCommandKey: action.data } case 'change_tags': - return { ...state, tagCategories: action.data } + return { ...state, subjectCategories: action.data } default: return { ...state, diff --git a/client/src/scenes/Settings/queries.js b/client/src/scenes/Settings/queries.js index 0b333e59f..47f18b47d 100644 --- a/client/src/scenes/Settings/queries.js +++ b/client/src/scenes/Settings/queries.js @@ -3,7 +3,7 @@ import gql from 'graphql-tag' const CONFIGURATION_FRAGMENT = ` id title - tagCategories { + subjectCategories { id order name @@ -32,7 +32,7 @@ export const GET_CONFIGURATION = gql` export const UPDATE_CONFIGURATION = gql` mutation updateConfiguration( $title: String! - $tagCategories: Json! + $subjectCategories: Json! $algoliaSynonyms: Json! $workplaceSharing: Boolean! $authorizedDomains: [String!]! @@ -41,7 +41,7 @@ export const UPDATE_CONFIGURATION = gql` ) { updateConfiguration( title: $title - tagCategories: $tagCategories + subjectCategories: $subjectCategories algoliaSynonyms: $algoliaSynonyms workplaceSharing: $workplaceSharing authorizedDomains: $authorizedDomains diff --git a/client/src/scenes/Settings/scenes/Tags.jsx b/client/src/scenes/Settings/scenes/Tags.jsx index dea2ad84c..5baaec7d5 100644 --- a/client/src/scenes/Settings/scenes/Tags.jsx +++ b/client/src/scenes/Settings/scenes/Tags.jsx @@ -11,7 +11,7 @@ const Tags = ({ state, onTagsChange }) => { return ( - + ) } diff --git a/e2e/client.test.js b/e2e/client.test.js index 29982e301..2b61105fc 100644 --- a/e2e/client.test.js +++ b/e2e/client.test.js @@ -56,7 +56,7 @@ const upsertConfig = /* GraphQL */ `mutation UpsertConfig{ algoliaApiKey: "${process.env.ALGOLIA_API_KEY_ALL}" auth0Domain: "${process.env.AUTH0_DOMAIN}" auth0ClientId: "${process.env.AUTH0_CLIENT_ID}" - tagCategories: { + subjectCategories: { create: [ { name: "services", @@ -113,7 +113,7 @@ const upsertConfig = /* GraphQL */ `mutation UpsertConfig{ mailgunDomain mailgunApiKey slackChannelHook - tagCategories { + subjectCategories { order name labels { @@ -139,7 +139,7 @@ const upsertConfigMutation = async apiContext => { const tagsId = /* GraphQL */ ` query GetAllTags { - tagLabels { + subjects { id name } @@ -153,7 +153,7 @@ const tagsQuery = async apiContext => { } }) const jsonRes = await res.json() - const results = await jsonRes.data.tagLabels + const results = await jsonRes.data.subjects const tag = results[0] const tagEdit = results[1] return { tag, tagEdit } diff --git a/server/prisma/datamodel.graphql b/server/prisma/datamodel.graphql index 9bda86629..54d8cbbae 100644 --- a/server/prisma/datamodel.graphql +++ b/server/prisma/datamodel.graphql @@ -68,7 +68,7 @@ type Flag { type Tag { id: ID! @unique @id - label: TagLabel @relation(name: "TagsLabel", link: TABLE) + label: Subject @relation(name: "TagSubject", link: TABLE) node: ZNode! @relation(name: "NodeTags") user: User! @relation(name: "UserTags", link: TABLE) @@ -77,25 +77,25 @@ type Tag { updatedAt: DateTime! @updatedAt } -type TagLabel { +type Subject { id: ID! @unique @id name: String! - tags: [Tag!]! @relation(name: "TagsLabel", onDelete: CASCADE) + tags: [Tag!]! @relation(name: "TagSubject", onDelete: CASCADE) specialists: [User!]! @relation(name: "UserSpecialties", link: TABLE) order: Int! - category: TagCategory! @relation(name: "TagLabelsCategory", link: TABLE) + category: SubjectCategory! @relation(name: "TagLabelsCategory", link: TABLE) createdAt: DateTime! @createdAt updatedAt: DateTime! @updatedAt } -type TagCategory { +type SubjectCategory { id: ID! @unique @id name: String! - labels: [TagLabel!]! @relation(name: "TagLabelsCategory", onDelete: CASCADE) + labels: [Subject!]! @relation(name: "SubjectCategory", onDelete: CASCADE) order: Int! configuration: Configuration! @relation(name: "ConfigurationTags", link: TABLE) @@ -136,7 +136,7 @@ type User { flags: [Flag!]! @relation(name: "UserFlags") tags: [Tag!]! @relation(name: "UserTags") - specialties: [TagLabel!]! @relation(name: "UserSpecialties") + specialties: [Subject!]! @relation(name: "UserSpecialties") history: [HistoryAction!]! @relation(name: "UserHistoryActions") @@ -166,7 +166,7 @@ type Configuration { slackCommandKey: String tags: Json - tagCategories: [TagCategory!]! @relation(name: "ConfigurationTags", onDelete: CASCADE) + subjectCategories: [SubjectCategory!]! @relation(name: "ConfigurationTags", onDelete: CASCADE) workplaceSharing: Boolean @default(value: false) diff --git a/server/scripts/prisma_new_service/index.js b/server/scripts/prisma_new_service/index.js index b7e2bbfaf..e3cb736f2 100644 --- a/server/scripts/prisma_new_service/index.js +++ b/server/scripts/prisma_new_service/index.js @@ -62,7 +62,7 @@ const main = async () => { algoliaSynonyms: "{\"objectId\": \"testSynonyms\", \"type\": \"synonym\", \"synonyms\": [\"hello\", \"hi\"]}" mailgunDomain: "${MAILGUN_DOMAIN || ''}" mailgunApiKey: "${MAILGUN_API_KEY || ''}" - tagCategories: { + subjectCategories: { create: [ { name: "services", diff --git a/server/scripts/tmp_tag_resync/part1.js b/server/scripts/tmp_tag_resync/part1.js index e6ba71045..56ae5e051 100644 --- a/server/scripts/tmp_tag_resync/part1.js +++ b/server/scripts/tmp_tag_resync/part1.js @@ -21,7 +21,7 @@ const resync = async (name, stage) => { const tagsCategories = await Promise.all( categories.map(([name, tags], order) => - prisma.mutation.createTagCategory( + prisma.mutation.createSubjectCategory( { data: { name, @@ -50,7 +50,7 @@ const resync = async (name, stage) => { ) ) - const tagLabels = tagsCategories.reduce((acc, cat) => acc.concat(cat.labels), []) + const subjects = tagsCategories.reduce((acc, cat) => acc.concat(cat.labels), []) const tags = await prisma.query.tags( null, @@ -64,8 +64,8 @@ const resync = async (name, stage) => { return Promise.all( tags.map(tag => { - const tagLabel = tagLabels.find(label => label.name === tag.label) - if (!tagLabel) { + const subject = subjects.find(label => label.name === tag.label) + if (!subject) { console.log(`Unknown tag "${tag.label}" on "${tag.id}"`) return } @@ -73,7 +73,7 @@ const resync = async (name, stage) => { where: { id: tag.id }, data: { // label: null, // I'll manually remove label. This is a security in case something goes wrong - tagLabel: { connect: { id: tagLabel.id } } + subject: { connect: { id: subject.id } } } }) }) diff --git a/server/src/endpoints/configuration.js b/server/src/endpoints/configuration.js index d19ed312b..5db842977 100644 --- a/server/src/endpoints/configuration.js +++ b/server/src/endpoints/configuration.js @@ -14,7 +14,7 @@ const configurationEndpoint = multiTenant => async (req, res) => title, auth0Domain, auth0ClientId, - tagCategories, + subjectCategories, workplaceSharing, bugReporting } = multiTenant.current(req)._meta.configuration @@ -24,7 +24,7 @@ const configurationEndpoint = multiTenant => async (req, res) => title, auth0Domain, auth0ClientId, - tagCategories, + subjectCategories, workplaceSharing, bugReporting }) diff --git a/server/src/generated/prisma.graphql b/server/src/generated/prisma.graphql index bb6d875f8..e0594d4b6 100644 --- a/server/src/generated/prisma.graphql +++ b/server/src/generated/prisma.graphql @@ -22,15 +22,15 @@ type AggregateSource { count: Int! } -type AggregateTag { +type AggregateSubject { count: Int! } -type AggregateTagCategory { +type AggregateSubjectCategory { count: Int! } -type AggregateTagLabel { +type AggregateTag { count: Int! } @@ -371,15 +371,15 @@ type Configuration { slackChannelHook: String slackCommandKey: String tags: Json - tagCategories( - where: TagCategoryWhereInput - orderBy: TagCategoryOrderByInput + subjectCategories( + where: SubjectCategoryWhereInput + orderBy: SubjectCategoryOrderByInput skip: Int after: String before: String first: Int last: Int - ): [TagCategory!] + ): [SubjectCategory!] workplaceSharing: Boolean bugReporting: BugReporting createdAt: DateTime! @@ -411,17 +411,17 @@ input ConfigurationCreateInput { slackChannelHook: String slackCommandKey: String tags: Json - tagCategories: TagCategoryCreateManyWithoutConfigurationInput + subjectCategories: SubjectCategoryCreateManyWithoutConfigurationInput workplaceSharing: Boolean bugReporting: BugReporting } -input ConfigurationCreateOneWithoutTagCategoriesInput { - create: ConfigurationCreateWithoutTagCategoriesInput +input ConfigurationCreateOneWithoutSubjectCategoriesInput { + create: ConfigurationCreateWithoutSubjectCategoriesInput connect: ConfigurationWhereUniqueInput } -input ConfigurationCreateWithoutTagCategoriesInput { +input ConfigurationCreateWithoutSubjectCategoriesInput { id: ID name: String! title: String @@ -539,7 +539,7 @@ input ConfigurationUpdateInput { slackChannelHook: String slackCommandKey: String tags: Json - tagCategories: TagCategoryUpdateManyWithoutConfigurationInput + subjectCategories: SubjectCategoryUpdateManyWithoutConfigurationInput workplaceSharing: Boolean bugReporting: BugReporting } @@ -562,14 +562,14 @@ input ConfigurationUpdateManyMutationInput { bugReporting: BugReporting } -input ConfigurationUpdateOneRequiredWithoutTagCategoriesInput { - create: ConfigurationCreateWithoutTagCategoriesInput - update: ConfigurationUpdateWithoutTagCategoriesDataInput - upsert: ConfigurationUpsertWithoutTagCategoriesInput +input ConfigurationUpdateOneRequiredWithoutSubjectCategoriesInput { + create: ConfigurationCreateWithoutSubjectCategoriesInput + update: ConfigurationUpdateWithoutSubjectCategoriesDataInput + upsert: ConfigurationUpsertWithoutSubjectCategoriesInput connect: ConfigurationWhereUniqueInput } -input ConfigurationUpdateWithoutTagCategoriesDataInput { +input ConfigurationUpdateWithoutSubjectCategoriesDataInput { name: String title: String auth0Domain: String @@ -587,9 +587,9 @@ input ConfigurationUpdateWithoutTagCategoriesDataInput { bugReporting: BugReporting } -input ConfigurationUpsertWithoutTagCategoriesInput { - update: ConfigurationUpdateWithoutTagCategoriesDataInput! - create: ConfigurationCreateWithoutTagCategoriesInput! +input ConfigurationUpsertWithoutSubjectCategoriesInput { + update: ConfigurationUpdateWithoutSubjectCategoriesDataInput! + create: ConfigurationCreateWithoutSubjectCategoriesInput! } input ConfigurationWhereInput { @@ -747,9 +747,9 @@ input ConfigurationWhereInput { slackCommandKey_not_starts_with: String slackCommandKey_ends_with: String slackCommandKey_not_ends_with: String - tagCategories_every: TagCategoryWhereInput - tagCategories_some: TagCategoryWhereInput - tagCategories_none: TagCategoryWhereInput + subjectCategories_every: SubjectCategoryWhereInput + subjectCategories_some: SubjectCategoryWhereInput + subjectCategories_none: SubjectCategoryWhereInput workplaceSharing: Boolean workplaceSharing_not: Boolean bugReporting: BugReporting @@ -1448,37 +1448,37 @@ type Mutation { ): Source! deleteSource(where: SourceWhereUniqueInput!): Source deleteManySources(where: SourceWhereInput): BatchPayload! + createSubject(data: SubjectCreateInput!): Subject! + updateSubject(data: SubjectUpdateInput!, where: SubjectWhereUniqueInput!): Subject + updateManySubjects(data: SubjectUpdateManyMutationInput!, where: SubjectWhereInput): BatchPayload! + upsertSubject( + where: SubjectWhereUniqueInput! + create: SubjectCreateInput! + update: SubjectUpdateInput! + ): Subject! + deleteSubject(where: SubjectWhereUniqueInput!): Subject + deleteManySubjects(where: SubjectWhereInput): BatchPayload! + createSubjectCategory(data: SubjectCategoryCreateInput!): SubjectCategory! + updateSubjectCategory( + data: SubjectCategoryUpdateInput! + where: SubjectCategoryWhereUniqueInput! + ): SubjectCategory + updateManySubjectCategories( + data: SubjectCategoryUpdateManyMutationInput! + where: SubjectCategoryWhereInput + ): BatchPayload! + upsertSubjectCategory( + where: SubjectCategoryWhereUniqueInput! + create: SubjectCategoryCreateInput! + update: SubjectCategoryUpdateInput! + ): SubjectCategory! + deleteSubjectCategory(where: SubjectCategoryWhereUniqueInput!): SubjectCategory + deleteManySubjectCategories(where: SubjectCategoryWhereInput): BatchPayload! createTag(data: TagCreateInput!): Tag! updateTag(data: TagUpdateInput!, where: TagWhereUniqueInput!): Tag upsertTag(where: TagWhereUniqueInput!, create: TagCreateInput!, update: TagUpdateInput!): Tag! deleteTag(where: TagWhereUniqueInput!): Tag deleteManyTags(where: TagWhereInput): BatchPayload! - createTagCategory(data: TagCategoryCreateInput!): TagCategory! - updateTagCategory(data: TagCategoryUpdateInput!, where: TagCategoryWhereUniqueInput!): TagCategory - updateManyTagCategories( - data: TagCategoryUpdateManyMutationInput! - where: TagCategoryWhereInput - ): BatchPayload! - upsertTagCategory( - where: TagCategoryWhereUniqueInput! - create: TagCategoryCreateInput! - update: TagCategoryUpdateInput! - ): TagCategory! - deleteTagCategory(where: TagCategoryWhereUniqueInput!): TagCategory - deleteManyTagCategories(where: TagCategoryWhereInput): BatchPayload! - createTagLabel(data: TagLabelCreateInput!): TagLabel! - updateTagLabel(data: TagLabelUpdateInput!, where: TagLabelWhereUniqueInput!): TagLabel - updateManyTagLabels( - data: TagLabelUpdateManyMutationInput! - where: TagLabelWhereInput - ): BatchPayload! - upsertTagLabel( - where: TagLabelWhereUniqueInput! - create: TagLabelCreateInput! - update: TagLabelUpdateInput! - ): TagLabel! - deleteTagLabel(where: TagLabelWhereUniqueInput!): TagLabel - deleteManyTagLabels(where: TagLabelWhereInput): BatchPayload! createUser(data: UserCreateInput!): User! updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User updateManyUsers(data: UserUpdateManyMutationInput!, where: UserWhereInput): BatchPayload! @@ -1633,63 +1633,63 @@ type Query { first: Int last: Int ): SourceConnection! - tag(where: TagWhereUniqueInput!): Tag - tags( - where: TagWhereInput - orderBy: TagOrderByInput + subject(where: SubjectWhereUniqueInput!): Subject + subjects( + where: SubjectWhereInput + orderBy: SubjectOrderByInput skip: Int after: String before: String first: Int last: Int - ): [Tag]! - tagsConnection( - where: TagWhereInput - orderBy: TagOrderByInput + ): [Subject]! + subjectsConnection( + where: SubjectWhereInput + orderBy: SubjectOrderByInput skip: Int after: String before: String first: Int last: Int - ): TagConnection! - tagCategory(where: TagCategoryWhereUniqueInput!): TagCategory - tagCategories( - where: TagCategoryWhereInput - orderBy: TagCategoryOrderByInput + ): SubjectConnection! + subjectCategory(where: SubjectCategoryWhereUniqueInput!): SubjectCategory + subjectCategories( + where: SubjectCategoryWhereInput + orderBy: SubjectCategoryOrderByInput skip: Int after: String before: String first: Int last: Int - ): [TagCategory]! - tagCategoriesConnection( - where: TagCategoryWhereInput - orderBy: TagCategoryOrderByInput + ): [SubjectCategory]! + subjectCategoriesConnection( + where: SubjectCategoryWhereInput + orderBy: SubjectCategoryOrderByInput skip: Int after: String before: String first: Int last: Int - ): TagCategoryConnection! - tagLabel(where: TagLabelWhereUniqueInput!): TagLabel - tagLabels( - where: TagLabelWhereInput - orderBy: TagLabelOrderByInput + ): SubjectCategoryConnection! + tag(where: TagWhereUniqueInput!): Tag + tags( + where: TagWhereInput + orderBy: TagOrderByInput skip: Int after: String before: String first: Int last: Int - ): [TagLabel]! - tagLabelsConnection( - where: TagLabelWhereInput - orderBy: TagLabelOrderByInput + ): [Tag]! + tagsConnection( + where: TagWhereInput + orderBy: TagOrderByInput skip: Int after: String before: String first: Int last: Int - ): TagLabelConnection! + ): TagConnection! user(where: UserWhereUniqueInput!): User users( where: UserWhereInput @@ -2315,91 +2315,95 @@ input SourceWhereUniqueInput { id: ID } -type Subscription { - answer(where: AnswerSubscriptionWhereInput): AnswerSubscriptionPayload - configuration(where: ConfigurationSubscriptionWhereInput): ConfigurationSubscriptionPayload - flag(where: FlagSubscriptionWhereInput): FlagSubscriptionPayload - historyAction(where: HistoryActionSubscriptionWhereInput): HistoryActionSubscriptionPayload - question(where: QuestionSubscriptionWhereInput): QuestionSubscriptionPayload - source(where: SourceSubscriptionWhereInput): SourceSubscriptionPayload - tag(where: TagSubscriptionWhereInput): TagSubscriptionPayload - tagCategory(where: TagCategorySubscriptionWhereInput): TagCategorySubscriptionPayload - tagLabel(where: TagLabelSubscriptionWhereInput): TagLabelSubscriptionPayload - user(where: UserSubscriptionWhereInput): UserSubscriptionPayload - zNode(where: ZNodeSubscriptionWhereInput): ZNodeSubscriptionPayload -} - -type Tag { +type Subject { id: ID! - label: TagLabel - node: ZNode! - user: User! + name: String! + tags( + where: TagWhereInput + orderBy: TagOrderByInput + skip: Int + after: String + before: String + first: Int + last: Int + ): [Tag!] + specialists( + where: UserWhereInput + orderBy: UserOrderByInput + skip: Int + after: String + before: String + first: Int + last: Int + ): [User!] + order: Int! + category: SubjectCategory! createdAt: DateTime! updatedAt: DateTime! } -type TagCategory { +type SubjectCategory { id: ID! name: String! labels( - where: TagLabelWhereInput - orderBy: TagLabelOrderByInput + where: SubjectWhereInput + orderBy: SubjectOrderByInput skip: Int after: String before: String first: Int last: Int - ): [TagLabel!] + ): [Subject!] order: Int! configuration: Configuration! createdAt: DateTime! updatedAt: DateTime! } -type TagCategoryConnection { +type SubjectCategoryConnection { pageInfo: PageInfo! - edges: [TagCategoryEdge]! - aggregate: AggregateTagCategory! + edges: [SubjectCategoryEdge]! + aggregate: AggregateSubjectCategory! } -input TagCategoryCreateInput { +input SubjectCategoryCreateInput { id: ID name: String! - labels: TagLabelCreateManyWithoutCategoryInput + labels: SubjectCreateManyWithoutCategoryInput order: Int! - configuration: ConfigurationCreateOneWithoutTagCategoriesInput! + configuration: ConfigurationCreateOneWithoutSubjectCategoriesInput! } -input TagCategoryCreateManyWithoutConfigurationInput { - create: [TagCategoryCreateWithoutConfigurationInput!] - connect: [TagCategoryWhereUniqueInput!] +input SubjectCategoryCreateManyWithoutConfigurationInput { + create: [SubjectCategoryCreateWithoutConfigurationInput!] + connect: [SubjectCategoryWhereUniqueInput!] } -input TagCategoryCreateOneWithoutLabelsInput { - create: TagCategoryCreateWithoutLabelsInput - connect: TagCategoryWhereUniqueInput +input SubjectCategoryCreateOneWithoutLabelsInput { + create: SubjectCategoryCreateWithoutLabelsInput + connect: SubjectCategoryWhereUniqueInput } -input TagCategoryCreateWithoutConfigurationInput { +input SubjectCategoryCreateWithoutConfigurationInput { id: ID name: String! - labels: TagLabelCreateManyWithoutCategoryInput + labels: SubjectCreateManyWithoutCategoryInput order: Int! } -input TagCategoryCreateWithoutLabelsInput { +input SubjectCategoryCreateWithoutLabelsInput { id: ID name: String! order: Int! - configuration: ConfigurationCreateOneWithoutTagCategoriesInput! + configuration: ConfigurationCreateOneWithoutSubjectCategoriesInput! } -type TagCategoryEdge { - node: TagCategory! +type SubjectCategoryEdge { + node: SubjectCategory! cursor: String! } -enum TagCategoryOrderByInput { +enum SubjectCategoryOrderByInput { id_ASC id_DESC name_ASC @@ -2412,7 +2416,7 @@ enum TagCategoryOrderByInput { updatedAt_DESC } -type TagCategoryPreviousValues { +type SubjectCategoryPreviousValues { id: ID! name: String! order: Int! @@ -2420,7 +2424,7 @@ type TagCategoryPreviousValues { updatedAt: DateTime! } -input TagCategoryScalarWhereInput { +input SubjectCategoryScalarWhereInput { id: ID id_not: ID id_in: [ID!] @@ -2473,99 +2477,99 @@ input TagCategoryScalarWhereInput { updatedAt_lte: DateTime updatedAt_gt: DateTime updatedAt_gte: DateTime - AND: [TagCategoryScalarWhereInput!] - OR: [TagCategoryScalarWhereInput!] - NOT: [TagCategoryScalarWhereInput!] + AND: [SubjectCategoryScalarWhereInput!] + OR: [SubjectCategoryScalarWhereInput!] + NOT: [SubjectCategoryScalarWhereInput!] } -type TagCategorySubscriptionPayload { +type SubjectCategorySubscriptionPayload { mutation: MutationType! - node: TagCategory + node: SubjectCategory updatedFields: [String!] - previousValues: TagCategoryPreviousValues + previousValues: SubjectCategoryPreviousValues } -input TagCategorySubscriptionWhereInput { +input SubjectCategorySubscriptionWhereInput { mutation_in: [MutationType!] updatedFields_contains: String updatedFields_contains_every: [String!] updatedFields_contains_some: [String!] - node: TagCategoryWhereInput - AND: [TagCategorySubscriptionWhereInput!] - OR: [TagCategorySubscriptionWhereInput!] - NOT: [TagCategorySubscriptionWhereInput!] + node: SubjectCategoryWhereInput + AND: [SubjectCategorySubscriptionWhereInput!] + OR: [SubjectCategorySubscriptionWhereInput!] + NOT: [SubjectCategorySubscriptionWhereInput!] } -input TagCategoryUpdateInput { +input SubjectCategoryUpdateInput { name: String - labels: TagLabelUpdateManyWithoutCategoryInput + labels: SubjectUpdateManyWithoutCategoryInput order: Int - configuration: ConfigurationUpdateOneRequiredWithoutTagCategoriesInput + configuration: ConfigurationUpdateOneRequiredWithoutSubjectCategoriesInput } -input TagCategoryUpdateManyDataInput { +input SubjectCategoryUpdateManyDataInput { name: String order: Int } -input TagCategoryUpdateManyMutationInput { +input SubjectCategoryUpdateManyMutationInput { name: String order: Int } -input TagCategoryUpdateManyWithoutConfigurationInput { - create: [TagCategoryCreateWithoutConfigurationInput!] - delete: [TagCategoryWhereUniqueInput!] - connect: [TagCategoryWhereUniqueInput!] - set: [TagCategoryWhereUniqueInput!] - disconnect: [TagCategoryWhereUniqueInput!] - update: [TagCategoryUpdateWithWhereUniqueWithoutConfigurationInput!] - upsert: [TagCategoryUpsertWithWhereUniqueWithoutConfigurationInput!] - deleteMany: [TagCategoryScalarWhereInput!] - updateMany: [TagCategoryUpdateManyWithWhereNestedInput!] +input SubjectCategoryUpdateManyWithoutConfigurationInput { + create: [SubjectCategoryCreateWithoutConfigurationInput!] + delete: [SubjectCategoryWhereUniqueInput!] + connect: [SubjectCategoryWhereUniqueInput!] + set: [SubjectCategoryWhereUniqueInput!] + disconnect: [SubjectCategoryWhereUniqueInput!] + update: [SubjectCategoryUpdateWithWhereUniqueWithoutConfigurationInput!] + upsert: [SubjectCategoryUpsertWithWhereUniqueWithoutConfigurationInput!] + deleteMany: [SubjectCategoryScalarWhereInput!] + updateMany: [SubjectCategoryUpdateManyWithWhereNestedInput!] } -input TagCategoryUpdateManyWithWhereNestedInput { - where: TagCategoryScalarWhereInput! - data: TagCategoryUpdateManyDataInput! +input SubjectCategoryUpdateManyWithWhereNestedInput { + where: SubjectCategoryScalarWhereInput! + data: SubjectCategoryUpdateManyDataInput! } -input TagCategoryUpdateOneRequiredWithoutLabelsInput { - create: TagCategoryCreateWithoutLabelsInput - update: TagCategoryUpdateWithoutLabelsDataInput - upsert: TagCategoryUpsertWithoutLabelsInput - connect: TagCategoryWhereUniqueInput +input SubjectCategoryUpdateOneRequiredWithoutLabelsInput { + create: SubjectCategoryCreateWithoutLabelsInput + update: SubjectCategoryUpdateWithoutLabelsDataInput + upsert: SubjectCategoryUpsertWithoutLabelsInput + connect: SubjectCategoryWhereUniqueInput } -input TagCategoryUpdateWithoutConfigurationDataInput { +input SubjectCategoryUpdateWithoutConfigurationDataInput { name: String - labels: TagLabelUpdateManyWithoutCategoryInput + labels: SubjectUpdateManyWithoutCategoryInput order: Int } -input TagCategoryUpdateWithoutLabelsDataInput { +input SubjectCategoryUpdateWithoutLabelsDataInput { name: String order: Int - configuration: ConfigurationUpdateOneRequiredWithoutTagCategoriesInput + configuration: ConfigurationUpdateOneRequiredWithoutSubjectCategoriesInput } -input TagCategoryUpdateWithWhereUniqueWithoutConfigurationInput { - where: TagCategoryWhereUniqueInput! - data: TagCategoryUpdateWithoutConfigurationDataInput! +input SubjectCategoryUpdateWithWhereUniqueWithoutConfigurationInput { + where: SubjectCategoryWhereUniqueInput! + data: SubjectCategoryUpdateWithoutConfigurationDataInput! } -input TagCategoryUpsertWithoutLabelsInput { - update: TagCategoryUpdateWithoutLabelsDataInput! - create: TagCategoryCreateWithoutLabelsInput! +input SubjectCategoryUpsertWithoutLabelsInput { + update: SubjectCategoryUpdateWithoutLabelsDataInput! + create: SubjectCategoryCreateWithoutLabelsInput! } -input TagCategoryUpsertWithWhereUniqueWithoutConfigurationInput { - where: TagCategoryWhereUniqueInput! - update: TagCategoryUpdateWithoutConfigurationDataInput! - create: TagCategoryCreateWithoutConfigurationInput! +input SubjectCategoryUpsertWithWhereUniqueWithoutConfigurationInput { + where: SubjectCategoryWhereUniqueInput! + update: SubjectCategoryUpdateWithoutConfigurationDataInput! + create: SubjectCategoryCreateWithoutConfigurationInput! } -input TagCategoryWhereInput { +input SubjectCategoryWhereInput { id: ID id_not: ID id_in: [ID!] @@ -2594,9 +2598,9 @@ input TagCategoryWhereInput { name_not_starts_with: String name_ends_with: String name_not_ends_with: String - labels_every: TagLabelWhereInput - labels_some: TagLabelWhereInput - labels_none: TagLabelWhereInput + labels_every: SubjectWhereInput + labels_some: SubjectWhereInput + labels_none: SubjectWhereInput order: Int order_not: Int order_in: [Int!] @@ -2622,124 +2626,46 @@ input TagCategoryWhereInput { updatedAt_lte: DateTime updatedAt_gt: DateTime updatedAt_gte: DateTime - AND: [TagCategoryWhereInput!] - OR: [TagCategoryWhereInput!] - NOT: [TagCategoryWhereInput!] + AND: [SubjectCategoryWhereInput!] + OR: [SubjectCategoryWhereInput!] + NOT: [SubjectCategoryWhereInput!] } -input TagCategoryWhereUniqueInput { +input SubjectCategoryWhereUniqueInput { id: ID } -type TagConnection { +type SubjectConnection { pageInfo: PageInfo! - edges: [TagEdge]! - aggregate: AggregateTag! -} - -input TagCreateInput { - id: ID - label: TagLabelCreateOneWithoutTagsInput - node: ZNodeCreateOneWithoutTagsInput! - user: UserCreateOneWithoutTagsInput! -} - -input TagCreateManyWithoutLabelInput { - create: [TagCreateWithoutLabelInput!] - connect: [TagWhereUniqueInput!] -} - -input TagCreateManyWithoutNodeInput { - create: [TagCreateWithoutNodeInput!] - connect: [TagWhereUniqueInput!] -} - -input TagCreateManyWithoutUserInput { - create: [TagCreateWithoutUserInput!] - connect: [TagWhereUniqueInput!] + edges: [SubjectEdge]! + aggregate: AggregateSubject! } -input TagCreateWithoutLabelInput { - id: ID - node: ZNodeCreateOneWithoutTagsInput! - user: UserCreateOneWithoutTagsInput! -} - -input TagCreateWithoutNodeInput { - id: ID - label: TagLabelCreateOneWithoutTagsInput - user: UserCreateOneWithoutTagsInput! -} - -input TagCreateWithoutUserInput { - id: ID - label: TagLabelCreateOneWithoutTagsInput - node: ZNodeCreateOneWithoutTagsInput! -} - -type TagEdge { - node: Tag! - cursor: String! -} - -type TagLabel { - id: ID! - name: String! - tags( - where: TagWhereInput - orderBy: TagOrderByInput - skip: Int - after: String - before: String - first: Int - last: Int - ): [Tag!] - specialists( - where: UserWhereInput - orderBy: UserOrderByInput - skip: Int - after: String - before: String - first: Int - last: Int - ): [User!] - order: Int! - category: TagCategory! - createdAt: DateTime! - updatedAt: DateTime! -} - -type TagLabelConnection { - pageInfo: PageInfo! - edges: [TagLabelEdge]! - aggregate: AggregateTagLabel! -} - -input TagLabelCreateInput { +input SubjectCreateInput { id: ID name: String! tags: TagCreateManyWithoutLabelInput specialists: UserCreateManyWithoutSpecialtiesInput order: Int! - category: TagCategoryCreateOneWithoutLabelsInput! + category: SubjectCategoryCreateOneWithoutLabelsInput! } -input TagLabelCreateManyWithoutCategoryInput { - create: [TagLabelCreateWithoutCategoryInput!] - connect: [TagLabelWhereUniqueInput!] +input SubjectCreateManyWithoutCategoryInput { + create: [SubjectCreateWithoutCategoryInput!] + connect: [SubjectWhereUniqueInput!] } -input TagLabelCreateManyWithoutSpecialistsInput { - create: [TagLabelCreateWithoutSpecialistsInput!] - connect: [TagLabelWhereUniqueInput!] +input SubjectCreateManyWithoutSpecialistsInput { + create: [SubjectCreateWithoutSpecialistsInput!] + connect: [SubjectWhereUniqueInput!] } -input TagLabelCreateOneWithoutTagsInput { - create: TagLabelCreateWithoutTagsInput - connect: TagLabelWhereUniqueInput +input SubjectCreateOneWithoutTagsInput { + create: SubjectCreateWithoutTagsInput + connect: SubjectWhereUniqueInput } -input TagLabelCreateWithoutCategoryInput { +input SubjectCreateWithoutCategoryInput { id: ID name: String! tags: TagCreateManyWithoutLabelInput @@ -2747,28 +2673,28 @@ input TagLabelCreateWithoutCategoryInput { order: Int! } -input TagLabelCreateWithoutSpecialistsInput { +input SubjectCreateWithoutSpecialistsInput { id: ID name: String! tags: TagCreateManyWithoutLabelInput order: Int! - category: TagCategoryCreateOneWithoutLabelsInput! + category: SubjectCategoryCreateOneWithoutLabelsInput! } -input TagLabelCreateWithoutTagsInput { +input SubjectCreateWithoutTagsInput { id: ID name: String! specialists: UserCreateManyWithoutSpecialtiesInput order: Int! - category: TagCategoryCreateOneWithoutLabelsInput! + category: SubjectCategoryCreateOneWithoutLabelsInput! } -type TagLabelEdge { - node: TagLabel! +type SubjectEdge { + node: Subject! cursor: String! } -enum TagLabelOrderByInput { +enum SubjectOrderByInput { id_ASC id_DESC name_ASC @@ -2781,7 +2707,7 @@ enum TagLabelOrderByInput { updatedAt_DESC } -type TagLabelPreviousValues { +type SubjectPreviousValues { id: ID! name: String! order: Int! @@ -2789,7 +2715,7 @@ type TagLabelPreviousValues { updatedAt: DateTime! } -input TagLabelScalarWhereInput { +input SubjectScalarWhereInput { id: ID id_not: ID id_in: [ID!] @@ -2842,134 +2768,134 @@ input TagLabelScalarWhereInput { updatedAt_lte: DateTime updatedAt_gt: DateTime updatedAt_gte: DateTime - AND: [TagLabelScalarWhereInput!] - OR: [TagLabelScalarWhereInput!] - NOT: [TagLabelScalarWhereInput!] + AND: [SubjectScalarWhereInput!] + OR: [SubjectScalarWhereInput!] + NOT: [SubjectScalarWhereInput!] } -type TagLabelSubscriptionPayload { +type SubjectSubscriptionPayload { mutation: MutationType! - node: TagLabel + node: Subject updatedFields: [String!] - previousValues: TagLabelPreviousValues + previousValues: SubjectPreviousValues } -input TagLabelSubscriptionWhereInput { +input SubjectSubscriptionWhereInput { mutation_in: [MutationType!] updatedFields_contains: String updatedFields_contains_every: [String!] updatedFields_contains_some: [String!] - node: TagLabelWhereInput - AND: [TagLabelSubscriptionWhereInput!] - OR: [TagLabelSubscriptionWhereInput!] - NOT: [TagLabelSubscriptionWhereInput!] + node: SubjectWhereInput + AND: [SubjectSubscriptionWhereInput!] + OR: [SubjectSubscriptionWhereInput!] + NOT: [SubjectSubscriptionWhereInput!] } -input TagLabelUpdateInput { +input SubjectUpdateInput { name: String tags: TagUpdateManyWithoutLabelInput specialists: UserUpdateManyWithoutSpecialtiesInput order: Int - category: TagCategoryUpdateOneRequiredWithoutLabelsInput + category: SubjectCategoryUpdateOneRequiredWithoutLabelsInput } -input TagLabelUpdateManyDataInput { +input SubjectUpdateManyDataInput { name: String order: Int } -input TagLabelUpdateManyMutationInput { +input SubjectUpdateManyMutationInput { name: String order: Int } -input TagLabelUpdateManyWithoutCategoryInput { - create: [TagLabelCreateWithoutCategoryInput!] - delete: [TagLabelWhereUniqueInput!] - connect: [TagLabelWhereUniqueInput!] - set: [TagLabelWhereUniqueInput!] - disconnect: [TagLabelWhereUniqueInput!] - update: [TagLabelUpdateWithWhereUniqueWithoutCategoryInput!] - upsert: [TagLabelUpsertWithWhereUniqueWithoutCategoryInput!] - deleteMany: [TagLabelScalarWhereInput!] - updateMany: [TagLabelUpdateManyWithWhereNestedInput!] +input SubjectUpdateManyWithoutCategoryInput { + create: [SubjectCreateWithoutCategoryInput!] + delete: [SubjectWhereUniqueInput!] + connect: [SubjectWhereUniqueInput!] + set: [SubjectWhereUniqueInput!] + disconnect: [SubjectWhereUniqueInput!] + update: [SubjectUpdateWithWhereUniqueWithoutCategoryInput!] + upsert: [SubjectUpsertWithWhereUniqueWithoutCategoryInput!] + deleteMany: [SubjectScalarWhereInput!] + updateMany: [SubjectUpdateManyWithWhereNestedInput!] } -input TagLabelUpdateManyWithoutSpecialistsInput { - create: [TagLabelCreateWithoutSpecialistsInput!] - delete: [TagLabelWhereUniqueInput!] - connect: [TagLabelWhereUniqueInput!] - set: [TagLabelWhereUniqueInput!] - disconnect: [TagLabelWhereUniqueInput!] - update: [TagLabelUpdateWithWhereUniqueWithoutSpecialistsInput!] - upsert: [TagLabelUpsertWithWhereUniqueWithoutSpecialistsInput!] - deleteMany: [TagLabelScalarWhereInput!] - updateMany: [TagLabelUpdateManyWithWhereNestedInput!] +input SubjectUpdateManyWithoutSpecialistsInput { + create: [SubjectCreateWithoutSpecialistsInput!] + delete: [SubjectWhereUniqueInput!] + connect: [SubjectWhereUniqueInput!] + set: [SubjectWhereUniqueInput!] + disconnect: [SubjectWhereUniqueInput!] + update: [SubjectUpdateWithWhereUniqueWithoutSpecialistsInput!] + upsert: [SubjectUpsertWithWhereUniqueWithoutSpecialistsInput!] + deleteMany: [SubjectScalarWhereInput!] + updateMany: [SubjectUpdateManyWithWhereNestedInput!] } -input TagLabelUpdateManyWithWhereNestedInput { - where: TagLabelScalarWhereInput! - data: TagLabelUpdateManyDataInput! +input SubjectUpdateManyWithWhereNestedInput { + where: SubjectScalarWhereInput! + data: SubjectUpdateManyDataInput! } -input TagLabelUpdateOneWithoutTagsInput { - create: TagLabelCreateWithoutTagsInput - update: TagLabelUpdateWithoutTagsDataInput - upsert: TagLabelUpsertWithoutTagsInput +input SubjectUpdateOneWithoutTagsInput { + create: SubjectCreateWithoutTagsInput + update: SubjectUpdateWithoutTagsDataInput + upsert: SubjectUpsertWithoutTagsInput delete: Boolean disconnect: Boolean - connect: TagLabelWhereUniqueInput + connect: SubjectWhereUniqueInput } -input TagLabelUpdateWithoutCategoryDataInput { +input SubjectUpdateWithoutCategoryDataInput { name: String tags: TagUpdateManyWithoutLabelInput specialists: UserUpdateManyWithoutSpecialtiesInput order: Int } -input TagLabelUpdateWithoutSpecialistsDataInput { +input SubjectUpdateWithoutSpecialistsDataInput { name: String tags: TagUpdateManyWithoutLabelInput order: Int - category: TagCategoryUpdateOneRequiredWithoutLabelsInput + category: SubjectCategoryUpdateOneRequiredWithoutLabelsInput } -input TagLabelUpdateWithoutTagsDataInput { +input SubjectUpdateWithoutTagsDataInput { name: String specialists: UserUpdateManyWithoutSpecialtiesInput order: Int - category: TagCategoryUpdateOneRequiredWithoutLabelsInput + category: SubjectCategoryUpdateOneRequiredWithoutLabelsInput } -input TagLabelUpdateWithWhereUniqueWithoutCategoryInput { - where: TagLabelWhereUniqueInput! - data: TagLabelUpdateWithoutCategoryDataInput! +input SubjectUpdateWithWhereUniqueWithoutCategoryInput { + where: SubjectWhereUniqueInput! + data: SubjectUpdateWithoutCategoryDataInput! } -input TagLabelUpdateWithWhereUniqueWithoutSpecialistsInput { - where: TagLabelWhereUniqueInput! - data: TagLabelUpdateWithoutSpecialistsDataInput! +input SubjectUpdateWithWhereUniqueWithoutSpecialistsInput { + where: SubjectWhereUniqueInput! + data: SubjectUpdateWithoutSpecialistsDataInput! } -input TagLabelUpsertWithoutTagsInput { - update: TagLabelUpdateWithoutTagsDataInput! - create: TagLabelCreateWithoutTagsInput! +input SubjectUpsertWithoutTagsInput { + update: SubjectUpdateWithoutTagsDataInput! + create: SubjectCreateWithoutTagsInput! } -input TagLabelUpsertWithWhereUniqueWithoutCategoryInput { - where: TagLabelWhereUniqueInput! - update: TagLabelUpdateWithoutCategoryDataInput! - create: TagLabelCreateWithoutCategoryInput! +input SubjectUpsertWithWhereUniqueWithoutCategoryInput { + where: SubjectWhereUniqueInput! + update: SubjectUpdateWithoutCategoryDataInput! + create: SubjectCreateWithoutCategoryInput! } -input TagLabelUpsertWithWhereUniqueWithoutSpecialistsInput { - where: TagLabelWhereUniqueInput! - update: TagLabelUpdateWithoutSpecialistsDataInput! - create: TagLabelCreateWithoutSpecialistsInput! +input SubjectUpsertWithWhereUniqueWithoutSpecialistsInput { + where: SubjectWhereUniqueInput! + update: SubjectUpdateWithoutSpecialistsDataInput! + create: SubjectCreateWithoutSpecialistsInput! } -input TagLabelWhereInput { +input SubjectWhereInput { id: ID id_not: ID id_in: [ID!] @@ -3012,7 +2938,7 @@ input TagLabelWhereInput { order_lte: Int order_gt: Int order_gte: Int - category: TagCategoryWhereInput + category: SubjectCategoryWhereInput createdAt: DateTime createdAt_not: DateTime createdAt_in: [DateTime!] @@ -3029,15 +2955,89 @@ input TagLabelWhereInput { updatedAt_lte: DateTime updatedAt_gt: DateTime updatedAt_gte: DateTime - AND: [TagLabelWhereInput!] - OR: [TagLabelWhereInput!] - NOT: [TagLabelWhereInput!] + AND: [SubjectWhereInput!] + OR: [SubjectWhereInput!] + NOT: [SubjectWhereInput!] } -input TagLabelWhereUniqueInput { +input SubjectWhereUniqueInput { id: ID } +type Subscription { + answer(where: AnswerSubscriptionWhereInput): AnswerSubscriptionPayload + configuration(where: ConfigurationSubscriptionWhereInput): ConfigurationSubscriptionPayload + flag(where: FlagSubscriptionWhereInput): FlagSubscriptionPayload + historyAction(where: HistoryActionSubscriptionWhereInput): HistoryActionSubscriptionPayload + question(where: QuestionSubscriptionWhereInput): QuestionSubscriptionPayload + source(where: SourceSubscriptionWhereInput): SourceSubscriptionPayload + subject(where: SubjectSubscriptionWhereInput): SubjectSubscriptionPayload + subjectCategory(where: SubjectCategorySubscriptionWhereInput): SubjectCategorySubscriptionPayload + tag(where: TagSubscriptionWhereInput): TagSubscriptionPayload + user(where: UserSubscriptionWhereInput): UserSubscriptionPayload + zNode(where: ZNodeSubscriptionWhereInput): ZNodeSubscriptionPayload +} + +type Tag { + id: ID! + label: Subject + node: ZNode! + user: User! + createdAt: DateTime! + updatedAt: DateTime! +} + +type TagConnection { + pageInfo: PageInfo! + edges: [TagEdge]! + aggregate: AggregateTag! +} + +input TagCreateInput { + id: ID + label: SubjectCreateOneWithoutTagsInput + node: ZNodeCreateOneWithoutTagsInput! + user: UserCreateOneWithoutTagsInput! +} + +input TagCreateManyWithoutLabelInput { + create: [TagCreateWithoutLabelInput!] + connect: [TagWhereUniqueInput!] +} + +input TagCreateManyWithoutNodeInput { + create: [TagCreateWithoutNodeInput!] + connect: [TagWhereUniqueInput!] +} + +input TagCreateManyWithoutUserInput { + create: [TagCreateWithoutUserInput!] + connect: [TagWhereUniqueInput!] +} + +input TagCreateWithoutLabelInput { + id: ID + node: ZNodeCreateOneWithoutTagsInput! + user: UserCreateOneWithoutTagsInput! +} + +input TagCreateWithoutNodeInput { + id: ID + label: SubjectCreateOneWithoutTagsInput + user: UserCreateOneWithoutTagsInput! +} + +input TagCreateWithoutUserInput { + id: ID + label: SubjectCreateOneWithoutTagsInput + node: ZNodeCreateOneWithoutTagsInput! +} + +type TagEdge { + node: Tag! + cursor: String! +} + enum TagOrderByInput { id_ASC id_DESC @@ -3108,7 +3108,7 @@ input TagSubscriptionWhereInput { } input TagUpdateInput { - label: TagLabelUpdateOneWithoutTagsInput + label: SubjectUpdateOneWithoutTagsInput node: ZNodeUpdateOneRequiredWithoutTagsInput user: UserUpdateOneRequiredWithoutTagsInput } @@ -3152,12 +3152,12 @@ input TagUpdateWithoutLabelDataInput { } input TagUpdateWithoutNodeDataInput { - label: TagLabelUpdateOneWithoutTagsInput + label: SubjectUpdateOneWithoutTagsInput user: UserUpdateOneRequiredWithoutTagsInput } input TagUpdateWithoutUserDataInput { - label: TagLabelUpdateOneWithoutTagsInput + label: SubjectUpdateOneWithoutTagsInput node: ZNodeUpdateOneRequiredWithoutTagsInput } @@ -3209,7 +3209,7 @@ input TagWhereInput { id_not_starts_with: ID id_ends_with: ID id_not_ends_with: ID - label: TagLabelWhereInput + label: SubjectWhereInput node: ZNodeWhereInput user: UserWhereInput createdAt: DateTime @@ -3283,14 +3283,14 @@ type User { last: Int ): [Tag!] specialties( - where: TagLabelWhereInput - orderBy: TagLabelOrderByInput + where: SubjectWhereInput + orderBy: SubjectOrderByInput skip: Int after: String before: String first: Int last: Int - ): [TagLabel!] + ): [Subject!] history( where: HistoryActionWhereInput orderBy: HistoryActionOrderByInput @@ -3323,7 +3323,7 @@ input UserCreateInput { answers: AnswerCreateManyWithoutUserInput flags: FlagCreateManyWithoutUserInput tags: TagCreateManyWithoutUserInput - specialties: TagLabelCreateManyWithoutSpecialistsInput + specialties: SubjectCreateManyWithoutSpecialistsInput history: HistoryActionCreateManyWithoutUserInput } @@ -3369,7 +3369,7 @@ input UserCreateWithoutAnswersInput { questions: QuestionCreateManyWithoutUserInput flags: FlagCreateManyWithoutUserInput tags: TagCreateManyWithoutUserInput - specialties: TagLabelCreateManyWithoutSpecialistsInput + specialties: SubjectCreateManyWithoutSpecialistsInput history: HistoryActionCreateManyWithoutUserInput } @@ -3385,7 +3385,7 @@ input UserCreateWithoutFlagsInput { questions: QuestionCreateManyWithoutUserInput answers: AnswerCreateManyWithoutUserInput tags: TagCreateManyWithoutUserInput - specialties: TagLabelCreateManyWithoutSpecialistsInput + specialties: SubjectCreateManyWithoutSpecialistsInput history: HistoryActionCreateManyWithoutUserInput } @@ -3402,7 +3402,7 @@ input UserCreateWithoutHistoryInput { answers: AnswerCreateManyWithoutUserInput flags: FlagCreateManyWithoutUserInput tags: TagCreateManyWithoutUserInput - specialties: TagLabelCreateManyWithoutSpecialistsInput + specialties: SubjectCreateManyWithoutSpecialistsInput } input UserCreateWithoutQuestionsInput { @@ -3417,7 +3417,7 @@ input UserCreateWithoutQuestionsInput { answers: AnswerCreateManyWithoutUserInput flags: FlagCreateManyWithoutUserInput tags: TagCreateManyWithoutUserInput - specialties: TagLabelCreateManyWithoutSpecialistsInput + specialties: SubjectCreateManyWithoutSpecialistsInput history: HistoryActionCreateManyWithoutUserInput } @@ -3449,7 +3449,7 @@ input UserCreateWithoutTagsInput { questions: QuestionCreateManyWithoutUserInput answers: AnswerCreateManyWithoutUserInput flags: FlagCreateManyWithoutUserInput - specialties: TagLabelCreateManyWithoutSpecialistsInput + specialties: SubjectCreateManyWithoutSpecialistsInput history: HistoryActionCreateManyWithoutUserInput } @@ -3646,7 +3646,7 @@ input UserUpdateInput { answers: AnswerUpdateManyWithoutUserInput flags: FlagUpdateManyWithoutUserInput tags: TagUpdateManyWithoutUserInput - specialties: TagLabelUpdateManyWithoutSpecialistsInput + specialties: SubjectUpdateManyWithoutSpecialistsInput history: HistoryActionUpdateManyWithoutUserInput } @@ -3733,7 +3733,7 @@ input UserUpdateWithoutAnswersDataInput { questions: QuestionUpdateManyWithoutUserInput flags: FlagUpdateManyWithoutUserInput tags: TagUpdateManyWithoutUserInput - specialties: TagLabelUpdateManyWithoutSpecialistsInput + specialties: SubjectUpdateManyWithoutSpecialistsInput history: HistoryActionUpdateManyWithoutUserInput } @@ -3748,7 +3748,7 @@ input UserUpdateWithoutFlagsDataInput { questions: QuestionUpdateManyWithoutUserInput answers: AnswerUpdateManyWithoutUserInput tags: TagUpdateManyWithoutUserInput - specialties: TagLabelUpdateManyWithoutSpecialistsInput + specialties: SubjectUpdateManyWithoutSpecialistsInput history: HistoryActionUpdateManyWithoutUserInput } @@ -3764,7 +3764,7 @@ input UserUpdateWithoutHistoryDataInput { answers: AnswerUpdateManyWithoutUserInput flags: FlagUpdateManyWithoutUserInput tags: TagUpdateManyWithoutUserInput - specialties: TagLabelUpdateManyWithoutSpecialistsInput + specialties: SubjectUpdateManyWithoutSpecialistsInput } input UserUpdateWithoutQuestionsDataInput { @@ -3778,7 +3778,7 @@ input UserUpdateWithoutQuestionsDataInput { answers: AnswerUpdateManyWithoutUserInput flags: FlagUpdateManyWithoutUserInput tags: TagUpdateManyWithoutUserInput - specialties: TagLabelUpdateManyWithoutSpecialistsInput + specialties: SubjectUpdateManyWithoutSpecialistsInput history: HistoryActionUpdateManyWithoutUserInput } @@ -3808,7 +3808,7 @@ input UserUpdateWithoutTagsDataInput { questions: QuestionUpdateManyWithoutUserInput answers: AnswerUpdateManyWithoutUserInput flags: FlagUpdateManyWithoutUserInput - specialties: TagLabelUpdateManyWithoutSpecialistsInput + specialties: SubjectUpdateManyWithoutSpecialistsInput history: HistoryActionUpdateManyWithoutUserInput } @@ -3961,9 +3961,9 @@ input UserWhereInput { tags_every: TagWhereInput tags_some: TagWhereInput tags_none: TagWhereInput - specialties_every: TagLabelWhereInput - specialties_some: TagLabelWhereInput - specialties_none: TagLabelWhereInput + specialties_every: SubjectWhereInput + specialties_some: SubjectWhereInput + specialties_none: SubjectWhereInput history_every: HistoryActionWhereInput history_some: HistoryActionWhereInput history_none: HistoryActionWhereInput diff --git a/server/src/helpers/diffTags.js b/server/src/helpers/diffTags.js index 2c01ac2da..6ab61ac6a 100644 --- a/server/src/helpers/diffTags.js +++ b/server/src/helpers/diffTags.js @@ -16,7 +16,7 @@ const diffTags = (ctx, oldCats, newCats, confId) => { promises.push( Promise.all( catsToCreate.map(cat => - ctx.prisma.mutation.createTagCategory({ + ctx.prisma.mutation.createSubjectCategory({ data: { name: cat.name, order: cat.order, @@ -43,7 +43,7 @@ const diffTags = (ctx, oldCats, newCats, confId) => { promises.push( Promise.all( catsToUpdate.map(cat => - ctx.prisma.mutation.updateTagCategory({ + ctx.prisma.mutation.updateSubjectCategory({ where: { id: cat.id }, @@ -65,7 +65,7 @@ const diffTags = (ctx, oldCats, newCats, confId) => { promises.push( Promise.all( catsToDelete.map(cat => - ctx.prisma.mutation.deleteTagCategory({ + ctx.prisma.mutation.deleteSubjectCategory({ where: { id: cat.id } }) ) @@ -83,7 +83,7 @@ const diffTags = (ctx, oldCats, newCats, confId) => { promises.push( Promise.all( labelsToCreate.map(label => - ctx.prisma.mutation.createTagLabel({ + ctx.prisma.mutation.createSubject({ data: { name: label.name, order: label.order, @@ -123,7 +123,7 @@ const diffTags = (ctx, oldCats, newCats, confId) => { promises.push( Promise.all( labelsToUpdate.map(label => - ctx.prisma.mutation.updateTagLabel({ + ctx.prisma.mutation.updateSubject({ where: { id: label.id }, data: { name: label.name, order: label.order } }) @@ -141,7 +141,7 @@ const diffTags = (ctx, oldCats, newCats, confId) => { algoliaChanges.deleted.push(...labelsToDelete.map(l => l.name)) promises.push( Promise.all( - labelsToDelete.map(label => ctx.prisma.mutation.deleteTagLabel({ where: { id: label.id } })) + labelsToDelete.map(label => ctx.prisma.mutation.deleteSubject({ where: { id: label.id } })) ) ) diff --git a/server/src/middlewares/auth.js b/server/src/middlewares/auth.js index 42c50e610..86026f580 100644 --- a/server/src/middlewares/auth.js +++ b/server/src/middlewares/auth.js @@ -34,7 +34,7 @@ const checkJwt = async (req, res, next, prisma) => { }` ) - const specialtyId = conf.tagCategories[0].labels[1].id + const specialtyId = conf.subjectCategories[0].labels[1].id const userNoAuthUpsert = () => prisma.mutation.upsertUser( { diff --git a/server/src/middlewares/configuration.js b/server/src/middlewares/configuration.js index a49637577..0f4be1ee4 100644 --- a/server/src/middlewares/configuration.js +++ b/server/src/middlewares/configuration.js @@ -32,7 +32,7 @@ const refreshConfiguration = async tenant => { mailgunDomain mailgunApiKey slackChannelHook - tagCategories { + subjectCategories { order name labels { diff --git a/server/src/resolvers/configuration.js b/server/src/resolvers/configuration.js index 43f98edc2..64c397c0b 100644 --- a/server/src/resolvers/configuration.js +++ b/server/src/resolvers/configuration.js @@ -8,8 +8,13 @@ module.exports = { ctx.prisma.query.configuration({ where: { name: 'default' } }, info) }, Mutation: { - updateConfiguration: async (_, { authorizedDomains, tagCategories, ...args }, ctx, info) => { - const oldTagCategories = await ctx.prisma.query.tagCategories( + updateConfiguration: async ( + _, + { authorizedDomains, subjectCategories, ...args }, + ctx, + info + ) => { + const oldSubjectCategories = await ctx.prisma.query.subjectCategories( null, ` { @@ -27,8 +32,8 @@ module.exports = { await diffTags( ctx, - oldTagCategories, - JSON.parse(tagCategories), + oldSubjectCategories, + JSON.parse(subjectCategories), ctx.prisma._meta.configuration.id ) diff --git a/server/src/resolvers/question.js b/server/src/resolvers/question.js index 54e1455b5..7849b0a45 100644 --- a/server/src/resolvers/question.js +++ b/server/src/resolvers/question.js @@ -3,7 +3,7 @@ const { algolia, slack } = require('../integrations') // TMP_TAGS const confTagLabels = ctx => - ctx.prisma._meta.configuration.tagCategories.reduce((acc, cat) => acc.concat(cat.labels), []) + ctx.prisma._meta.configuration.subjectCategories.reduce((acc, cat) => acc.concat(cat.labels), []) module.exports = { Query: { @@ -11,7 +11,7 @@ module.exports = { }, Mutation: { createQuestionAndTags: async (_, { title, tags }, ctx, info) => { - const tagLabels = confTagLabels(ctx) + const subjects = confSubjects(ctx) const node = await ctx.prisma.mutation.createZNode( { @@ -25,9 +25,9 @@ module.exports = { }, tags: { create: tags - .filter(tagLabelId => !!tagLabels.find(label => label.id === tagLabelId)) - .map(tagLabelId => ({ - label: { connect: { id: tagLabelId } }, + .filter(subjectId => !!subjects.find(label => label.id === subjectId)) + .map(subjectId => ({ + label: { connect: { id: subjectId } }, user: { connect: { id: ctxUser(ctx).id } } })) }, @@ -54,7 +54,7 @@ module.exports = { model: 'Question', meta: { title, - tags: tags.map(id => tagLabels.find(label => label.id === id).name) + tags: tags.map(id => subjects.find(label => label.id === id).name) }, nodeId: node.id }) @@ -65,7 +65,7 @@ module.exports = { return ctx.prisma.query.question({ where: { id: node.question.id } }, info) }, updateQuestionAndTags: async (_, { id, title, previousTitle, tags }, ctx, info) => { - const tagLabels = confTagLabels(ctx) + const subjects = confSubjects(ctx) const node = ( await ctx.prisma.query.question( @@ -113,7 +113,7 @@ module.exports = { const tagsToRemove = oldLabels.filter(oldLabel => !newLabels.includes(oldLabel)) const mutationsToAdd = tagsToAdd - .filter(labelId => tagLabels.find(label => label.id === labelId)) + .filter(labelId => subjects.find(label => label.id === labelId)) .map(labelId => ctx.prisma.mutation.createTag({ data: { @@ -139,8 +139,8 @@ module.exports = { const meta = { tagsChanges: { - added: tagsToAdd.map(id => tagLabels.find(label => label.id === id).name), - removed: tagsToRemove.map(id => tagLabels.find(label => label.id === id).name) + added: tagsToAdd.map(id => subjects.find(label => label.id === id).name), + removed: tagsToRemove.map(id => subjects.find(label => label.id === id).name) } } diff --git a/server/src/schema.graphql b/server/src/schema.graphql index d7eeec8f7..8b75694fa 100644 --- a/server/src/schema.graphql +++ b/server/src/schema.graphql @@ -1,4 +1,4 @@ -# import ZNode, Question, Answer, Source, Flag, TagLabel, TagCategory, HistoryAction, BugReporting from './generated/prisma.graphql' +# import ZNode, Question, Answer, Source, Flag, TagLabel, SubjectCategory, HistoryAction, BugReporting from './generated/prisma.graphql' # import ZNodeOrderByInput, ZNodeConnection, ZNodeWhereUniqueInput from './generated/prisma.graphql' # import HistoryActionWhereInput from './generated/prisma.graphql' @@ -55,7 +55,7 @@ type Mutation { updateConfiguration( title: String! - tagCategories: Json! + subjectCategories: Json! algoliaSynonyms: Json! workplaceSharing: Boolean! authorizedDomains: [String!]! @@ -90,7 +90,7 @@ type User { email: String picture: String - specialties: [TagLabel!] + specialties: [Subject!] } type Configuration { @@ -110,7 +110,7 @@ type Configuration { slackCommandKey: String @admin tags: Json - tagCategories: [TagCategory!]! + subjectCategories: [SubjectCategory!]! # TMP_TAGS workplaceSharing: Boolean