costly/costly-api/src/group-events/api/group-events.controller.ts
Bastian Wagner 88f827d4b4 Stuff
2025-12-22 15:51:59 +01:00

30 lines
837 B
TypeScript

import { Body, Controller, Get, Param, Post, Req, Session } from '@nestjs/common';
import { GroupEventsService } from '../application/group-events.service';
import { IncomingGroupEventDto } from '../dto/group-event.dto';
@Controller('group-events')
export class GroupEventsController {
constructor(private readonly groupsEventsService: GroupEventsService) {}
@Post(':groupId/events/batch')
ingest(
@Param('groupId') groupId: string,
@Body() events: IncomingGroupEventDto[],
) {
return this.groupsEventsService.ingestEvents(groupId, events);
}
@Get()
getEvents(@Session() session: Record<string, any>) {
return this.groupsEventsService.getLastEvents({});
}
@Get(':groupdId')
getGroupEvents(@Param('groupId') groupId: string) {
return this.groupsEventsService.getLastEvents({groupId});
}
}