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
13 changes: 9 additions & 4 deletions apps/meteor/app/api/server/v1/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@ API.v1.addRoute(
{
async post() {
const { userId: uid } = this;
const { startTime, endTime, externalId, subject, description, meetingUrl, reminderMinutesBeforeStart } = this.bodyParams;
const { startTime, endTime, externalId, subject, description, meetingUrl, reminderMinutesBeforeStart, busy } = this.bodyParams;

const id = await Calendar.create({
uid,
startTime: new Date(startTime),
...(endTime ? { endTime: new Date(endTime) } : {}),
...(endTime && { endTime: new Date(endTime) }),
externalId,
subject,
description,
meetingUrl,
reminderMinutesBeforeStart,
...(typeof busy === 'boolean' && { busy }),
});

return API.v1.success({ id });
Expand All @@ -74,16 +75,18 @@ API.v1.addRoute(
{
async post() {
const { userId: uid } = this;
const { startTime, externalId, subject, description, meetingUrl, reminderMinutesBeforeStart } = this.bodyParams;
const { startTime, endTime, externalId, subject, description, meetingUrl, reminderMinutesBeforeStart, busy } = this.bodyParams;

const id = await Calendar.import({
uid,
startTime: new Date(startTime),
...(endTime && { endTime: new Date(endTime) }),
externalId,
subject,
description,
meetingUrl,
reminderMinutesBeforeStart,
...(typeof busy === 'boolean' && { busy }),
});

return API.v1.success({ id });
Expand All @@ -97,7 +100,7 @@ API.v1.addRoute(
{
async post() {
const { userId } = this;
const { eventId, startTime, subject, description, meetingUrl, reminderMinutesBeforeStart } = this.bodyParams;
const { eventId, startTime, endTime, subject, description, meetingUrl, reminderMinutesBeforeStart, busy } = this.bodyParams;

const event = await Calendar.get(eventId);

Expand All @@ -107,10 +110,12 @@ API.v1.addRoute(

await Calendar.update(eventId, {
startTime: new Date(startTime),
...(endTime && { endTime: new Date(endTime) }),
subject,
description,
meetingUrl,
reminderMinutesBeforeStart,
...(typeof busy === 'boolean' && { busy }),
});

return API.v1.success();
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/services/calendar/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export class CalendarService extends ServiceClassInternal implements ICalendarSe
// 1. The current status is BUSY (meaning it was set by our system, not manually changed by user)
// 2. We have a previousStatus stored from before the event started

if (event.previousStatus && event.previousStatus === user.status) {
if (user.status === UserStatus.BUSY && event.previousStatus && event.previousStatus !== user.status) {
await applyStatusChange({
eventId: event._id,
uid: event.uid,
Expand Down
Loading