Dashboard, Search, Calendar, Statistics, Qr, Export, Documents: @Roles(...) durch @RequirePermission(...) ersetzt bzw. neu eingefuehrt (alle diese Controller hatten zuvor gar keine Rollenpruefung - jeder eingeloggte Nutzer konnte lesen). Documents behaelt STAFF-Zugriff auf Upload und Loeschen. Verifiziert: tsc, lint, volle e2e-Suite 158/159 gruen (1 getrackter Skip). Co-Authored-By: Claude Sonnet 5 <[email protected]>
31 lines
866 B
TypeScript
31 lines
866 B
TypeScript
import { BadRequestException, Controller, Get, Query } from '@nestjs/common';
|
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
|
import { RequirePermission } from '../auth/decorators/require-permission.decorator';
|
|
import { CalendarService } from './calendar.service';
|
|
|
|
@ApiTags('calendar')
|
|
@ApiBearerAuth()
|
|
@Controller('calendar')
|
|
export class CalendarController {
|
|
constructor(private readonly calendarService: CalendarService) {}
|
|
|
|
@RequirePermission('calendar:read')
|
|
@Get()
|
|
getEvents(
|
|
@Query('from') from: string,
|
|
@Query('to') to: string,
|
|
@Query('apiaryId') apiaryId?: string,
|
|
) {
|
|
if (!from || !to) {
|
|
throw new BadRequestException(
|
|
'Query parameters from and to are required',
|
|
);
|
|
}
|
|
return this.calendarService.getEvents({
|
|
from: new Date(from),
|
|
to: new Date(to),
|
|
apiaryId,
|
|
});
|
|
}
|
|
}
|