Skip to content

Commit

Permalink
Remove the unassigning part
Browse files Browse the repository at this point in the history
  • Loading branch information
deepaksftc committed Oct 21, 2024
1 parent ef1c09f commit 62ad9be
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 72 deletions.
16 changes: 0 additions & 16 deletions apps/backend/src/mutations/InstrumentMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,20 +452,4 @@ export default class InstrumentMutations {
): Promise<InstrumentsHasProposals | Rejection> {
return this.assignProposalsToInstrumentsInternal(agent, args);
}

@Authorized([Roles.USER_OFFICER, Roles.INSTRUMENT_SCIENTIST])
async removeXpressProposalsFromInstrument(
agent: UserWithRole | null,
args: RemoveProposalsFromInstrumentArgs
): Promise<boolean | Rejection> {
return this.dataSource
.removeProposalsFromInstrument(args.proposalPks)
.catch((error) => {
return rejection(
'Could not remove assigned proposal/s from instrument',
{ agent, args },
error
);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,4 @@ export class AssignProposalsToInstrumentsMutation {

return isRejection(res) ? res : true;
}

@Mutation(() => Boolean)
async removeXpressProposalsFromInstrument(
@Args() args: RemoveProposalsFromInstrumentArgs,
@Ctx() context: ResolverContext
) {
const isXpressProposals =
await context.mutations.technique.checkProposalsHasTechniques(
args.proposalPks
);

if (!isXpressProposals) {
return false;
}

return context.mutations.instrument.removeXpressProposalsFromInstrument(
context.user,
args
);
}
}
24 changes: 0 additions & 24 deletions apps/e2e/cypress/e2e/xpress.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,18 +867,6 @@ context('Xpress tests', () => {
cy.get('[role="listbox"]').contains(instrument1.name).click();
cy.finishedLoading();
cy.contains(instrument1.name);

// Unassign instrument 1 from proposal 1
cy.contains(proposal1.title)
.parent()
.find('[data-cy="instrument-dropdown"]')
.click();
cy.get('[role="listbox"]').contains('NONE').click();
cy.finishedLoading();
cy.get('table.MuiTable-root tbody tr').should(
'not.contain',
instrument1.name
);
});

it('Instrument scientist able to select, assign and unassign an instrument for a proposal', function () {
Expand Down Expand Up @@ -911,18 +899,6 @@ context('Xpress tests', () => {
cy.get('[role="listbox"]').contains(instrument1.name).click();
cy.finishedLoading();
cy.contains(instrument1.name);

// Unassign instrument 1 from proposal 1
cy.contains(proposal1.title)
.parent()
.find('[data-cy="instrument-dropdown"]')
.click();
cy.get('[role="listbox"]').contains('NONE').click();
cy.finishedLoading();
cy.get('table.MuiTable-root tbody tr').should(
'not.contain',
instrument1.name
);
});
});
});
9 changes: 0 additions & 9 deletions apps/frontend/src/components/xpress/XpressProposalTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,6 @@ const XpressProposalTable = () => {
proposalPks: [proposalPk],
instrumentIds: [instrument],
});
} else {
await api({
toastSuccessMessage: `Proposal/s removed from the ${i18n.format(
t('instrument'),
'lowercase'
)} successfully!`,
}).removeXpressProposalsFromInstrument({
proposalPks: [proposalPk],
});
}

refreshTableData();
Expand Down

This file was deleted.

0 comments on commit 62ad9be

Please sign in to comment.