feat(backend): Kalender (Modul 25)
CalendarModule mit GET /calendar?from=&to=&apiaryId= aggregiert Durchsichten, Aufgaben, Behandlungen, Fuetterungen, Ernten und Koeniginnen-Zuweisungen zu einem einheitlichen Ereignisfeed. Rein lesende Aggregation, kein neues Datenmodell.
This commit is contained in:
1 parent
8b42a86115
commit
fef1177a2c
7 files changed
+343
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { BadRequestException, Controller, Get, Query } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { CalendarService } from './calendar.service';
|
||||
|
||||
@ApiTags('calendar')
|
||||
@ApiBearerAuth()
|
||||
@Controller('calendar')
|
||||
export class CalendarController {
|
||||
constructor(private readonly calendarService: CalendarService) {}
|
||||
|
||||
@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,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user