22 lines
757 B
TypeScript
22 lines
757 B
TypeScript
import { Controller, Get, Query } from '@nestjs/common';
|
|
import {
|
|
CurrentPrincipal,
|
|
RequirePermission,
|
|
} from '../identity/access.decorator';
|
|
import type { Principal } from '../identity/identity.types';
|
|
import { SchemaPipe } from '../common/validation.pipe';
|
|
import { sourceQuerySchema, type SourceQuery } from './source.schemas';
|
|
import { AccountingSourceStore } from './source.store';
|
|
@Controller('accounting')
|
|
@RequirePermission('accounting.read')
|
|
export class AccountingController {
|
|
constructor(private readonly sources: AccountingSourceStore) {}
|
|
@Get('source-events')
|
|
events(
|
|
@CurrentPrincipal() actor: Principal,
|
|
@Query(new SchemaPipe(sourceQuerySchema)) query: SourceQuery,
|
|
) {
|
|
return this.sources.events(actor, query);
|
|
}
|
|
}
|