Skip to content

Commit

Permalink
Merge pull request #217 from ONSdigital/800-section-introduction-review
Browse files Browse the repository at this point in the history
Section Introduction Review
  • Loading branch information
tgandrews authored Feb 25, 2019
2 parents 7dea3e4 + c96d587 commit 85bc80f
Show file tree
Hide file tree
Showing 58 changed files with 619 additions and 1,361 deletions.
35 changes: 0 additions & 35 deletions eq-author-api/schema/resolvers/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,6 @@ const Resolvers = {
ctx.repositories.Section.remove(args.input.id),
undeleteSection: (_, args, ctx) =>
ctx.repositories.Section.undelete(args.input.id),
createSectionIntroduction: (
_,
{ input: { sectionId, introductionContent, introductionTitle } },
ctx
) =>
ctx.repositories.Section.update({
id: sectionId,
introductionEnabled: true,
introductionContent,
introductionTitle,
}),
updateSectionIntroduction: (
_,
{ input: { sectionId, introductionContent, introductionTitle } },
ctx
) =>
ctx.repositories.Section.update({
id: sectionId,
introductionContent,
introductionTitle,
}),
deleteSectionIntroduction: (_, { input: { sectionId } }, ctx) =>
ctx.repositories.Section.update({
id: sectionId,
introductionEnabled: false,
introductionContent: null,
introductionTitle: null,
}),
moveSection: (_, args, ctx) => ctx.repositories.Section.move(args.input),
duplicateSection: (_, args, ctx) =>
ctx.repositories.Section.duplicateSection(
Expand Down Expand Up @@ -228,19 +200,12 @@ const Resolvers = {
}
return ctx.repositories.Section.getPosition({ id });
},
introduction: section => (section.introductionEnabled ? section : null),
availablePipingAnswers: ({ id }, args, ctx) =>
ctx.repositories.Section.getPipingAnswersForSection(id),
availablePipingMetadata: ({ id }, args, ctx) =>
ctx.repositories.Section.getPipingMetadataForSection(id),
},

SectionIntroduction: {
section: ({ id: sectionId }, args, ctx) => {
return ctx.repositories.Section.getById(sectionId);
},
},

Page: {
__resolveType: ({ pageType }) => pageType,
position: ({ position, id }, args, ctx) => {
Expand Down
27 changes: 2 additions & 25 deletions eq-author-api/schema/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,10 @@ type Section {
pages: [Page]
questionnaire: Questionnaire
position: Int!
introduction: SectionIntroduction
availablePipingAnswers: [Answer!]!
availablePipingMetadata: [Metadata!]!
}
type SectionIntroduction {
id: ID!
introductionTitle: String
introductionContent: String
section: Section!
availablePipingAnswers: [Answer!]!
availablePipingMetadata: [Metadata!]!
}
interface Page {
Expand Down Expand Up @@ -455,9 +449,6 @@ type Mutation {
undeleteSection(input: UndeleteSectionInput!): Section
moveSection(input: MoveSectionInput!): Section
duplicateSection(input: DuplicateSectionInput!): Section
createSectionIntroduction(input: CreateSectionIntroductionInput!): SectionIntroduction!
updateSectionIntroduction(input: UpdateSectionIntroductionInput!): SectionIntroduction!
deleteSectionIntroduction(input: DeleteSectionIntroductionInput!): SectionIntroduction!
createPage(input: CreatePageInput!): Page
updatePage(input: UpdatePageInput!): Page
deletePage(input: DeletePageInput!): Page
Expand Down Expand Up @@ -604,24 +595,10 @@ input UpdateSectionInput {
id: ID!
title: String
alias: String
}
input CreateSectionIntroductionInput {
sectionId: ID!
introductionTitle: String
introductionContent: String
}
input UpdateSectionIntroductionInput {
sectionId: ID!
introductionTitle: String
introductionContent: String
}
input DeleteSectionIntroductionInput {
sectionId: ID!
}
input DeleteSectionInput {
id: ID!
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 85bc80f

Please sign in to comment.