mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 09:54:14 +00:00
refactor(notifications, place-photos, backup): async DB-touching methods; transactions through UnitOfWork
This commit is contained in:
@@ -243,7 +243,7 @@ export async function createMcpTestRegistry(): Promise<McpRegistry> {
|
||||
new AtlasMcp(new AtlasService(dbService, await createTestUnitOfWork(dbService.connection)), addonsService, authService),
|
||||
new JourneyMcp(journeyDomain, new JourneyShareService(dbService, journeyDomain, new SettingsService(dbService, await createTestUnitOfWork(dbService.connection))), addonsService, authService, captureBackfill),
|
||||
new MemoriesMcp(immichService, synologyService, dbService, addonsService),
|
||||
new NotificationsMcp(makeNotificationsService(dbService, realtimeService), authService),
|
||||
new NotificationsMcp(await makeNotificationsService(dbService, realtimeService), authService),
|
||||
new AirtrailMcp(new AirtrailService(dbService, new AuditService(dbService), new AirtrailClient()), addonsService),
|
||||
new ReservationImportMcp(new AirtrailImportService(dbService, realtimeService, reservationsService, new AirtrailClient(), new AirtrailService(dbService, new AuditService(dbService), new AirtrailClient())), dbService, authService, guards, addonsService),
|
||||
new SettingsMcp(new SettingsService(dbService, await createTestUnitOfWork(dbService.connection)), authService),
|
||||
|
||||
@@ -5,6 +5,7 @@ import { NotificationPreferencesService } from '../../src/nest/notifications/not
|
||||
import { NotificationsService } from '../../src/nest/notifications/notifications.service';
|
||||
import { NtfyService } from '../../src/nest/notifications/transports/ntfy.service';
|
||||
import { WebhookService } from '../../src/nest/notifications/transports/webhook.service';
|
||||
import { createTestUnitOfWork } from './test-uow';
|
||||
|
||||
/**
|
||||
* A NotificationsService wired the way Nest wires it.
|
||||
@@ -13,21 +14,23 @@ import { WebhookService } from '../../src/nest/notifications/transports/webhook.
|
||||
* it by hand — every added constructor parameter was an eight-file diff. One
|
||||
* helper keeps that at one.
|
||||
*/
|
||||
export function makeNotificationsService(dbs: DatabaseService, realtime = new RealtimeService()): NotificationsService {
|
||||
export async function makeNotificationsService(dbs: DatabaseService, realtime = new RealtimeService()): Promise<NotificationsService> {
|
||||
const mailer = new MailerService(dbs);
|
||||
const uow = await createTestUnitOfWork(dbs.connection);
|
||||
return new NotificationsService(
|
||||
dbs,
|
||||
realtime,
|
||||
mailer,
|
||||
new WebhookService(dbs),
|
||||
new NtfyService(dbs),
|
||||
new NotificationPreferencesService(dbs, mailer),
|
||||
new NotificationPreferencesService(dbs, mailer, uow),
|
||||
uow,
|
||||
);
|
||||
}
|
||||
|
||||
/** The preferences half on its own, over the same connection. */
|
||||
export function makeNotificationPreferencesService(dbs: DatabaseService): NotificationPreferencesService {
|
||||
return new NotificationPreferencesService(dbs, new MailerService(dbs));
|
||||
export async function makeNotificationPreferencesService(dbs: DatabaseService): Promise<NotificationPreferencesService> {
|
||||
return new NotificationPreferencesService(dbs, new MailerService(dbs), await createTestUnitOfWork(dbs.connection));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ export async function createPluginRpcHostFactory(dbs: DatabaseService): Promise<
|
||||
const dayNotes = new DayNotesService(dbs, permissions, realtime);
|
||||
const assignments = new AssignmentsService(dbs, permissions, realtime, queryHelpers, journey);
|
||||
const membership = new TripMembershipService(dbs);
|
||||
const notifications = makeNotificationsService(dbs, realtime);
|
||||
const notifications = await makeNotificationsService(dbs, realtime);
|
||||
const llmConfig = new LlmConfigResolver(new SettingsService(dbs, await createTestUnitOfWork(dbs.connection)), dbs, addons);
|
||||
const oauth = new PluginOAuthService(dbs);
|
||||
const accommodations = new AccommodationsService(dbs, permissions, realtime, assignments, await createTestUnitOfWork(dbs.connection));
|
||||
|
||||
Reference in New Issue
Block a user