42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Post,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import {
|
|
CurrentPrincipal,
|
|
RequirePermission,
|
|
} from '../identity/access.decorator';
|
|
import type { Principal } from '../identity/identity.types';
|
|
import { pageSchema, type PageInput } from '../identity/identity.schemas';
|
|
import { SchemaPipe } from '../common/validation.pipe';
|
|
import { OperationsStore } from './operations.store';
|
|
@Controller('admin/operations')
|
|
export class OperationsController {
|
|
constructor(private readonly operations: OperationsStore) {}
|
|
@Get('summary')
|
|
@RequirePermission('operations.read')
|
|
summary(@CurrentPrincipal() actor: Principal) {
|
|
return this.operations.summary(actor);
|
|
}
|
|
@Get('events')
|
|
@RequirePermission('operations.read')
|
|
events(
|
|
@CurrentPrincipal() actor: Principal,
|
|
@Query(new SchemaPipe(pageSchema)) page: PageInput,
|
|
) {
|
|
return this.operations.events(actor, page);
|
|
}
|
|
@Post('events/:id/retry')
|
|
@RequirePermission('notifications.retry')
|
|
retry(
|
|
@CurrentPrincipal() actor: Principal,
|
|
@Param('id', ParseUUIDPipe) id: string,
|
|
) {
|
|
return this.operations.retry(actor, id);
|
|
}
|
|
}
|