Files
stack/apps/gateway/src/reload/reload.controller.ts
Jason Woltje 24f5c0699a
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
feat(gateway): MosaicPlugin lifecycle + ReloadService + hot reload (P8-013) (#182)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-03-16 03:00:56 +00:00

23 lines
790 B
TypeScript

import { Controller, HttpCode, HttpStatus, Inject, Post, UseGuards } from '@nestjs/common';
import type { SystemReloadPayload } from '@mosaic/types';
import { AdminGuard } from '../admin/admin.guard.js';
import { ChatGateway } from '../chat/chat.gateway.js';
import { ReloadService } from './reload.service.js';
@Controller('api/admin')
@UseGuards(AdminGuard)
export class ReloadController {
constructor(
@Inject(ReloadService) private readonly reloadService: ReloadService,
@Inject(ChatGateway) private readonly chatGateway: ChatGateway,
) {}
@Post('reload')
@HttpCode(HttpStatus.OK)
async triggerReload(): Promise<SystemReloadPayload> {
const result = await this.reloadService.reload('rest');
this.chatGateway.broadcastReload(result);
return result;
}
}