diff --git a/src/backend/src/prisma-query-args/change-requests.query-args.ts b/src/backend/src/prisma-query-args/change-requests.query-args.ts index b04053b7f8..a5cb186ab5 100644 --- a/src/backend/src/prisma-query-args/change-requests.query-args.ts +++ b/src/backend/src/prisma-query-args/change-requests.query-args.ts @@ -12,8 +12,13 @@ export const getChangeRequestQueryArgs = (organizationId: string) => wbsElement: { include: { workPackage: getWorkPackageQueryArgs(organizationId), - project: true, - descriptionBullets: true + project: { + include: { + teams: true + } + }, + descriptionBullets: true, + links: true } }, reviewer: getUserQueryArgs(organizationId), diff --git a/src/backend/src/prisma-query-args/scope-change-requests.query-args.ts b/src/backend/src/prisma-query-args/scope-change-requests.query-args.ts index 4fa4c88515..37ac49ebbc 100644 --- a/src/backend/src/prisma-query-args/scope-change-requests.query-args.ts +++ b/src/backend/src/prisma-query-args/scope-change-requests.query-args.ts @@ -48,6 +48,7 @@ export const getScopeChangeRequestQueryArgs = (organizationId: string) => include: { why: true, proposedSolutions: getProposedSolutionQueryArgs(organizationId), - wbsProposedChanges: getWbsProposedChangeQueryArgs(organizationId) + wbsProposedChanges: getWbsProposedChangeQueryArgs(organizationId), + wbsOriginalData: getWbsProposedChangeQueryArgs(organizationId) } }); diff --git a/src/backend/src/prisma/migrations/20240518160744_init/migration.sql b/src/backend/src/prisma/migrations/20240525194034_init/migration.sql similarity index 98% rename from src/backend/src/prisma/migrations/20240518160744_init/migration.sql rename to src/backend/src/prisma/migrations/20240525194034_init/migration.sql index d0979d056a..ecc27c64b4 100644 --- a/src/backend/src/prisma/migrations/20240518160744_init/migration.sql +++ b/src/backend/src/prisma/migrations/20240525194034_init/migration.sql @@ -131,7 +131,6 @@ CREATE TABLE "Scope_CR" ( "scopeImpact" TEXT NOT NULL, "timelineImpact" INTEGER NOT NULL, "budgetImpact" INTEGER NOT NULL, - "wbsProposedChangesId" TEXT, CONSTRAINT "Scope_CR_pkey" PRIMARY KEY ("scopeCrId") ); @@ -559,8 +558,9 @@ CREATE TABLE "Wbs_Proposed_Changes" ( "status" "WBS_Element_Status" NOT NULL, "leadId" INTEGER, "managerId" INTEGER, - "changeRequestId" INTEGER NOT NULL, + "changeRequestId" INTEGER, "dateDeleted" TIMESTAMP(3), + "changeRequestAsOriginalDataId" INTEGER, CONSTRAINT "Wbs_Proposed_Changes_pkey" PRIMARY KEY ("wbsProposedChangesId") ); @@ -570,7 +570,6 @@ CREATE TABLE "Project_Proposed_Changes" ( "projectProposedChangesId" TEXT NOT NULL, "budget" INTEGER NOT NULL, "summary" TEXT NOT NULL, - "rules" TEXT[], "wbsProposedChangesId" TEXT NOT NULL, "carId" TEXT, @@ -806,6 +805,9 @@ CREATE UNIQUE INDEX "Schedule_Settings_userId_key" ON "Schedule_Settings"("userI -- CreateIndex CREATE UNIQUE INDEX "Wbs_Proposed_Changes_changeRequestId_key" ON "Wbs_Proposed_Changes"("changeRequestId"); +-- CreateIndex +CREATE UNIQUE INDEX "Wbs_Proposed_Changes_changeRequestAsOriginalDataId_key" ON "Wbs_Proposed_Changes"("changeRequestAsOriginalDataId"); + -- CreateIndex CREATE UNIQUE INDEX "Project_Proposed_Changes_wbsProposedChangesId_key" ON "Project_Proposed_Changes"("wbsProposedChangesId"); @@ -1188,7 +1190,10 @@ ALTER TABLE "Wbs_Proposed_Changes" ADD CONSTRAINT "Wbs_Proposed_Changes_leadId_f ALTER TABLE "Wbs_Proposed_Changes" ADD CONSTRAINT "Wbs_Proposed_Changes_managerId_fkey" FOREIGN KEY ("managerId") REFERENCES "User"("userId") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "Wbs_Proposed_Changes" ADD CONSTRAINT "Wbs_Proposed_Changes_changeRequestId_fkey" FOREIGN KEY ("changeRequestId") REFERENCES "Scope_CR"("scopeCrId") ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE "Wbs_Proposed_Changes" ADD CONSTRAINT "Wbs_Proposed_Changes_changeRequestId_fkey" FOREIGN KEY ("changeRequestId") REFERENCES "Scope_CR"("scopeCrId") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Wbs_Proposed_Changes" ADD CONSTRAINT "Wbs_Proposed_Changes_changeRequestAsOriginalDataId_fkey" FOREIGN KEY ("changeRequestAsOriginalDataId") REFERENCES "Scope_CR"("scopeCrId") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Project_Proposed_Changes" ADD CONSTRAINT "Project_Proposed_Changes_wbsProposedChangesId_fkey" FOREIGN KEY ("wbsProposedChangesId") REFERENCES "Wbs_Proposed_Changes"("wbsProposedChangesId") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/backend/src/prisma/schema.prisma b/src/backend/src/prisma/schema.prisma index be23a878ed..bacedb9734 100644 --- a/src/backend/src/prisma/schema.prisma +++ b/src/backend/src/prisma/schema.prisma @@ -258,17 +258,17 @@ model Message_Info { } model Scope_CR { - scopeCrId Int @id @default(autoincrement()) - changeRequestId Int @unique - changeRequest Change_Request @relation(fields: [changeRequestId], references: [crId]) - what String - why Scope_CR_Why[] - scopeImpact String - timelineImpact Int - budgetImpact Int - proposedSolutions Proposed_Solution[] - wbsProposedChangesId String? - wbsProposedChanges Wbs_Proposed_Changes? + scopeCrId Int @id @default(autoincrement()) + changeRequestId Int @unique + changeRequest Change_Request @relation(fields: [changeRequestId], references: [crId]) + what String + why Scope_CR_Why[] + scopeImpact String + timelineImpact Int + budgetImpact Int + proposedSolutions Proposed_Solution[] + wbsProposedChanges Wbs_Proposed_Changes? @relation(name: "wbsProposedChanges") + wbsOriginalData Wbs_Proposed_Changes? @relation(name: "wbsOriginalData") } model Proposed_Solution { @@ -748,19 +748,20 @@ model Wbs_Proposed_Changes { managerId Int? manager User? @relation(name: "wbsmanager", fields: [managerId], references: [userId]) links Link[] @relation(name: "proposedChangeLinks") - changeRequest Scope_CR @relation(fields: [changeRequestId], references: [scopeCrId]) - changeRequestId Int @unique + changeRequest Scope_CR? @relation(name: "wbsProposedChanges", fields: [changeRequestId], references: [scopeCrId]) + changeRequestId Int? @unique projectProposedChanges Project_Proposed_Changes? @relation(name: "projectProposedChanges") workPackageProposedChanges Work_Package_Proposed_Changes? @relation(name: "wpProposedChanges") proposedDescriptionBulletChanges Description_Bullet[] @relation(name: "proposedDescriptionBulletChanges") dateDeleted DateTime? + changeRequestAsOriginalData Scope_CR? @relation(name: "wbsOriginalData", fields: [changeRequestAsOriginalDataId], references: [scopeCrId]) + changeRequestAsOriginalDataId Int? @unique } model Project_Proposed_Changes { projectProposedChangesId String @id @default(uuid()) budget Int summary String - rules String[] teams Team[] @relation(name: "proposedProjectTeams") wbsProposedChanges Wbs_Proposed_Changes @relation(name: "projectProposedChanges", fields: [wbsProposedChangesId], references: [wbsProposedChangesId]) wbsProposedChangesId String @unique diff --git a/src/backend/src/services/change-requests.services.ts b/src/backend/src/services/change-requests.services.ts index 28a6789053..acff8e2572 100644 --- a/src/backend/src/services/change-requests.services.ts +++ b/src/backend/src/services/change-requests.services.ts @@ -179,21 +179,81 @@ export default class ChangeRequestsService { // we don't want to have merge conflictS on the wbs element thus we check if there are unreviewed or open CRs on the wbs element await validateNoUnreviewedOpenCRs(foundCR.wbsElementId); - // must accept and review a change request before using the workpackage and project services - await prisma.change_Request.update({ - where: { crId: foundCR.crId }, - data: { - accepted: true, - dateReviewed: new Date() - } - }); - const associatedProject = foundCR.wbsElement.project; const associatedWorkPackage = foundCR.wbsElement.workPackage; const { wbsProposedChanges } = foundCR.scopeChangeRequest; const { workPackageProposedChanges } = wbsProposedChanges; const { projectProposedChanges } = wbsProposedChanges; + // must accept and review a change request before using the workpackage and project services + await prisma.scope_CR.update({ + where: { changeRequestId: foundCR.crId }, + data: { + changeRequest: { + update: { + accepted: true, + dateReviewed: new Date() + } + }, + wbsOriginalData: { + create: { + name: foundCR.wbsElement.name, + status: foundCR.wbsElement.status, + lead: { + connect: { + userId: foundCR.wbsElement.leadId ?? undefined + } + }, + manager: { + connect: { + userId: foundCR.wbsElement.managerId ?? undefined + } + }, + links: { + connect: foundCR.wbsElement.links.map((link) => ({ + linkId: link.linkId + })) + }, + proposedDescriptionBulletChanges: { + connect: foundCR.wbsElement.descriptionBullets.map((descriptionBullet) => ({ + descriptionId: descriptionBullet.descriptionId + })) + }, + projectProposedChanges: + projectProposedChanges && associatedProject + ? { + create: { + budget: associatedProject.budget, + summary: associatedProject.summary, + teams: { + connect: associatedProject.teams.map((team) => ({ teamId: team.teamId })) + }, + car: { + connect: { + carId: associatedProject.carId + } + } + } + } + : undefined, + workPackageProposedChanges: + workPackageProposedChanges && associatedWorkPackage + ? { + create: { + startDate: associatedWorkPackage.startDate, + duration: associatedWorkPackage.duration, + blockedBy: { + connect: associatedWorkPackage.blockedBy.map((wbsNumber) => ({ wbsNumber })) + }, + stage: associatedWorkPackage.stage + } + } + : undefined + } + } + } + }); + if (workPackageProposedChanges) { await applyWorkPackageProposedChanges( wbsProposedChanges, diff --git a/src/backend/src/transformers/change-requests.transformer.ts b/src/backend/src/transformers/change-requests.transformer.ts index 5226782f9e..e2ed833392 100644 --- a/src/backend/src/transformers/change-requests.transformer.ts +++ b/src/backend/src/transformers/change-requests.transformer.ts @@ -108,6 +108,12 @@ const changeRequestTransformer = ( proposedSolutions: changeRequest.scopeChangeRequest ? changeRequest.scopeChangeRequest?.proposedSolutions.map(proposedSolutionTransformer) ?? [] : undefined, + originalProjectData: changeRequest.scopeChangeRequest?.wbsOriginalData?.projectProposedChanges + ? projectProposedChangesTransformer(changeRequest.scopeChangeRequest?.wbsOriginalData) + : undefined, + originalWorkPackageData: changeRequest.scopeChangeRequest?.wbsOriginalData?.workPackageProposedChanges + ? workPackageProposedChangesTransformer(changeRequest.scopeChangeRequest?.wbsOriginalData) + : undefined, // activation cr fields projectLead: changeRequest.activationChangeRequest?.lead ? userTransformer(changeRequest.activationChangeRequest.lead) diff --git a/src/backend/src/utils/description-bullets.utils.ts b/src/backend/src/utils/description-bullets.utils.ts index 12e0324a10..93343dec63 100644 --- a/src/backend/src/utils/description-bullets.utils.ts +++ b/src/backend/src/utils/description-bullets.utils.ts @@ -66,7 +66,7 @@ export const descriptionBulletToChangeListValue = ( ): ChangeListValue => { return { element: descriptionBullet, - comparator: `${descriptionBullet.id}`, + comparator: `${descriptionBullet.detail}`, displayValue: descriptionBullet.detail }; }; diff --git a/src/backend/tests/test-data/change-requests.test-data.ts b/src/backend/tests/test-data/change-requests.test-data.ts index b0c6e8d3a5..ac7fceccda 100644 --- a/src/backend/tests/test-data/change-requests.test-data.ts +++ b/src/backend/tests/test-data/change-requests.test-data.ts @@ -39,8 +39,7 @@ export const prismaScopeChangeRequest1: PrismaScopeCR = { what: 'redesign whip', scopeImpact: 'huge', timelineImpact: 10, - budgetImpact: 1000, - wbsProposedChangesId: null + budgetImpact: 1000 }; export const sharedChangeRequest: SharedChangeRequest = { diff --git a/src/frontend/src/components/LinksEditView.tsx b/src/frontend/src/components/LinksEditView.tsx index 7795369289..a47bc926c0 100644 --- a/src/frontend/src/components/LinksEditView.tsx +++ b/src/frontend/src/components/LinksEditView.tsx @@ -8,6 +8,7 @@ import { getRequiredLinkTypeNames } from '../utils/link.utils'; import { ProjectFormInput } from '../pages/ProjectDetailPage/ProjectForm/ProjectForm'; import { Box } from '@mui/system'; import { NERButton } from './NERButton'; +import { useEffect, useMemo } from 'react'; const LinksEditView: React.FC<{ ls: FieldArrayWithId[]; @@ -15,15 +16,28 @@ const LinksEditView: React.FC<{ watch: UseFormWatch; append: UseFieldArrayAppend; remove: UseFieldArrayRemove; -}> = ({ ls, register, append, remove, watch }) => { + enforceRequired?: boolean; +}> = ({ ls, register, append, remove, watch, enforceRequired }) => { const { isLoading, isError, error, data: linkTypes } = useAllLinkTypes(); - if (isLoading || !linkTypes) return ; - if (isError) return ; - const requiredLinkTypeNames = getRequiredLinkTypeNames(linkTypes); + const requiredLinkTypeNames = useMemo(() => { + return linkTypes ? getRequiredLinkTypeNames(linkTypes) : []; + }, [linkTypes]); const links = watch('links'); + useEffect(() => { + if (enforceRequired) { + requiredLinkTypeNames.forEach((linkTypeName) => { + if (links.some((link) => link.linkTypeName === linkTypeName)) return; + append({ linkId: '-1', url: '', linkTypeName }); + }); + } + }, [append, enforceRequired, linkTypes, links, requiredLinkTypeNames]); + + if (isLoading || !linkTypes) return ; + if (isError) return ; + const currentLinkTypeNames = links.map((link) => link.linkTypeName); /* Checks whether the link at the given index is of a required type and does not already exist */ @@ -36,8 +50,6 @@ const LinksEditView: React.FC<{ ); }; - const availableOptions = linkTypes.filter((linkType) => !currentLinkTypeNames.includes(linkType.name)); - return ( <> {ls.map((_element, i) => { @@ -46,18 +58,18 @@ const LinksEditView: React.FC<{ - {!isRequired(i) && ( + {(!enforceRequired || !isRequired(i)) && ( remove(i)} sx={{ mx: 1, my: 0 }}> @@ -66,16 +78,14 @@ const LinksEditView: React.FC<{ ); })} - {availableOptions.length > 0 && ( - append({ linkId: '-1', url: '', linkTypeName: '-1' })} - sx={{ my: 2, width: 'max-content' }} - > - + Add New Link - - )} + append({ linkId: '-1', url: '', linkTypeName: '-1' })} + sx={{ my: 2, width: 'max-content' }} + > + + Add Link + ); }; diff --git a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx index e3b6304110..794b7427c4 100644 --- a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx +++ b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx @@ -1,11 +1,11 @@ import { ProjectProposedChangesPreview, WorkPackageProposedChangesPreview, calculateEndDate } from 'shared'; import { Box } from '@mui/system'; -import { Typography } from '@mui/material'; +import { Link, List, ListItem, Typography, useTheme } from '@mui/material'; import { ChangeBullet, PotentialChangeType, changeBulletDetailText, - potentialChangeBackgroundMap + getPotentialChangeBackground } from '../../../utils/diff-page.utils'; import { labelPipe } from '../../../utils/pipes'; @@ -20,6 +20,8 @@ const DiffPanel: React.FC = ({ workPackageProposedChanges, potentialChangeTypeMap }) => { + const theme = useTheme(); + const changeBullets: ChangeBullet[] = []; for (var projectKey in projectProposedChanges) { if (projectProposedChanges.hasOwnProperty(projectKey)) { @@ -64,11 +66,25 @@ const DiffPanel: React.FC = ({ ); } else { return ( -
    - {detailText.map((bullet) => ( -
  • {bullet}
  • - ))} -
+ + {detailText.map((bullet) => { + const url = bullet.includes('http') ? bullet.split(': ')[1] : undefined; + return ( + + {url ? ( + <> + {bullet.split(': ')[0]}:{' '} + + {bullet.split(': ')[1]} + + + ) : ( + bullet + )} + + ); + })} + ); } }; @@ -85,7 +101,11 @@ const DiffPanel: React.FC = ({ ) : ( = ({ changeRequest }) => { ? ChangeRequestAction.EDIT_PROJECT : ChangeRequestAction.EDIT_WORK_PACKAGE; - const projectProposedChangesPreview: ProjectProposedChangesPreview | undefined = projectProposedChanges - ? { - name: projectProposedChanges.name, - summary: projectProposedChanges.summary, - lead: projectProposedChanges.lead, - manager: projectProposedChanges.manager, - teams: projectProposedChanges.teams, - budget: projectProposedChanges.budget, - descriptionBullets: projectProposedChanges.descriptionBullets, - links: projectProposedChanges.links - } - : undefined; - - const workPackageProposedChangesPreview: WorkPackageProposedChangesPreview | undefined = workPackageProposedChanges - ? { - name: workPackageProposedChanges.name, - stage: workPackageProposedChanges.stage, - lead: workPackageProposedChanges.lead, - manager: workPackageProposedChanges.manager, - startDate: workPackageProposedChanges.startDate, - duration: workPackageProposedChanges.duration, - blockedBy: workPackageProposedChanges.blockedBy, - descriptionBullets: workPackageProposedChanges.descriptionBullets - } - : undefined; + const projectProposedChangesPreview = projectProposedChangesToPreview(projectProposedChanges); + const originalProjectData = projectProposedChangesToPreview(changeRequest.originalProjectData); + const originalWorkPackageData = workPackageProposedChangesToPreview(changeRequest.originalWorkPackageData); + const workPackageProposedChangesPreview = workPackageProposedChangesToPreview(workPackageProposedChanges); return ( @@ -68,6 +48,8 @@ const DiffSection: React.FC = ({ changeRequest }) => { )} diff --git a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx index 97712d2503..560ddb93e1 100644 --- a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx +++ b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx @@ -1,8 +1,8 @@ import { ProjectProposedChangesPreview, WorkPackageProposedChangesPreview } from 'shared'; import { Box } from '@mui/system'; -import { PotentialChangeType, potentialChangeBackgroundMap } from '../../../utils/diff-page.utils'; +import { PotentialChangeType, getPotentialChangeBackground } from '../../../utils/diff-page.utils'; import DiffPanel from './DiffPanel'; -import { Grid } from '@mui/material'; +import { Grid, useTheme } from '@mui/material'; interface DiffSectionCreateProps { projectProposedChanges?: ProjectProposedChangesPreview; @@ -10,6 +10,8 @@ interface DiffSectionCreateProps { } const DiffSectionCreate: React.FC = ({ projectProposedChanges, workPackageProposedChanges }) => { + const theme = useTheme(); + const isCreateProject = !!projectProposedChanges; const potentialChangeTypeMap: Map = new Map(); delete workPackageProposedChanges?.lead; @@ -35,7 +37,7 @@ const DiffSectionCreate: React.FC = ({ projectProposedCh borderRadius="10px" p={1.4} mb={3} - sx={{ backgroundColor: potentialChangeBackgroundMap.get(PotentialChangeType.ADDED) }} + sx={{ backgroundColor: getPotentialChangeBackground(PotentialChangeType.ADDED, theme) }} > = ({ projectProposedChanges, workPackageProposedChanges, wbsNum }) => { +const DiffSectionEdit: React.FC = ({ + projectProposedChanges, + workPackageProposedChanges, + originalProjectData, + originalWorkPackageData, + wbsNum +}) => { const { data: projects, isLoading: projectsIsLoading, isError: projectsIsError, error: projectsError } = useAllProjects(); const { data: workPackages, @@ -36,6 +45,8 @@ const DiffSectionEdit: React.FC = ({ projectProposedChange error: workPackagesError } = useAllWorkPackages(); + const theme = useTheme(); + if (projectsIsLoading || workPackagesIsLoading || !projects || !workPackages) return ; if (projectsIsError) return ; if (workPackagesIsError) return ; @@ -48,8 +59,8 @@ const DiffSectionEdit: React.FC = ({ projectProposedChange const originalMap: Map = new Map(); const proposedMap: Map = new Map(); - const projectAsChanges = projectToProposedChangesPreview(project); - const workPackageAsChanges = workPackageToProposedChangesPreview(workPackage); + const projectAsChanges = originalProjectData ?? projectToProposedChangesPreview(project); + const workPackageAsChanges = originalWorkPackageData ?? workPackageToProposedChangesPreview(workPackage); if (isOnProject) { for (var projectKey in projectProposedChanges) { @@ -103,7 +114,7 @@ const DiffSectionEdit: React.FC = ({ projectProposedChange return ( - + = ({ projectProposedChange - + = ({ - {!project ? 'Links (optional)' : 'Links'} + {!!project ? 'Links' : 'Links (optional)'} - + = new Map([ - [PotentialChangeType.ADDED, '#51915c'], - [PotentialChangeType.REMOVED, '#8a4e4e'], - [PotentialChangeType.SAME, '#2C2C2C'] -]); - -export const potentialChangeHighlightMap: Map = new Map([ - [PotentialChangeType.ADDED, '#43a854'], - [PotentialChangeType.REMOVED, '#ba5050'], - [PotentialChangeType.SAME, '#2C2C2C'] -]); +export const getPotentialChangeBackground = (potentialChangeType: PotentialChangeType, theme: Theme) => { + switch (potentialChangeType) { + case PotentialChangeType.ADDED: + return '#51915c'; + case PotentialChangeType.REMOVED: + return '#8a4e4e'; + case PotentialChangeType.SAME: + return theme.palette.background.paper; + } +}; export const valueChanged = (original: ProposedChangeValue, proposed: ProposedChangeValue) => { console.log(typeof original, typeof proposed, original, proposed); @@ -160,3 +162,37 @@ export const workPackageToProposedChangesPreview = ( descriptionBullets: workPackage.descriptionBullets }; }; + +export const projectProposedChangesToPreview = ( + proposedChanges: ProjectProposedChanges | undefined +): ProjectProposedChangesPreview | undefined => { + return ( + proposedChanges && { + name: proposedChanges.name, + summary: proposedChanges.summary, + lead: proposedChanges.lead, + manager: proposedChanges.manager, + teams: proposedChanges.teams, + budget: proposedChanges.budget, + descriptionBullets: proposedChanges.descriptionBullets, + links: proposedChanges.links + } + ); +}; + +export const workPackageProposedChangesToPreview = ( + proposedChanges: WorkPackageProposedChanges | undefined +): WorkPackageProposedChangesPreview | undefined => { + return ( + proposedChanges && { + name: proposedChanges.name, + stage: proposedChanges.stage, + lead: proposedChanges.lead, + manager: proposedChanges.manager, + startDate: proposedChanges.startDate, + duration: proposedChanges.duration, + blockedBy: proposedChanges.blockedBy, + descriptionBullets: proposedChanges.descriptionBullets + } + ); +}; diff --git a/src/shared/src/types/change-request-types.ts b/src/shared/src/types/change-request-types.ts index 980b24993f..2673fc152f 100644 --- a/src/shared/src/types/change-request-types.ts +++ b/src/shared/src/types/change-request-types.ts @@ -43,6 +43,8 @@ export interface StandardChangeRequest extends ChangeRequest { proposedSolutions: ProposedSolution[]; projectProposedChanges?: ProjectProposedChanges; workPackageProposedChanges?: WorkPackageProposedChanges; + originalProjectData?: ProjectProposedChanges; + originalWorkPackageData?: WorkPackageProposedChanges; } export interface ProposedSolution {