Skip to content

Commit 3538c6a

Browse files
committed
Reschedule single updated to use microsoft id
1 parent 5946ef5 commit 3538c6a

5 files changed

Lines changed: 65 additions & 24 deletions

File tree

public/swagger/swagger.json

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@
348348
"type": "string"
349349
},
350350
"required": true
351+
},
352+
{
353+
"in": "query",
354+
"name": "isICalUId",
355+
"schema": {
356+
"type": "boolean"
357+
},
358+
"required": true
351359
}
352360
],
353361
"responses": {
@@ -2440,7 +2448,6 @@
24402448
"description": "Request body of the details of the two meetings",
24412449
"type": "object",
24422450
"required": [
2443-
"newMeeting",
24442451
"oldMeeting"
24452452
],
24462453
"properties": {
@@ -2473,12 +2480,18 @@
24732480
"oldMeeting": {
24742481
"type": "object",
24752482
"required": [
2476-
"msftMeetingID"
2483+
"msftMeetingID",
2484+
"ownerEmail"
24772485
],
24782486
"properties": {
2487+
"ownerEmail": {
2488+
"type": "string",
2489+
"format": "email",
2490+
"description": "The email of the owner of the old meeting"
2491+
},
24792492
"msftMeetingID": {
24802493
"type": "string",
2481-
"description": "The microsoft meeting ID of the old meeting if it exists"
2494+
"description": "The microsoft iCalUId meeting ID of the old meeting"
24822495
},
24832496
"isOrganizerOptional": {
24842497
"type": "boolean",
@@ -2557,13 +2570,17 @@
25572570
"type": "object",
25582571
"required": [
25592572
"msftMeetingID",
2560-
"meetingStartTime",
2561-
"meetingOwner"
2573+
"ownerEmail"
25622574
],
25632575
"properties": {
2576+
"ownerEmail": {
2577+
"type": "string",
2578+
"format": "email",
2579+
"description": "The email of the owner of the old meeting"
2580+
},
25642581
"msftMeetingID": {
25652582
"type": "string",
2566-
"description": "The microsoft meeting ID of the old meeting"
2583+
"description": "The microsoft iCalUId meeting ID of the old meeting"
25672584
}
25682585
}
25692586
}
@@ -2573,12 +2590,17 @@
25732590
"description": "Request body of the details of the old meeting",
25742591
"type": "object",
25752592
"required": [
2576-
"msftMeetingID"
2593+
"msftMeetingID",
2594+
"ownerEmail"
25772595
],
25782596
"properties": {
2597+
"ownerEmail": {
2598+
"type": "string",
2599+
"format": "email"
2600+
},
25792601
"msftMeetingID": {
25802602
"type": "string",
2581-
"description": "The microsoft meeting ID of the old meeting"
2603+
"description": "The microsoft iCalUId meeting ID of the old meeting"
25822604
}
25832605
}
25842606
},
@@ -2878,6 +2900,9 @@
28782900
"id": {
28792901
"type": "string"
28802902
},
2903+
"iCalUId": {
2904+
"type": "string"
2905+
},
28812906
"attendees": {
28822907
"type": "array",
28832908
"items": {

shared

src/components/calendar-overview.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@ export function CalendarOverview() {
151151
return (doc.body.textContent || '').trim()
152152
}
153153

154-
const handleReschedule = async (selectedEventID: string) => {
154+
const handleReschedule = async (selectedEventID: string, ownerEmail: string) => {
155155
if (!selectedEventID) return
156+
if (!ownerEmail) return
156157
try {
157158
await slotifyClient.PostAPIRescheduleRequestSingle({
158159
msftMeetingID: selectedEventID,
160+
ownerEmail: ownerEmail,
159161
})
160162
toast({
161163
title: 'Reschedule sent',
@@ -509,8 +511,8 @@ export function CalendarOverview() {
509511
<Button
510512
variant='destructive'
511513
onClick={() => {
512-
console.log('Reschedule event: ', selectedEvent.id)
513-
handleReschedule(selectedEvent.id!.toString())
514+
console.log('Reschedule event: ', selectedEvent.iCalUId!.toString())
515+
handleReschedule(selectedEvent.iCalUId!.toString(), selectedEvent.organizer!.toString())
514516
setIsDayEventsDialogOpen(false)
515517
}}
516518
>

src/components/reschedule-requests.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function RescheduleRequests() {
8484
myRequests?.forEach(async request => {
8585
const requestedBy = await getUserByID(request.requested_by)
8686
const oldEvent = await slotifyClient.GetAPICalendarEvent({
87-
queries: { msftID: request.oldMeeting.msftMeetingID },
87+
queries: { msftID: request.oldMeeting.msftMeetingID , isICalUId: true},
8888
})
8989
const newEvent =
9090
request.newMeeting?.startTime === '0001-01-01T00:00:00Z'
@@ -191,8 +191,8 @@ export function RescheduleRequests() {
191191
<div className='space-y-3'>
192192
<div>
193193
<h4 className='font-medium leading-none'>
194-
{request.newMeeting?.title
195-
? request.newMeeting.title
194+
{fullRequests[request.request_id]
195+
? fullRequests[request.request_id]!.oldEvent.subject
196196
: '(No name)'}
197197
</h4>
198198
<p className='text-sm text-muted-foreground mt-1'>

src/types/client.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ type ReschedulingRequestNewMeeting = {
3333
attendees: Array<number> | null;
3434
};
3535
type ReschedulingCheckBodySchema = {
36-
newMeeting: {
37-
title: string;
38-
meetingDuration: string;
39-
attendees: Array<AttendeeBase>;
40-
};
36+
newMeeting?:
37+
| {
38+
title: string;
39+
meetingDuration: string;
40+
attendees: Array<AttendeeBase>;
41+
}
42+
| undefined;
4143
oldMeeting: {
44+
ownerEmail: string;
4245
msftMeetingID: string;
4346
isOrganizerOptional?: boolean | undefined;
4447
};
@@ -144,6 +147,7 @@ type Attendee = {
144147
};
145148
type CalendarEvent = {
146149
id?: string | undefined;
150+
iCalUId?: string | undefined;
147151
attendees: Array<Attendee>;
148152
body?: string | undefined;
149153
created?: string | undefined;
@@ -245,6 +249,7 @@ const Location: z.ZodType<Location> = z
245249
const CalendarEvent: z.ZodType<CalendarEvent> = z
246250
.object({
247251
id: z.string().optional(),
252+
iCalUId: z.string().optional(),
248253
attendees: z.array(Attendee),
249254
body: z.string().optional(),
250255
created: z.string().datetime({ offset: true }).optional(),
@@ -423,9 +428,11 @@ const ReschedulingCheckBodySchema: z.ZodType<ReschedulingCheckBodySchema> = z
423428
meetingDuration: z.string(),
424429
attendees: z.array(AttendeeBase),
425430
})
426-
.passthrough(),
431+
.passthrough()
432+
.optional(),
427433
oldMeeting: z
428434
.object({
435+
ownerEmail: z.string().email(),
429436
msftMeetingID: z.string(),
430437
isOrganizerOptional: z.boolean().optional().default(false),
431438
})
@@ -483,11 +490,13 @@ const ReschedulingRequestBodySchema = z
483490
endRangeTime: z.string().datetime({ offset: true }),
484491
})
485492
.passthrough(),
486-
oldMeeting: z.object({ msftMeetingID: z.string() }).passthrough(),
493+
oldMeeting: z
494+
.object({ ownerEmail: z.string().email(), msftMeetingID: z.string() })
495+
.passthrough(),
487496
})
488497
.passthrough();
489498
const ReschedulingRequestSingleBodySchema = z
490-
.object({ msftMeetingID: z.string() })
499+
.object({ ownerEmail: z.string().email(), msftMeetingID: z.string() })
491500
.passthrough();
492501
const MSFTGroup = z.object({ id: z.string(), name: z.string() }).passthrough();
493502
const MSFTUser = z
@@ -626,6 +635,11 @@ const endpoints = makeApi([
626635
type: "Query",
627636
schema: z.string(),
628637
},
638+
{
639+
name: "isICalUId",
640+
type: "Query",
641+
schema: z.boolean(),
642+
},
629643
],
630644
response: CalendarEvent,
631645
errors: [
@@ -1498,7 +1512,7 @@ const endpoints = makeApi([
14981512
{
14991513
name: "body",
15001514
type: "Body",
1501-
schema: z.object({ msftMeetingID: z.string() }).passthrough(),
1515+
schema: ReschedulingRequestSingleBodySchema,
15021516
},
15031517
],
15041518
response: z.number(),

0 commit comments

Comments
 (0)