File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
packages/backend/src/event/controllers Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,12 @@ class EventController {
2222 private async processEvents ( _events : CompassEvent [ ] ) {
2323 const events = _events . map ( ( e ) => ( {
2424 ...e ,
25- payload : CompassCoreEventSchema . parse ( e . payload ) ,
25+ payload : CompassCoreEventSchema . parse ( {
26+ ...e . payload ,
27+ _id :
28+ e . payload . _id ?. replace ( `${ ID_OPTIMISTIC_PREFIX } -` , "" ) ??
29+ new ObjectId ( ) . toString ( ) ,
30+ } ) ,
2631 } ) ) as CompassEvent [ ] ;
2732
2833 await CompassSyncProcessor . processEvents ( events ) ;
@@ -39,15 +44,11 @@ class EventController {
3944 // Handle both single object and array cases
4045 const events = Array . isArray ( body ) ? body : [ body ] ;
4146
47+ console . log ( events ) ;
48+
4249 await this . processEvents (
4350 events . map ( ( e ) => ( {
44- payload : {
45- ...e ,
46- _id :
47- e . _id ?. replace ( `${ ID_OPTIMISTIC_PREFIX } ` , "" ) ??
48- new ObjectId ( ) . toString ( ) ,
49- user,
50- } ,
51+ payload : { ...e , user } ,
5152 status : CompassEventStatus . CONFIRMED ,
5253 applyTo : RecurringEventUpdateScope . THIS_EVENT ,
5354 } ) ) as CompassEvent [ ] ,
You can’t perform that action at this time.
0 commit comments