Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gql types after unused model removal #1551

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 18 additions & 239 deletions apps/admin-ui/gql/gql-types.ts

Large diffs are not rendered by default.

258 changes: 18 additions & 240 deletions apps/ui/gql/gql-types.ts

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions apps/ui/modules/__tests__/reservation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function createMockReservationUnit({
reservationsMinDaysBefore,
reservationEnds,
canBeCancelledTimeBefore,
needsHandling,
}: {
reservationsMinDaysBefore?: number;
reservationEnds?: Date;
Expand All @@ -46,7 +45,6 @@ function createMockReservationUnit({
canBeCancelledTimeBefore: canBeCancelledTimeBefore ?? 0,
id: "fr8ejifod",
name: "Cancellation rule",
needsHandling: needsHandling ?? false,
};
return {
authentication: Authentication.Weak,
Expand Down Expand Up @@ -85,7 +83,6 @@ function createMockReservationUnit({
qualifiers: [],
equipments: [],
resources: [],
services: [],
spaces: [],
cancellationRule,
reservations: [],
Expand Down Expand Up @@ -256,20 +253,17 @@ describe("isReservationCancellable", () => {
function constructInput({
begin,
state,
needsHandling,
canBeCancelledTimeBefore,
}: {
begin: Date; // reservation begin time
state?: ReservationStateChoice; // reservation state
needsHandling?: boolean; // if the reservation unit needs handling
canBeCancelledTimeBefore?: number; // in seconds
}) {
return {
...createMockReservation({
begin,
state: state ?? ReservationStateChoice.Confirmed,
reservationUnit: createMockReservationUnit({
needsHandling: needsHandling ?? false,
canBeCancelledTimeBefore: canBeCancelledTimeBefore ?? 0,
}),
}),
Expand Down Expand Up @@ -308,14 +302,6 @@ describe("isReservationCancellable", () => {
expect(isReservationCancellable(input)).toBe(false);
});

test("NO for reservation unit that needs handling", () => {
const input = constructInput({
begin: addDays(new Date(), 1),
needsHandling: true,
});
expect(isReservationCancellable(input)).toBe(false);
});

test("YES for reservation that does not need handling", () => {
const input = constructInput({
begin: addDays(new Date(), 1),
Expand Down
1 change: 0 additions & 1 deletion apps/ui/modules/__tests__/reservationUnit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ describe("isReservationUnitReservable", () => {
reservationPendingInstructions: "",
reservationStartInterval: ReservationStartInterval.Interval_15Mins,
resources: [],
services: [],
spaces: [],
maxPersons: 10,
uuid: "be4fa7a2-05b7-11ee-be56-0242ac120004",
Expand Down
1 change: 0 additions & 1 deletion apps/ui/modules/queries/reservation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

export const DELETE_RESERVATION = gql`
mutation DeleteReservation($input: ReservationDeleteMutationInput!) {
deleteReservation(input: $input) {

Check warning on line 33 in apps/ui/modules/queries/reservation.tsx

View workflow job for this annotation

GitHub Actions / Lint ui

This field is marked as deprecated in your GraphQL schema (reason: Renamed to 'deleteTentativeReservation'.)
deleted
}
}
Expand Down Expand Up @@ -62,7 +62,6 @@
cancellationRule {
id
canBeCancelledTimeBefore
needsHandling
}
}
`;
Expand Down
7 changes: 1 addition & 6 deletions apps/ui/modules/reservation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ export function isReservationCancellable(
// TODO why can't user cancel if the reservation is waiting for handling?
if (reservation.state !== ReservationStateChoice.Confirmed) return false;
if (reservationUnit.cancellationRule == null) return false;
// TODO why isn't the user allowed to cancel if the reservation has been handled?
if (reservationUnit.cancellationRule.needsHandling) return false;
if (isTooCloseToCancel(reservation)) {
return false;
}
Expand Down Expand Up @@ -276,10 +274,7 @@ export function getWhyReservationCantBeChanged(
}

const reservationUnit = reservation.reservationUnits?.[0];
if (
reservationUnit?.cancellationRule == null ||
reservationUnit.cancellationRule.needsHandling
) {
if (reservationUnit?.cancellationRule == null) {
return "CANCELLATION_NOT_ALLOWED";
}

Expand Down
Loading