Skip to content

Commit

Permalink
feat: GCal event series for Standup (#9959)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dschoordsch authored Jul 22, 2024
1 parent 23c8048 commit 8a6659a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/server/graphql/public/mutations/startTeamPrompt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {SubscriptionChannel} from 'parabol-client/types/constEnums'
import getRethink from '../../../database/rethinkDriver'
import getKysely from '../../../postgres/getKysely'
import updateTeamByTeamId from '../../../postgres/queries/updateTeamByTeamId'
import RedisLockQueue from '../../../utils/RedisLockQueue'
import {analytics} from '../../../utils/analytics/analytics'
Expand Down Expand Up @@ -61,22 +62,31 @@ const startTeamPrompt: MutationResolvers['startTeamPrompt'] = async (
])

const {id: meetingId} = meeting
if (rrule) {
const meetingSeries = await startNewMeetingSeries(meeting, rrule, name)
const meetingSeries = rrule && (await startNewMeetingSeries(meeting, rrule, name))
if (meetingSeries) {
// meeting was modified if a new meeting series was created
dataLoader.get('newMeetings').clear(meetingId)
analytics.recurrenceStarted(viewer, meetingSeries)
}
IntegrationNotifier.startMeeting(dataLoader, meetingId, teamId)
analytics.meetingStarted(viewer, meeting)
const {error} = await createGcalEvent({
const {error, gcalSeriesId} = await createGcalEvent({
name: eventName,
gcalInput,
meetingId,
teamId,
viewerId,
rrule,
dataLoader
})
if (meetingSeries && gcalSeriesId) {
const pg = getKysely()
await pg
.updateTable('MeetingSeries')
.set({gcalSeriesId})
.where('id', '=', meetingSeries.id)
.execute()
}
const data = {teamId, meetingId: meetingId, hasGcalError: !!error?.message}
publish(SubscriptionChannel.TEAM, teamId, 'StartTeamPromptSuccess', data, subOptions)
return data
Expand Down

0 comments on commit 8a6659a

Please sign in to comment.