-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
872f49b
commit fa76c38
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Body, Controller, Post, Req, UseGuards } from '@nestjs/common'; | ||
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; | ||
import { FirebaseAuthGuard } from 'src/firebase/firebase-auth.guard'; | ||
import { ControllerDecorator } from 'src/utils/controller.decorator'; | ||
import { EVENT_NAME } from './event-logger.interface'; | ||
import { EventLoggerService } from './event-logger.service'; | ||
|
||
@ApiTags('Event Logger') | ||
@ControllerDecorator() | ||
@Controller('/v1/event-logger') | ||
export class EventLoggerController { | ||
constructor(private readonly eventLoggerService: EventLoggerService) {} | ||
|
||
@Post() | ||
@ApiOperation({ | ||
description: 'Creates an event log', | ||
}) | ||
@ApiBearerAuth('access-token') | ||
@UseGuards(FirebaseAuthGuard) | ||
async complete(@Req() req: Request, @Body() event: EVENT_NAME) { | ||
const now = new Date(); | ||
return await this.eventLoggerService.createEventLog({ | ||
userId: req['userEntity'].id, | ||
event, | ||
date: now, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters