src/alerts/alerts.controller.ts
alerts
Methods |
| Async acknowledge | ||||||
acknowledge(id: string)
|
||||||
Decorators :
@Post(':id/acknowledge')
|
||||||
|
Defined in src/alerts/alerts.controller.ts:68
|
||||||
|
Parameters :
Returns :
unknown
|
| Async create | |||||||||
create(orgId: string, dto: CreateAlertDto)
|
|||||||||
Decorators :
@Post()
|
|||||||||
|
Defined in src/alerts/alerts.controller.ts:31
|
|||||||||
|
Parameters :
Returns :
unknown
|
| Async findAll | |||||||||
findAll(orgId: string, query: PaginationParams)
|
|||||||||
Decorators :
@Get()
|
|||||||||
|
Defined in src/alerts/alerts.controller.ts:47
|
|||||||||
|
Parameters :
Returns :
unknown
|
| Async findOne | ||||||
findOne(id: string)
|
||||||
Decorators :
@Get(':id')
|
||||||
|
Defined in src/alerts/alerts.controller.ts:56
|
||||||
|
Parameters :
Returns :
unknown
|
| Async getStats | ||||||
getStats(orgId: string)
|
||||||
Decorators :
@Get('stats')
|
||||||
|
Defined in src/alerts/alerts.controller.ts:40
|
||||||
|
Parameters :
Returns :
unknown
|
| Async remove | ||||||
remove(id: string)
|
||||||
Decorators :
@Delete(':id')
|
||||||
|
Defined in src/alerts/alerts.controller.ts:80
|
||||||
|
Parameters :
Returns :
unknown
|
| Async resolve | ||||||
resolve(id: string)
|
||||||
Decorators :
@Post(':id/resolve')
|
||||||
|
Defined in src/alerts/alerts.controller.ts:74
|
||||||
|
Parameters :
Returns :
unknown
|
| Async update | |||||||||
update(id: string, dto: UpdateAlertDto)
|
|||||||||
Decorators :
@Patch(':id')
|
|||||||||
|
Defined in src/alerts/alerts.controller.ts:62
|
|||||||||
|
Parameters :
Returns :
unknown
|
import {
Controller,
Get,
Post,
Patch,
Delete,
Body,
Param,
Query,
UseGuards,
} from '@nestjs/common';
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
import { AlertsService } from './alerts.service';
import { CreateAlertDto } from './dto/create-alert.dto';
import { UpdateAlertDto } from './dto/update-alert.dto';
import { CombinedAuthGuard } from '../auth/guards/combined-auth.guard';
import { RolesGuard } from '../auth/guards/roles.guard';
import { CurrentUser } from '../auth/decorators/current-user.decorator';
import { ApiPagination } from '../common/decorators/api-pagination.decorator';
import { PaginationParams } from '../common/utils/pagination.util';
@ApiTags('Alerts')
@ApiBearerAuth()
@UseGuards(CombinedAuthGuard, RolesGuard)
@Controller('alerts')
export class AlertsController {
constructor(private readonly alertsService: AlertsService) {}
@Post()
@ApiOperation({ summary: 'Create a new alert' })
async create(
@CurrentUser('organizationId') orgId: string,
@Body() dto: CreateAlertDto,
) {
return this.alertsService.create(orgId, dto);
}
@Get('stats')
@ApiOperation({ summary: 'Get alert statistics' })
async getStats(@CurrentUser('organizationId') orgId: string) {
return this.alertsService.getStats(orgId);
}
@Get()
@ApiPagination()
@ApiOperation({ summary: 'List all alerts' })
async findAll(
@CurrentUser('organizationId') orgId: string,
@Query() query: PaginationParams,
) {
return this.alertsService.findAll(orgId, query);
}
@Get(':id')
@ApiOperation({ summary: 'Get alert by ID' })
async findOne(@Param('id') id: string) {
return this.alertsService.findOne(id);
}
@Patch(':id')
@ApiOperation({ summary: 'Update an alert' })
async update(@Param('id') id: string, @Body() dto: UpdateAlertDto) {
return this.alertsService.update(id, dto);
}
@Post(':id/acknowledge')
@ApiOperation({ summary: 'Acknowledge an alert' })
async acknowledge(@Param('id') id: string) {
return this.alertsService.acknowledge(id);
}
@Post(':id/resolve')
@ApiOperation({ summary: 'Resolve an alert' })
async resolve(@Param('id') id: string) {
return this.alertsService.resolve(id);
}
@Delete(':id')
@ApiOperation({ summary: 'Delete an alert' })
async remove(@Param('id') id: string) {
return this.alertsService.remove(id);
}
}