mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 20:10:56 +00:00
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { Controller, Get, Post, UseGuards } from '@nestjs/common';
|
|
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
import { CurrentUser } from '@tria-plc/api-common/modules/auth/decorators/current-user.decorator';
|
|
import { JwtGuard } from '@tria-plc/api-common/modules/auth/services/jwt.guard';
|
|
import type { TCurrentUser } from '@tria-plc/api-common/modules/auth/types/current-user.type';
|
|
|
|
import { ChatSync } from '../../common/booking-guards';
|
|
import { ChatProvisioningService } from './chat-provisioning.service';
|
|
import { ChatSsoService } from './chat-sso.service';
|
|
|
|
@ApiTags('chat')
|
|
@Controller('chat')
|
|
@ApiBearerAuth()
|
|
export class ChatController {
|
|
constructor(
|
|
private readonly sso: ChatSsoService,
|
|
private readonly provisioning: ChatProvisioningService,
|
|
) {}
|
|
|
|
@Get('sso')
|
|
@UseGuards(JwtGuard)
|
|
@ApiOperation({ summary: 'One-click sign-in link into EDR internal chat' })
|
|
getSso(@CurrentUser() user: TCurrentUser) {
|
|
return this.sso.getSsoUrl(user);
|
|
}
|
|
|
|
@Post('sync')
|
|
@ChatSync()
|
|
@ApiOperation({
|
|
summary: 'Re-run the chat room/membership reconcile immediately (normally nightly)',
|
|
})
|
|
sync() {
|
|
return this.provisioning.reconcile();
|
|
}
|
|
}
|