Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 4aa0afd

Browse files
committed
fix: core 0.44.0 gql api update
1 parent c46157f commit 4aa0afd

6 files changed

Lines changed: 95 additions & 64 deletions

File tree

apps/admin-ui/src/component/reservations/requested/ApproveDialog.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ const DialogContent = ({
9292
const priceIsValid = !hasPrice || !Number.isNaN(price);
9393

9494
const handleApprove = () => {
95+
if (reservation.pk == null) {
96+
throw new Error("Reservation pk is missing");
97+
}
9598
const taxP = reservation.taxPercentageValue ?? "0";
9699
approveReservation({
97100
pk: reservation.pk,
98-
price: Number(price),
99-
priceNet: calcPriceNet(Number(price), parseFloat(taxP)),
101+
price: price.toString(),
102+
priceNet: calcPriceNet(Number(price), parseFloat(taxP)).toString(),
100103
handlingDetails,
101104
});
102105
};

apps/admin-ui/src/component/reservations/requested/DenyDialog.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,15 @@ const DialogContent = ({
188188
throw new Error("Deny PK undefined");
189189
}
190190

191+
const pks = filterNonNullable(reservations.map((x) => x.pk));
192+
if (pks.length === 0) {
193+
throw new Error("No reservation PKs found");
194+
}
191195
setInProgress(true);
192-
const denyPromises = reservations.map((x) =>
196+
const denyPromises = pks.map((pk) =>
193197
denyReservation({
194-
pk: x.pk,
195-
denyReasonPk,
198+
pk,
199+
denyReason: denyReasonPk,
196200
handlingDetails,
197201
})
198202
);

apps/admin-ui/src/component/reservations/requested/ReturnToRequiresHandlingDialog.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ const DialogContent = ({
5454
) => backToRequireHandlingMutation({ variables: { input } });
5555

5656
const handleClick = () => {
57+
if (!reservation.pk) {
58+
throw new Error("Reservation pk is missing");
59+
}
5760
backToRequireHandling({ pk: reservation.pk });
5861
};
5962

apps/ui/components/reservation/ReservationCancellation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function ReservationCancellation(props: Props): JSX.Element {
214214
variables: {
215215
input: {
216216
pk: reservation.pk,
217-
cancelReasonPk: reason,
217+
cancelReason: reason,
218218
cancelDetails: description,
219219
},
220220
},

packages/common/types/gql-types.ts

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,29 @@ export enum AllocatedTimeSlotOrderingChoices {
210210
PkDesc = "pkDesc",
211211
}
212212

213+
export type ApplicantNode = Node & {
214+
__typename?: "ApplicantNode";
215+
dateOfBirth?: Maybe<Scalars["Date"]["output"]>;
216+
email: Scalars["String"]["output"];
217+
firstName: Scalars["String"]["output"];
218+
generalRoles: Array<GeneralRoleNode>;
219+
/** The ID of the object */
220+
id: Scalars["ID"]["output"];
221+
isAdAuthenticated?: Maybe<Scalars["Boolean"]["output"]>;
222+
isStronglyAuthenticated?: Maybe<Scalars["Boolean"]["output"]>;
223+
/** Antaa käyttäjälle kaikki oikeudet ilman, että niitä täytyy erikseen luetella. */
224+
isSuperuser: Scalars["Boolean"]["output"];
225+
lastName: Scalars["String"]["output"];
226+
name?: Maybe<Scalars["String"]["output"]>;
227+
pk?: Maybe<Scalars["Int"]["output"]>;
228+
reservationNotification?: Maybe<Scalars["String"]["output"]>;
229+
serviceSectorRoles: Array<ServiceSectorRoleNode>;
230+
unitRoles: Array<UnitRoleNode>;
231+
/** Vaaditaan. Enintään 150 merkkiä. Vain kirjaimet, numerot ja @/./+/-/_ ovat sallittuja. */
232+
username: Scalars["String"]["output"];
233+
uuid: Scalars["UUID"]["output"];
234+
};
235+
213236
/** An enumeration. */
214237
export enum ApplicantTypeChoice {
215238
Association = "ASSOCIATION",
@@ -279,7 +302,7 @@ export type ApplicationNode = Node & {
279302
pk?: Maybe<Scalars["Int"]["output"]>;
280303
sentDate?: Maybe<Scalars["DateTime"]["output"]>;
281304
status?: Maybe<ApplicationStatusChoice>;
282-
user?: Maybe<UserNode>;
305+
user?: Maybe<ApplicantNode>;
283306
workingMemo: Scalars["String"]["output"];
284307
};
285308

@@ -2783,21 +2806,19 @@ export type ReservationAdjustTimeMutationPayload = {
27832806
};
27842807

27852808
export type ReservationApproveMutationInput = {
2786-
/** Additional information for approval. */
27872809
handlingDetails: Scalars["String"]["input"];
2788-
pk?: InputMaybe<Scalars["Int"]["input"]>;
2789-
price: Scalars["Float"]["input"];
2790-
priceNet: Scalars["Float"]["input"];
2810+
pk: Scalars["Int"]["input"];
2811+
price: Scalars["Decimal"]["input"];
2812+
priceNet: Scalars["Decimal"]["input"];
27912813
};
27922814

27932815
export type ReservationApproveMutationPayload = {
27942816
__typename?: "ReservationApproveMutationPayload";
27952817
handledAt?: Maybe<Scalars["DateTime"]["output"]>;
2796-
/** Additional information for approval. */
27972818
handlingDetails?: Maybe<Scalars["String"]["output"]>;
27982819
pk?: Maybe<Scalars["Int"]["output"]>;
2799-
price?: Maybe<Scalars["Float"]["output"]>;
2800-
priceNet?: Maybe<Scalars["Float"]["output"]>;
2820+
price?: Maybe<Scalars["Decimal"]["output"]>;
2821+
priceNet?: Maybe<Scalars["Decimal"]["output"]>;
28012822
state?: Maybe<State>;
28022823
};
28032824

@@ -2831,19 +2852,15 @@ export type ReservationCancelReasonNodeEdge = {
28312852
};
28322853

28332854
export type ReservationCancellationMutationInput = {
2834-
/** Additional information for the cancellation. */
28352855
cancelDetails?: InputMaybe<Scalars["String"]["input"]>;
2836-
/** Primary key for the pre-defined cancel reason. */
2837-
cancelReasonPk: Scalars["Int"]["input"];
2856+
cancelReason: Scalars["Int"]["input"];
28382857
pk: Scalars["Int"]["input"];
28392858
};
28402859

28412860
export type ReservationCancellationMutationPayload = {
28422861
__typename?: "ReservationCancellationMutationPayload";
2843-
/** Additional information for the cancellation. */
28442862
cancelDetails?: Maybe<Scalars["String"]["output"]>;
2845-
/** Primary key for the pre-defined cancel reason. */
2846-
cancelReasonPk?: Maybe<Scalars["Int"]["output"]>;
2863+
cancelReason?: Maybe<Scalars["Int"]["output"]>;
28472864
pk?: Maybe<Scalars["Int"]["output"]>;
28482865
state?: Maybe<State>;
28492866
};
@@ -2996,19 +3013,15 @@ export type ReservationDeleteMutationPayload = {
29963013
};
29973014

29983015
export type ReservationDenyMutationInput = {
2999-
/** Primary key for the pre-defined deny reason. */
3000-
denyReasonPk: Scalars["Int"]["input"];
3001-
/** Additional information for denying. */
3002-
handlingDetails?: InputMaybe<Scalars["String"]["input"]>;
3003-
pk?: InputMaybe<Scalars["Int"]["input"]>;
3016+
denyReason: Scalars["Int"]["input"];
3017+
handlingDetails: Scalars["String"]["input"];
3018+
pk: Scalars["Int"]["input"];
30043019
};
30053020

30063021
export type ReservationDenyMutationPayload = {
30073022
__typename?: "ReservationDenyMutationPayload";
3008-
/** Primary key for the pre-defined deny reason. */
3009-
denyReasonPk?: Maybe<Scalars["Int"]["output"]>;
3023+
denyReason?: Maybe<Scalars["Int"]["output"]>;
30103024
handledAt?: Maybe<Scalars["DateTime"]["output"]>;
3011-
/** Additional information for denying. */
30123025
handlingDetails?: Maybe<Scalars["String"]["output"]>;
30133026
pk?: Maybe<Scalars["Int"]["output"]>;
30143027
state?: Maybe<State>;
@@ -3317,7 +3330,7 @@ export type ReservationRefundMutationPayload = {
33173330
};
33183331

33193332
export type ReservationRequiresHandlingMutationInput = {
3320-
pk?: InputMaybe<Scalars["Int"]["input"]>;
3333+
pk: Scalars["Int"]["input"];
33213334
};
33223335

33233336
export type ReservationRequiresHandlingMutationPayload = {

tilavaraus.graphql

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,34 @@ enum AllocatedTimeSlotOrderingChoices {
159159
applicationSectionStatusDesc
160160
}
161161

162+
type ApplicantNode implements Node {
163+
"""
164+
Antaa käyttäjälle kaikki oikeudet ilman, että niitä täytyy erikseen luetella.
165+
"""
166+
isSuperuser: Boolean!
167+
168+
"""
169+
Vaaditaan. Enintään 150 merkkiä. Vain kirjaimet, numerot ja @/./+/-/_ ovat sallittuja.
170+
"""
171+
username: String!
172+
firstName: String!
173+
lastName: String!
174+
email: String!
175+
uuid: UUID!
176+
reservationNotification: String
177+
dateOfBirth: Date
178+
generalRoles: [GeneralRoleNode!]!
179+
unitRoles: [UnitRoleNode!]!
180+
serviceSectorRoles: [ServiceSectorRoleNode!]!
181+
182+
"""The ID of the object"""
183+
id: ID!
184+
name: String
185+
isAdAuthenticated: Boolean
186+
isStronglyAuthenticated: Boolean
187+
pk: Int
188+
}
189+
162190
"""An enumeration."""
163191
enum ApplicantTypeChoice {
164192
INDIVIDUAL
@@ -217,7 +245,7 @@ type ApplicationNode implements Node {
217245
applicationRound: ApplicationRoundNode!
218246
organisation: OrganisationNode
219247
contactPerson: PersonNode
220-
user: UserNode
248+
user: ApplicantNode
221249
billingAddress: AddressNode
222250
homeCity: CityNode
223251
applicationSections(
@@ -2490,42 +2518,30 @@ type ReservationAdjustTimeMutationPayload {
24902518
}
24912519

24922520
input ReservationApproveMutationInput {
2493-
pk: Int
2494-
2495-
"""Additional information for approval."""
2521+
pk: Int!
2522+
price: Decimal!
2523+
priceNet: Decimal!
24962524
handlingDetails: String!
2497-
price: Float!
2498-
priceNet: Float!
24992525
}
25002526

25012527
type ReservationApproveMutationPayload {
25022528
pk: Int
2503-
state: State
2504-
2505-
"""Additional information for approval."""
2529+
price: Decimal
2530+
priceNet: Decimal
25062531
handlingDetails: String
2532+
state: State
25072533
handledAt: DateTime
2508-
price: Float
2509-
priceNet: Float
25102534
}
25112535

25122536
input ReservationCancellationMutationInput {
25132537
pk: Int!
2514-
2515-
"""Primary key for the pre-defined cancel reason."""
2516-
cancelReasonPk: Int!
2517-
2518-
"""Additional information for the cancellation."""
2538+
cancelReason: Int!
25192539
cancelDetails: String
25202540
}
25212541

25222542
type ReservationCancellationMutationPayload {
25232543
pk: Int
2524-
2525-
"""Primary key for the pre-defined cancel reason."""
2526-
cancelReasonPk: Int
2527-
2528-
"""Additional information for the cancellation."""
2544+
cancelReason: Int
25292545
cancelDetails: String
25302546
state: State
25312547
}
@@ -2707,25 +2723,17 @@ type ReservationDeleteMutationPayload {
27072723
}
27082724

27092725
input ReservationDenyMutationInput {
2710-
pk: Int
2711-
2712-
"""Additional information for denying."""
2713-
handlingDetails: String
2714-
2715-
"""Primary key for the pre-defined deny reason."""
2716-
denyReasonPk: Int!
2726+
pk: Int!
2727+
denyReason: Int!
2728+
handlingDetails: String!
27172729
}
27182730

27192731
type ReservationDenyMutationPayload {
27202732
pk: Int
2721-
state: State
2722-
2723-
"""Additional information for denying."""
2733+
denyReason: Int
27242734
handlingDetails: String
2735+
state: State
27252736
handledAt: DateTime
2726-
2727-
"""Primary key for the pre-defined deny reason."""
2728-
denyReasonPk: Int
27292737
}
27302738

27312739
type ReservationDenyReasonNode implements Node {
@@ -3036,7 +3044,7 @@ type ReservationRefundMutationPayload {
30363044
}
30373045

30383046
input ReservationRequiresHandlingMutationInput {
3039-
pk: Int
3047+
pk: Int!
30403048
}
30413049

30423050
type ReservationRequiresHandlingMutationPayload {

0 commit comments

Comments
 (0)