mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 16:03:02 +00:00
chore: move day backend to proper DI
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { DaysModule } from '../days/days.module';
|
||||
import { FilesModule } from '../files/files.module';
|
||||
import { PackingModule } from '../packing/packing.module';
|
||||
import { ReservationsModule } from '../reservations/reservations.module';
|
||||
@@ -9,7 +10,7 @@ import { TripsService } from './trips.service';
|
||||
/** Trips aggregate root (C1 — Phase 3). Uses exact strangler prefixes so it does
|
||||
* not capture the nested sub-domain mounts (collab, files, ...). */
|
||||
@Module({
|
||||
imports: [TodoModule, PackingModule, FilesModule, ReservationsModule],
|
||||
imports: [TodoModule, PackingModule, FilesModule, ReservationsModule, DaysModule],
|
||||
controllers: [TripsController],
|
||||
providers: [TripsService],
|
||||
})
|
||||
|
||||
@@ -4,8 +4,8 @@ import { broadcast } from '../../websocket';
|
||||
import { checkPermission } from '../../services/permissions';
|
||||
import type { User } from '../../types';
|
||||
import * as tripSvc from '../../services/tripService';
|
||||
import { listDays, listAccommodations } from '../../services/dayService';
|
||||
import { listPlaces } from '../../services/placeService';
|
||||
import { DaysService } from '../days/days.service';
|
||||
import { PackingService } from '../packing/packing.service';
|
||||
import { TodoService } from '../todo/todo.service';
|
||||
import { listBudgetItems, rebaseTripCurrency } from '../../services/budgetService';
|
||||
@@ -28,6 +28,7 @@ export class TripsService {
|
||||
private readonly packing: PackingService,
|
||||
private readonly files: FilesService,
|
||||
private readonly reservations: ReservationsService,
|
||||
private readonly days: DaysService,
|
||||
) {}
|
||||
|
||||
private get db() {
|
||||
@@ -133,7 +134,7 @@ export class TripsService {
|
||||
|
||||
/** Aggregates every trip sub-collection for offline caching (legacy /:id/bundle). */
|
||||
bundle(tripId: string, trip: { user_id: number }, viewerId: number) {
|
||||
const { days } = listDays(tripId);
|
||||
const { days } = this.days.list(tripId);
|
||||
const { owner, members } = this.listMembers(tripId, trip.user_id);
|
||||
return {
|
||||
trip,
|
||||
@@ -146,7 +147,7 @@ export class TripsService {
|
||||
budgetItems: listBudgetItems(tripId),
|
||||
reservations: this.reservations.list(tripId),
|
||||
files: this.files.listFiles(tripId, false),
|
||||
accommodations: listAccommodations(tripId),
|
||||
accommodations: this.days.listAccommodations(tripId),
|
||||
members: [owner, ...(members || [])].filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user