Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

refactor(trips): the member departure port in common/, where both sides may import it

Mauricea6da69ee36c8
diff --git a/server/src/nest/trip-members/trip-member-departure.types.ts b/server/src/nest/common/trip-member-departure.types.ts
similarity index 81%
rename from server/src/nest/trip-members/trip-member-departure.types.ts
rename to server/src/nest/common/trip-member-departure.types.ts
index 6fa6dc5f1..e1fcfc4a3 100644
--- a/server/src/nest/trip-members/trip-member-departure.types.ts
+++ b/server/src/nest/common/trip-member-departure.types.ts
@@ -3,7 +3,8 @@
*
* A port rather than the journal link service itself: the journey domain
* already depends on the trip roster through others, so reaching into it from
- * here closed a cycle. The journey domain binds the token
+ * the roster closed a cycle. It lives in common/ because either domain owning
+ * it would draw that edge again. The journey domain binds the token
* (TripMemberDepartureModule), and the roster calls it inside the transaction
* that removes the member.
*/
diff --git a/server/src/nest/journey/trip-journal-link.service.ts b/server/src/nest/journey/trip-journal-link.service.ts
index 1ce2bf83c..7eee10b75 100644
--- a/server/src/nest/journey/trip-journal-link.service.ts
+++ b/server/src/nest/journey/trip-journal-link.service.ts
@@ -4,10 +4,10 @@ import type { JourneyContributorsRepository } from '../../db/repositories/Journe
import type { TripJournalLinksRepository, TripPersonRow } from '../../db/repositories/TripJournalLinks.repository';
import { avatarUrl } from '../common/avatarUrl';
import { forbidden, notFound } from '../common/domain-error';
+import type { TripMemberDeparture } from '../common/trip-member-departure.types';
import { UnitOfWork } from '../database/unit-of-work';
import { PermissionsService } from '../permissions/permissions.service';
import { RealtimeService } from '../realtime/realtime.service';
-import type { TripMemberDeparture } from '../trip-members/trip-member-departure.types';
import { TripAccessService } from '../trip-membership/trip-access.service';
import { JourneyDomainService } from './journey-domain.service';
import { InjectRepository } from '@mikro-orm/nestjs';
diff --git a/server/src/nest/journey/trip-member-departure.module.ts b/server/src/nest/journey/trip-member-departure.module.ts
index 1d232b349..c5f37709f 100644
--- a/server/src/nest/journey/trip-member-departure.module.ts
+++ b/server/src/nest/journey/trip-member-departure.module.ts
@@ -1,4 +1,4 @@
-import { TRIP_MEMBER_DEPARTURE } from '../trip-members/trip-member-departure.types';
+import { TRIP_MEMBER_DEPARTURE } from '../common/trip-member-departure.types';
import { TripJournalLinkModule } from './trip-journal-link.module';
import { TripJournalLinkService } from './trip-journal-link.service';
import { Global, Module } from '@nestjs/common';
diff --git a/server/src/nest/trip-members/trip-members.service.ts b/server/src/nest/trip-members/trip-members.service.ts
index d9866e94d..72202fabc 100644
--- a/server/src/nest/trip-members/trip-members.service.ts
+++ b/server/src/nest/trip-members/trip-members.service.ts
@@ -10,11 +10,11 @@ import { UserCleanupService } from '../auth/user-cleanup.service';
import { BudgetService } from '../budget/budget.service';
import { avatarUrl } from '../common/avatarUrl';
import { NotFoundError, ValidationError } from '../common/domain-errors';
+import { TRIP_MEMBER_DEPARTURE, type TripMemberDeparture } from '../common/trip-member-departure.types';
import { UnitOfWork } from '../database/unit-of-work';
import { NotificationsService } from '../notifications/notifications.service';
import { PermissionsService } from '../permissions/permissions.service';
import { RealtimeService } from '../realtime/realtime.service';
-import { TRIP_MEMBER_DEPARTURE, type TripMemberDeparture } from './trip-member-departure.types';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Inject, Injectable } from '@nestjs/common';
import type { TrekWsPayload, TrekWsTripEventName } from '@trek/shared';
diff --git a/server/tests/helpers/journey-share-repos.ts b/server/tests/helpers/journey-share-repos.ts
index 1fd12ee27..c97ae39bb 100644
--- a/server/tests/helpers/journey-share-repos.ts
+++ b/server/tests/helpers/journey-share-repos.ts
@@ -2,10 +2,7 @@ import { JourneyBooks } from '../../src/db/entities/JourneyBooks.entity';
import { JourneyShareTokens } from '../../src/db/entities/JourneyShareTokens.entity';
import type { JourneyBooksRepository } from '../../src/db/repositories/JourneyBooks.repository';
import type { JourneyShareTokensRepository } from '../../src/db/repositories/JourneyShareTokens.repository';
-import {
- TRIP_MEMBER_DEPARTURE,
- type TripMemberDeparture,
-} from '../../src/nest/trip-members/trip-member-departure.types';
+import { TRIP_MEMBER_DEPARTURE, type TripMemberDeparture } from '../../src/nest/common/trip-member-departure.types';
import { sharedTestOrm } from './test-uow';
import { Global, Module } from '@nestjs/common';