@nestjs/common#Session TypeScript Examples

The following examples show how to use @nestjs/common#Session. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: submissions.controller.ts    From coronatest with GNU Affero General Public License v3.0 5 votes vote down vote up
@Post()
    async createSubmission(@Body() createSubmissionDto: CreateSubmissionDto, @Session() session, @Req() req): Promise<any> {
        const sessionID = req.sessionID;
        const ipAddress = req.headers['x-clientip'] || req.connection.remoteAddress;

        if (!createSubmissionDto.close_contact) {
            if (createSubmissionDto.exposure || createSubmissionDto.high_risk_country) createSubmissionDto.close_contact = 'yes';
            else createSubmissionDto.close_contact = 'no';
        }

        return await this.submissionsService.createSubmission(createSubmissionDto, sessionID, ipAddress);
    }