mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
refactor(admin): the admin routes other domains serve keep their DTOs in those domains
NotificationsController, SettingsController, OidcController and the packing template controller each imported their body DTO from admin/admin.dto.ts, and AdminController imported the same four without using them. Those imports tied the notifications, settings, packing and oidc domains to the admin domain and through it to everything admin depends on. The classes move unchanged (same names, same @trek/shared schemas) into each domain's own dto file.
This commit is contained in:
@@ -6,38 +6,16 @@
|
||||
"accommodations -> places",
|
||||
"accommodations -> realtime",
|
||||
"addons -> memories",
|
||||
"addons -> settings",
|
||||
"addons -> transit",
|
||||
"admin -> addons",
|
||||
"admin -> auth",
|
||||
"admin -> booking-import",
|
||||
"admin -> llm-parse",
|
||||
"admin -> memories",
|
||||
"admin -> notifications",
|
||||
"admin -> oauth",
|
||||
"admin -> packing",
|
||||
"admin -> plugins",
|
||||
"admin -> realtime",
|
||||
"admin -> settings",
|
||||
"assignments -> days",
|
||||
"assignments -> journey",
|
||||
"assignments -> mcp-shared",
|
||||
"assignments -> realtime",
|
||||
"atlas -> addons",
|
||||
"atlas -> geo",
|
||||
"auth -> budget",
|
||||
"auth -> files",
|
||||
"auth -> maps",
|
||||
"auth -> notifications",
|
||||
"auth -> plugins",
|
||||
"auth -> settings",
|
||||
"booking-import -> addons",
|
||||
"booking-import -> budget",
|
||||
"booking-import -> llm-parse",
|
||||
"booking-import -> maps",
|
||||
"booking-import -> places",
|
||||
"booking-import -> realtime",
|
||||
"booking-import -> reservations",
|
||||
"budget -> addons",
|
||||
"budget -> mcp-shared",
|
||||
"budget -> realtime",
|
||||
@@ -74,25 +52,18 @@
|
||||
"journey -> addons",
|
||||
"journey -> atlas",
|
||||
"journey -> files",
|
||||
"journey -> maps",
|
||||
"journey -> memories",
|
||||
"journey -> photos",
|
||||
"journey -> realtime",
|
||||
"journey -> settings",
|
||||
"llm-parse -> addons",
|
||||
"llm-parse -> settings",
|
||||
"maps -> geo",
|
||||
"maps -> settings",
|
||||
"mcp-shared -> realtime",
|
||||
"memories -> addons",
|
||||
"memories -> notifications",
|
||||
"memories -> photos",
|
||||
"memories -> realtime",
|
||||
"notifications -> admin",
|
||||
"notifications -> realtime",
|
||||
"oauth -> addons",
|
||||
"packing -> addons",
|
||||
"packing -> admin",
|
||||
"packing -> mcp-shared",
|
||||
"packing -> notifications",
|
||||
"packing -> realtime",
|
||||
@@ -101,10 +72,8 @@
|
||||
"places -> assignments",
|
||||
"places -> atlas",
|
||||
"places -> journey",
|
||||
"places -> maps",
|
||||
"places -> mcp-shared",
|
||||
"places -> realtime",
|
||||
"places -> unsplash",
|
||||
"plugins -> accommodations",
|
||||
"plugins -> addons",
|
||||
"plugins -> assignments",
|
||||
@@ -118,7 +87,6 @@
|
||||
"plugins -> files",
|
||||
"plugins -> journey",
|
||||
"plugins -> llm-parse",
|
||||
"plugins -> maps",
|
||||
"plugins -> notifications",
|
||||
"plugins -> packing",
|
||||
"plugins -> places",
|
||||
@@ -137,15 +105,12 @@
|
||||
"reservations -> mcp-shared",
|
||||
"reservations -> notifications",
|
||||
"reservations -> realtime",
|
||||
"settings -> admin",
|
||||
"todo -> addons",
|
||||
"todo -> mcp-shared",
|
||||
"todo -> realtime",
|
||||
"transit -> days",
|
||||
"transit -> maps",
|
||||
"transit -> mcp-shared",
|
||||
"transit -> reservations",
|
||||
"transit -> settings",
|
||||
"trip-members -> auth",
|
||||
"trip-members -> budget",
|
||||
"trip-members -> notifications",
|
||||
@@ -174,13 +139,10 @@
|
||||
"trips -> places",
|
||||
"trips -> realtime",
|
||||
"trips -> reservations",
|
||||
"trips -> settings",
|
||||
"trips -> todo",
|
||||
"trips -> trip-members",
|
||||
"trips -> trip-read-model",
|
||||
"trips -> unsplash",
|
||||
"trips -> vacay",
|
||||
"unsplash -> settings",
|
||||
"vacay -> addons",
|
||||
"vacay -> auth",
|
||||
"vacay -> notifications",
|
||||
@@ -228,9 +190,6 @@
|
||||
"journey -> storage/storage-upload.factory.ts",
|
||||
"maps -> geo/nominatim.client.ts",
|
||||
"maps -> settings/instance-api-keys.ts",
|
||||
"notifications -> admin/admin.dto.ts",
|
||||
"oidc -> admin/admin.dto.ts",
|
||||
"packing -> admin/admin.dto.ts",
|
||||
"place-enrichment -> maps/maps.helpers.ts",
|
||||
"place-enrichment -> maps/trek-places.client.ts",
|
||||
"places -> atlas/atlas-geo.ts",
|
||||
@@ -251,7 +210,6 @@
|
||||
"roadtrip -> plugins/contributions/plugin-route-normalize.ts",
|
||||
"roadtrip -> plugins/contributions/plugin-search.helpers.ts",
|
||||
"roadtrip -> plugins/kill-switch.ts",
|
||||
"settings -> admin/admin.dto.ts",
|
||||
"transit -> maps/maps.helpers.ts",
|
||||
"transit -> settings/instance-api-keys.ts",
|
||||
"trip-members -> trips/trips.dto.ts",
|
||||
|
||||
@@ -12,12 +12,8 @@ import {
|
||||
AdminPermissionsDto,
|
||||
AdminInviteCreateDto,
|
||||
AdminFeatureToggleDto,
|
||||
AdminTemplateNameDto,
|
||||
AdminOidcUpdateDto,
|
||||
AdminAddonUpdateDto,
|
||||
AdminCollabFeaturesDto,
|
||||
AdminNotificationPreferencesDto,
|
||||
AdminDefaultUserSettingsDto,
|
||||
AdminTestNotificationDto,
|
||||
AdminTransitProviderDto,
|
||||
} from './admin.dto';
|
||||
|
||||
@@ -5,13 +5,8 @@ import {
|
||||
adminPermissionsRequestSchema,
|
||||
adminInviteCreateRequestSchema,
|
||||
adminFeatureToggleRequestSchema,
|
||||
adminTemplateNameRequestSchema,
|
||||
adminOidcUpdateRequestSchema,
|
||||
adminAddonUpdateRequestSchema,
|
||||
adminCollabFeaturesRequestSchema,
|
||||
adminNotificationPreferencesRequestSchema,
|
||||
notificationDefaultsUpdateRequestSchema,
|
||||
adminDefaultUserSettingsRequestSchema,
|
||||
adminTestNotificationRequestSchema,
|
||||
adminTransitProviderRequestSchema,
|
||||
} from '@trek/shared';
|
||||
@@ -22,21 +17,17 @@ import {
|
||||
* parameter typed with one of these classes by metatype — the Zod schemas in
|
||||
* shared/ remain the single source of truth for the wire contract.
|
||||
*
|
||||
* Thirteen classes cover the AdminController body contracts:
|
||||
* the four feature toggles share AdminFeatureToggleDto and the six
|
||||
* packing-template create/update routes share AdminTemplateNameDto.
|
||||
* These cover the AdminController body contracts; the four feature toggles
|
||||
* share AdminFeatureToggleDto. The admin routes served by other domains
|
||||
* (packing templates, OIDC, notification and user-setting defaults) keep their
|
||||
* DTOs in those domains, so a domain controller never imports the admin domain.
|
||||
*/
|
||||
export class AdminUserCreateDto extends createZodDto(adminUserCreateRequestSchema) {}
|
||||
export class AdminUserUpdateDto extends createZodDto(adminUserUpdateRequestSchema) {}
|
||||
export class AdminPermissionsDto extends createZodDto(adminPermissionsRequestSchema) {}
|
||||
export class AdminInviteCreateDto extends createZodDto(adminInviteCreateRequestSchema) {}
|
||||
export class AdminFeatureToggleDto extends createZodDto(adminFeatureToggleRequestSchema) {}
|
||||
export class AdminTemplateNameDto extends createZodDto(adminTemplateNameRequestSchema) {}
|
||||
export class AdminOidcUpdateDto extends createZodDto(adminOidcUpdateRequestSchema) {}
|
||||
export class AdminAddonUpdateDto extends createZodDto(adminAddonUpdateRequestSchema) {}
|
||||
export class AdminCollabFeaturesDto extends createZodDto(adminCollabFeaturesRequestSchema) {}
|
||||
export class AdminNotificationPreferencesDto extends createZodDto(adminNotificationPreferencesRequestSchema) {}
|
||||
export class NotificationDefaultsUpdateDto extends createZodDto(notificationDefaultsUpdateRequestSchema) {}
|
||||
export class AdminDefaultUserSettingsDto extends createZodDto(adminDefaultUserSettingsRequestSchema) {}
|
||||
export class AdminTestNotificationDto extends createZodDto(adminTestNotificationRequestSchema) {}
|
||||
export class AdminTransitProviderDto extends createZodDto(adminTransitProviderRequestSchema) {}
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
|
||||
import { AdminGuard } from '../auth-core/admin.guard';
|
||||
import { NotificationPreferencesService } from './notification-preferences.service';
|
||||
import { AdminNotificationPreferencesDto, NotificationDefaultsUpdateDto } from '../admin/admin.dto';
|
||||
import { AdminNotificationPreferencesDto, NotificationDefaultsUpdateDto } from './notifications.dto';
|
||||
import { CurrentUser } from '../auth-core/current-user.decorator';
|
||||
import { ManagedForbidden } from '../common/managed';
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { createZodDto } from 'nestjs-zod';
|
||||
import {
|
||||
adminNotificationPreferencesRequestSchema,
|
||||
notificationDefaultsUpdateRequestSchema,
|
||||
preferencesUpdateRequestSchema,
|
||||
testSmtpRequestSchema,
|
||||
testWebhookRequestSchema,
|
||||
@@ -23,3 +25,7 @@ export class TestNtfyDto extends createZodDto(testNtfyRequestSchema) {}
|
||||
export class NotificationRespondDto extends createZodDto(notificationRespondRequestSchema) {}
|
||||
export class PushSubscribeDto extends createZodDto(pushSubscribeRequestSchema) {}
|
||||
export class PushUnsubscribeDto extends createZodDto(pushUnsubscribeRequestSchema) {}
|
||||
|
||||
/** The admin-side notification routes NotificationsController serves. */
|
||||
export class AdminNotificationPreferencesDto extends createZodDto(adminNotificationPreferencesRequestSchema) {}
|
||||
export class NotificationDefaultsUpdateDto extends createZodDto(notificationDefaultsUpdateRequestSchema) {}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CurrentUser } from '../auth-core/current-user.decorator';
|
||||
import type { User } from '../../types';
|
||||
import { AuditService } from '../audit/audit.service';
|
||||
import { getClientIp } from '../audit/client-ip';
|
||||
import { AdminOidcUpdateDto } from '../admin/admin.dto';
|
||||
import { AdminOidcUpdateDto } from './oidc.dto';
|
||||
import { Public } from '../auth-core/public.decorator';
|
||||
import { ManagedForbidden } from '../common/managed';
|
||||
import { sessionClientFrom } from '../sessions/sessions.service';
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createZodDto } from 'nestjs-zod';
|
||||
import { adminOidcUpdateRequestSchema } from '@trek/shared';
|
||||
|
||||
/** Body of the admin OIDC settings route OidcController serves. */
|
||||
export class AdminOidcUpdateDto extends createZodDto(adminOidcUpdateRequestSchema) {}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Body, Controller, Delete, Get, HttpCode, HttpException, Param, Post, Put, Req, UseGuards } from '@nestjs/common';
|
||||
import type { Request } from 'express';
|
||||
import { PackingService } from './packing.service';
|
||||
import { AdminTemplateNameDto } from '../admin/admin.dto';
|
||||
import { AdminTemplateNameDto } from './packing.dto';
|
||||
import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
|
||||
import { AdminGuard } from '../auth-core/admin.guard';
|
||||
import { CurrentUser } from '../auth-core/current-user.decorator';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createZodDto } from 'nestjs-zod';
|
||||
import {
|
||||
adminTemplateNameRequestSchema,
|
||||
packingCreateItemRequestSchema,
|
||||
packingUpdateItemRequestSchema,
|
||||
packingSetSharingRequestSchema,
|
||||
@@ -30,3 +31,6 @@ export class PackingBagMembersDto extends createZodDto(packingBagMembersRequestS
|
||||
export class PackingSaveTemplateDto extends createZodDto(packingSaveTemplateRequestSchema) {}
|
||||
export class PackingApplyTemplateDto extends createZodDto(packingApplyTemplateRequestSchema) {}
|
||||
export class PackingCategoryAssigneesDto extends createZodDto(packingCategoryAssigneesRequestSchema) {}
|
||||
|
||||
/** The six packing-template create/update routes of AdminPackingTemplatesController share this body. */
|
||||
export class AdminTemplateNameDto extends createZodDto(adminTemplateNameRequestSchema) {}
|
||||
|
||||
@@ -3,8 +3,7 @@ import type { Request } from 'express';
|
||||
import { MASKED_SETTING_VALUE } from '@trek/shared';
|
||||
import type { User } from '../../types';
|
||||
import { SettingsService, isAdminOnlyEndpointSetting } from './settings.service';
|
||||
import { SettingUpsertDto, SettingsBulkDto } from './settings.dto';
|
||||
import { AdminDefaultUserSettingsDto } from '../admin/admin.dto';
|
||||
import { AdminDefaultUserSettingsDto, SettingUpsertDto, SettingsBulkDto } from './settings.dto';
|
||||
import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
|
||||
import { AdminGuard } from '../auth-core/admin.guard';
|
||||
import { AuditService } from '../audit/audit.service';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createZodDto } from 'nestjs-zod';
|
||||
import { settingUpsertRequestSchema, settingsBulkRequestSchema } from '@trek/shared';
|
||||
import { adminDefaultUserSettingsRequestSchema, settingUpsertRequestSchema, settingsBulkRequestSchema } from '@trek/shared';
|
||||
|
||||
/**
|
||||
* Server-side createZodDto wrappers over the @trek/shared settings contracts.
|
||||
@@ -9,3 +9,6 @@ import { settingUpsertRequestSchema, settingsBulkRequestSchema } from '@trek/sha
|
||||
*/
|
||||
export class SettingUpsertDto extends createZodDto(settingUpsertRequestSchema) {}
|
||||
export class SettingsBulkDto extends createZodDto(settingsBulkRequestSchema) {}
|
||||
|
||||
/** The admin route for the instance-wide user-setting defaults. */
|
||||
export class AdminDefaultUserSettingsDto extends createZodDto(adminDefaultUserSettingsRequestSchema) {}
|
||||
|
||||
Reference in New Issue
Block a user