Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

:sparkles feat(sub-calendars): use event schema WIP#1163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
victor-enogwe wants to merge5 commits intomain
base:main
Choose a base branch
Loading
fromfeat-use-new-event-schema-1138

Conversation

@victor-enogwe
Copy link
Collaborator

What does this PR do?

This PR migrates the codebase to use the new event's schema with sub-calendar support.

Use Case

closes#1135

CopilotAI review requested due to automatic review settingsOctober 24, 2025 05:38
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR migrates the codebase to use a new event schema that supports sub-calendars, moving away from user-based event organization to a calendar-based approach. The changes consolidate event-related types and update import paths to reflect the new schema structure.

Key changes:

  • MigratedCategories_Event and related enums from@core/types/event.types to@web/common/types/web.event.types
  • Updated event date handling to use nativeDate objects instead of string-based date formats
  • Removed several deprecated types and utility functions related to the old event schema
  • Updated import paths across the codebase to reflect the new type locations

Reviewed Changes

Copilot reviewed 168 out of 168 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
packages/web/src/common/types/web.event.types.tsDefinedCategories_Event enum and updated schema definitions for web events
packages/core/src/types/event.types.tsRemovedCategories_Event enum and consolidated event schemas with calendar support
packages/web/src/views/Forms/EventForm/DateControlsSection/RecurrenceSection/useRecurrence/useRecurrence.tsUpdated to useDate objects instead of string-based dates
packages/core/src/util/event/event.util.tsRemoved deprecated date parsing functions and updated event categorization logic
packages/core/src/mappers/map.event.tsSimplified mapper to remove provider data methods and consolidate metadata handling
packages/backend/src/user/services/user.service.tsUpdated user service methods to useObjectId instead of strings
packages/scripts/src/migrations/*.tsUpdated migration scripts to use new event schema

Event_Core,
Schema_Event,
}from"@core/types/event.types";
import{Event_Core,Schema_Event}from"@core/types/event.types";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The function referencesEventSchema but it's not imported. This will cause a runtime error. ImportEventSchema from@core/types/event.types.

Suggested change
import{Event_Core,Schema_Event}from"@core/types/event.types";
import{Event_Core,Schema_Event,EventSchema}from"@core/types/event.types";

Copilot uses AI. Check for mistakes.
Comment on lines +138 to 141
constdbUser=awaitmongoService.user.findOne({ _id});
constevents=this.#generateEvents(userId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

VariableuserId is used but never defined. It should be_id.toString() or the result should be assigned to auserId variable after line 138.

Copilot uses AI. Check for mistakes.
);

awaituserService.saveTimeFor("lastLoggedInAt",userId);
awaituserService.updateLastLoggedInTime("lastLoggedInAt",userId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The method signature appears incorrect. Based on the changes inuser.service.ts,updateLastLoggedInTime now takes only one parameter (userId as ObjectId), but here it's called with two string parameters.

Suggested change
awaituserService.updateLastLoggedInTime("lastLoggedInAt",userId);
awaituserService.updateLastLoggedInTime(mongoService.objectId(userId));

Copilot uses AI. Check for mistakes.
for(constuserofusers){
constuserId=user?._id.toString();
constsummary=awaituserService.deleteCompassDataForUser(userId);
constsummary=awaituserService.deleteCompassDataForUser(user._id);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Theuser._id field is already anObjectId from the database query, but the iteration variableuser shadows the outer scopeuser parameter (which is a string). This creates confusion. Consider renaming the loop variable todbUser for clarity.

Copilot uses AI. Check for mistakes.
@victor-enogwevictor-enogweforce-pushed thefeat-use-new-event-schema-1138 branch 2 times, most recently from9bafc94 to085f0aeCompareOctober 26, 2025 08:44
CopilotAI review requested due to automatic review settingsOctober 26, 2025 08:44
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

Copilot reviewed 184 out of 184 changed files in this pull request and generated 29 comments.

Comments suppressed due to low confidence (1)

packages/backend/src/sync/services/sync/tests/compass.sync.processor.all-event.test.ts:1

  • More references to removed properties:gRecurringEventId,gEventId, anduser that need to be updated to use the new metadata structure (metadata.recurringEventId,metadata.id) and calendar-based associations.
import { ObjectId } from "mongodb";


constuserId=(awaitthis.#findUserOrThrow(user!))._id.toString();
constdbUser=awaitmongoService.user.findOne({ _id});
constevents=this.#generateEvents(userId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

VariableuserId is used on line 139 but is no longer defined after the changes. The code now uses_id anddbUser, butuserId needs to be extracted from one of these. This will cause a ReferenceError.

Suggested change
constevents=this.#generateEvents(userId);
constevents=this.#generateEvents(dbUser._id.toString());

Copilot uses AI. Check for mistakes.
summary:"New Standalone Event",
});
constprocessor=newGcalSyncProcessor(user._id.toString());
constprocessor=newGcalEventsSyncProcessor(user._id.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The constructor signature changed to accept a calendar object instead of a user ID string. This call should pass a calendar object but is still passinguser._id.toString(). This will cause a type error.

Copilot uses AI. Check for mistakes.

/* Act */
constprocessor=newGcalSyncProcessor(user._id.toString());
constprocessor=newGcalEventsSyncProcessor(user._id.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The constructor signature changed to accept a calendar object, but this is still passing a user ID string. This needs to be updated to pass a calendar object consistent with the new architecture.

Suggested change
constprocessor=newGcalEventsSyncProcessor(user._id.toString());
constprocessor=newGcalEventsSyncProcessor(calendar);

Copilot uses AI. Check for mistakes.

/* Act */
constprocessor=newGcalSyncProcessor(user._id.toString());
constprocessor=newGcalEventsSyncProcessor(user._id.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Multiple instances whereGcalEventsSyncProcessor is constructed with a user ID string instead of a calendar object. All these need to be updated to match the new constructor signature.

Copilot uses AI. Check for mistakes.
};

constprocessor=newGcalSyncProcessor(user._id.toString());
constprocessor=newGcalEventsSyncProcessor(user._id.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Multiple instances whereGcalEventsSyncProcessor is constructed with a user ID string instead of a calendar object. All these need to be updated to match the new constructor signature.

Suggested change
constprocessor=newGcalEventsSyncProcessor(user._id.toString());
constcalendar=awaitCalendarDriver.getByUserId(user._id);
constprocessor=newGcalEventsSyncProcessor(calendar);

Copilot uses AI. Check for mistakes.
_getGcal(user,instanceUpdate!.gRecurringEventId!),
EventDriver.getGCalEvent(
user,
instanceUpdate!.gRecurringEventId!,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

More references to removed properties:gRecurringEventId,gEventId, anduser that need to be updated to use the new metadata structure (metadata.recurringEventId,metadata.id) and calendar-based associations.

Copilot uses AI. Check for mistakes.
newInstances.map((instance)=>
expect(_getGcal(user,instance.gEventId!)).rejects.toThrow(
expect(
EventDriver.getGCalEvent(user,instance.gEventId!),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

More references to removed properties:gRecurringEventId,gEventId, anduser that need to be updated to use the new metadata structure (metadata.recurringEventId,metadata.id) and calendar-based associations.

Copilot uses AI. Check for mistakes.
gcalInstances.map(()=>
expect.objectContaining({
recurringEventId:event!.gEventId,
recurringEventId:event.metadata?.id,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

More references to removed properties:gRecurringEventId,gEventId, anduser that need to be updated to use the new metadata structure (metadata.recurringEventId,metadata.id) and calendar-based associations.

Suggested change
recurringEventId:event.metadata?.id,
recurringEventId:event.metadata?.recurringEventId,

Copilot uses AI. Check for mistakes.
_getGcal(updatedPayload.user!,updatedPayload.gEventId!),
EventDriver.getGCalEvent(
updatedPayload.user!,
updatedPayload.gEventId!,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

More references to removed properties:gRecurringEventId,gEventId, anduser that need to be updated to use the new metadata structure (metadata.recurringEventId,metadata.id) and calendar-based associations.

Copilot uses AI. Check for mistakes.
instances.map((instance)=>
expect(
_getGcal(instance.user!,instance.gEventId!),
EventDriver.getGCalEvent(instance.user!,instance.gEventId!),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

More references to removed properties:gRecurringEventId,gEventId, anduser that need to be updated to use the new metadata structure (metadata.recurringEventId,metadata.id) and calendar-based associations.

Copilot uses AI. Check for mistakes.
@victor-enogwevictor-enogweforce-pushed thefeat-use-new-event-schema-1138 branch from085f0ae tod0b6831CompareOctober 29, 2025 01:53
CopilotAI review requested due to automatic review settingsOctober 30, 2025 13:24
@victor-enogwevictor-enogweforce-pushed thefeat-use-new-event-schema-1138 branch fromd0b6831 to36abb72CompareOctober 30, 2025 13:24
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

Copilot reviewed 104 out of 194 changed files in this pull request and generated 9 comments.

constevents=awaitgetEventsInDb({calendar:calendar._id, isSomeday});
consttypeFilter=type==="ALLDAY" ?isAllDay :isInstance;
constinstanceEvents=events.filter(isInstance).filter(typeFilter);
console.log("Events:",events.filter(isInstance));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove debug console.log statement from production code

Suggested change
console.log("Events:", events.filter(isInstance));

Copilot uses AI. Check for mistakes.
constupdateChanges=awaitCompassSyncProcessor.processEvents([
{
payload:updatedPayloadasCompassThisEvent["payload"],
payload,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The payload should beupdatedPayload instead of the originalpayload to match the test's intent of updating the priority field

Suggested change
payload,
payload:updatedPayload,

Copilot uses AI. Check for mistakes.
constupdateChanges=awaitCompassSyncProcessor.processEvents([
{
payload:updatedPayloadasCompassThisEvent["payload"],
payload,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The payload should beupdatedPayload instead of the originalpayload to match the test's intent of updating the endDate field

Suggested change
payload,
payload:updatedPayload,

Copilot uses AI. Check for mistakes.
constcalendar=awaitCalendarDriver.getRandomUserCalendar(_user._id);
constisSomeday=false;
constrecurrence={rule:["RRULE:FREQ=WEEKLY;COUNT=10"]};
constpayload=createMockBaseEvent({ isSomeday, user, recurrence});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The parameter should becalendar: calendar._id instead ofuser to match the updated API signature

Suggested change
constpayload=createMockBaseEvent({ isSomeday,user, recurrence});
constpayload=createMockBaseEvent({ isSomeday,calendar:calendar._id, recurrence});

Copilot uses AI. Check for mistakes.
// check that event is deleted in db
awaitexpect(
eventService.readById(user,deletedInstanceId),
eventService.readById(calendar,deletedInstanceId),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The first parameter should becalendar._id instead ofcalendar to match the service's expected signature

Suggested change
eventService.readById(calendar,deletedInstanceId),
eventService.readById(calendar._id,deletedInstanceId),

Copilot uses AI. Check for mistakes.
constupdateChanges=awaitCompassSyncProcessor.processEvents([
{
payload:updatedPayloadasCompassAllEvents["payload"],
user:_user._id,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This field should not be present in the event payload as it's now handled through the calendar parameter

Suggested change
user: _user._id,

Copilot uses AI. Check for mistakes.
conststatus=CompassEventStatus.CONFIRMED;
const_user=awaitAuthDriver.googleSignup();
constcalendar=awaitCalendarDriver.getRandomUserCalendar(user._id);
conststatus=EventStatus.CONFIRMED;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The status variable is declared but not used in the test. Either use it or remove the declaration

Suggested change
const status = EventStatus.CONFIRMED;

Copilot uses AI. Check for mistakes.
constuser=_user._id.toString();
conststatus=CompassEventStatus.CONFIRMED;
const_user=awaitAuthDriver.googleSignup();
constcalendar=awaitCalendarDriver.getRandomUserCalendar(user._id);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The variable should be_user._id instead ofuser._id to match the declared variable name

Suggested change
constcalendar=awaitCalendarDriver.getRandomUserCalendar(user._id);
constcalendar=awaitCalendarDriver.getRandomUserCalendar(_user._id);

Copilot uses AI. Check for mistakes.
Comment on lines 1788 to 1791
constcalendar=awaitCalendarDriver.getRandomUserCalendar(user._id);
conststatus=EventStatus.CONFIRMED;
constrecurrence={rule:["RRULE:FREQ=WEEKLY;COUNT=10"]};
constpayload=createMockBaseEvent({ recurrence, user});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The parameter should becalendar: calendar._id instead ofuser to match the updated API signature

Suggested change
constcalendar=awaitCalendarDriver.getRandomUserCalendar(user._id);
conststatus=EventStatus.CONFIRMED;
constrecurrence={rule:["RRULE:FREQ=WEEKLY;COUNT=10"]};
constpayload=createMockBaseEvent({ recurrence,user});
constcalendar=awaitCalendarDriver.getRandomUserCalendar(_user._id);
conststatus=EventStatus.CONFIRMED;
constrecurrence={rule:["RRULE:FREQ=WEEKLY;COUNT=10"]};
constpayload=createMockBaseEvent({ recurrence,calendar:calendar._id});

Copilot uses AI. Check for mistakes.
@victor-enogwevictor-enogweforce-pushed thefeat-use-new-event-schema-1138 branch from36abb72 tod27d482CompareNovember 2, 2025 22:22
CopilotAI review requested due to automatic review settingsNovember 3, 2025 13:11
@victor-enogwevictor-enogweforce-pushed thefeat-use-new-event-schema-1138 branch fromd27d482 to20e53cbCompareNovember 3, 2025 13:11
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

Copilot reviewed 103 out of 256 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

packages/backend/src/sync/services/sync/tests/compass-sync-processor-this-event/instance.test.ts:1

  • Debug console.log statement should be removed from production code. This appears to be leftover debug code that should be cleaned up.
import { faker } from "@faker-js/faker";

Comment on lines +423 to +424
`
ImportAllEvents completed for calendar(${calendar._id.toString()}).
Copy link

CopilotAINov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[nitpick] The template literal has an unnecessary leading newline character. The backtick should be placed directly after the opening parenthesis for better code formatting.

Suggested change
`
ImportAllEventscompletedforcalendar(${calendar._id.toString()}).
`ImportAllEvents completed for calendar(${calendar._id.toString()}).

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Update Event Schema and Collection for Multi-Calendar & Multi-Provider Support

2 participants

@victor-enogwe

[8]ページ先頭

©2009-2025 Movatter.jp