Skip to content
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
41 changes: 33 additions & 8 deletions public/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@
"type": "string"
},
"required": true
},
{
"in": "query",
"name": "isICalUId",
"schema": {
"type": "boolean"
},
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -2440,7 +2448,6 @@
"description": "Request body of the details of the two meetings",
"type": "object",
"required": [
"newMeeting",
"oldMeeting"
],
"properties": {
Expand Down Expand Up @@ -2473,12 +2480,18 @@
"oldMeeting": {
"type": "object",
"required": [
"msftMeetingID"
"msftMeetingID",
"ownerEmail"
],
"properties": {
"ownerEmail": {
"type": "string",
"format": "email",
"description": "The email of the owner of the old meeting"
},
"msftMeetingID": {
"type": "string",
"description": "The microsoft meeting ID of the old meeting if it exists"
"description": "The microsoft iCalUId meeting ID of the old meeting"
},
"isOrganizerOptional": {
"type": "boolean",
Expand Down Expand Up @@ -2557,13 +2570,17 @@
"type": "object",
"required": [
"msftMeetingID",
"meetingStartTime",
"meetingOwner"
"ownerEmail"
],
"properties": {
"ownerEmail": {
"type": "string",
"format": "email",
"description": "The email of the owner of the old meeting"
},
"msftMeetingID": {
"type": "string",
"description": "The microsoft meeting ID of the old meeting"
"description": "The microsoft iCalUId meeting ID of the old meeting"
}
}
}
Expand All @@ -2573,12 +2590,17 @@
"description": "Request body of the details of the old meeting",
"type": "object",
"required": [
"msftMeetingID"
"msftMeetingID",
"ownerEmail"
],
"properties": {
"ownerEmail": {
"type": "string",
"format": "email"
},
"msftMeetingID": {
"type": "string",
"description": "The microsoft meeting ID of the old meeting"
"description": "The microsoft iCalUId meeting ID of the old meeting"
}
}
},
Expand Down Expand Up @@ -2878,6 +2900,9 @@
"id": {
"type": "string"
},
"iCalUId": {
"type": "string"
},
"attendees": {
"type": "array",
"items": {
Expand Down
2 changes: 1 addition & 1 deletion shared
Submodule shared updated 1 files
+25 −7 openapi/openapi.yaml
17 changes: 14 additions & 3 deletions src/components/calendar-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,16 @@ export function CalendarOverview() {
return (doc.body.textContent || '').trim()
}

const handleReschedule = async (selectedEventID: string) => {
const handleReschedule = async (
selectedEventID: string,
ownerEmail: string,
) => {
if (!selectedEventID) return
if (!ownerEmail) return
try {
await slotifyClient.PostAPIRescheduleRequestSingle({
msftMeetingID: selectedEventID,
ownerEmail: ownerEmail,
})
toast({
title: 'Reschedule sent',
Expand Down Expand Up @@ -509,8 +514,14 @@ export function CalendarOverview() {
<Button
variant='destructive'
onClick={() => {
console.log('Reschedule event: ', selectedEvent.id)
handleReschedule(selectedEvent.id!.toString())
console.log(
'Reschedule event: ',
selectedEvent.iCalUId!.toString(),
)
handleReschedule(
selectedEvent.iCalUId!.toString(),
selectedEvent.organizer!.toString(),
)
setIsDayEventsDialogOpen(false)
}}
>
Expand Down
7 changes: 4 additions & 3 deletions src/components/reschedule-requests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function RescheduleRequests() {
myRequests?.forEach(async request => {
const requestedBy = await getUserByID(request.requested_by)
const oldEvent = await slotifyClient.GetAPICalendarEvent({
queries: { msftID: request.oldMeeting.msftMeetingID },
queries: { msftID: request.oldMeeting.msftMeetingID, isICalUId: true },
})
const newEvent =
request.newMeeting?.startTime === '0001-01-01T00:00:00Z'
Expand Down Expand Up @@ -191,8 +191,9 @@ export function RescheduleRequests() {
<div className='space-y-3'>
<div>
<h4 className='font-medium leading-none'>
{request.newMeeting?.title
? request.newMeeting.title
{fullRequests[request.request_id]
? fullRequests[request.request_id]!.oldEvent
.subject
: '(No name)'}
</h4>
<p className='text-sm text-muted-foreground mt-1'>
Expand Down
32 changes: 23 additions & 9 deletions src/types/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ type ReschedulingRequestNewMeeting = {
attendees: Array<number> | null;
};
type ReschedulingCheckBodySchema = {
newMeeting: {
title: string;
meetingDuration: string;
attendees: Array<AttendeeBase>;
};
newMeeting?:
| {
title: string;
meetingDuration: string;
attendees: Array<AttendeeBase>;
}
| undefined;
oldMeeting: {
ownerEmail: string;
msftMeetingID: string;
isOrganizerOptional?: boolean | undefined;
};
Expand Down Expand Up @@ -144,6 +147,7 @@ type Attendee = {
};
type CalendarEvent = {
id?: string | undefined;
iCalUId?: string | undefined;
attendees: Array<Attendee>;
body?: string | undefined;
created?: string | undefined;
Expand Down Expand Up @@ -245,6 +249,7 @@ const Location: z.ZodType<Location> = z
const CalendarEvent: z.ZodType<CalendarEvent> = z
.object({
id: z.string().optional(),
iCalUId: z.string().optional(),
attendees: z.array(Attendee),
body: z.string().optional(),
created: z.string().datetime({ offset: true }).optional(),
Expand Down Expand Up @@ -423,9 +428,11 @@ const ReschedulingCheckBodySchema: z.ZodType<ReschedulingCheckBodySchema> = z
meetingDuration: z.string(),
attendees: z.array(AttendeeBase),
})
.passthrough(),
.passthrough()
.optional(),
oldMeeting: z
.object({
ownerEmail: z.string().email(),
msftMeetingID: z.string(),
isOrganizerOptional: z.boolean().optional().default(false),
})
Expand Down Expand Up @@ -483,11 +490,13 @@ const ReschedulingRequestBodySchema = z
endRangeTime: z.string().datetime({ offset: true }),
})
.passthrough(),
oldMeeting: z.object({ msftMeetingID: z.string() }).passthrough(),
oldMeeting: z
.object({ ownerEmail: z.string().email(), msftMeetingID: z.string() })
.passthrough(),
})
.passthrough();
const ReschedulingRequestSingleBodySchema = z
.object({ msftMeetingID: z.string() })
.object({ ownerEmail: z.string().email(), msftMeetingID: z.string() })
.passthrough();
const MSFTGroup = z.object({ id: z.string(), name: z.string() }).passthrough();
const MSFTUser = z
Expand Down Expand Up @@ -626,6 +635,11 @@ const endpoints = makeApi([
type: "Query",
schema: z.string(),
},
{
name: "isICalUId",
type: "Query",
schema: z.boolean(),
},
],
response: CalendarEvent,
errors: [
Expand Down Expand Up @@ -1498,7 +1512,7 @@ const endpoints = makeApi([
{
name: "body",
type: "Body",
schema: z.object({ msftMeetingID: z.string() }).passthrough(),
schema: ReschedulingRequestSingleBodySchema,
},
],
response: z.number(),
Expand Down