Criteria Objekt überarbeitet
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Body, Controller, Get, Inject, Param, Post, Query } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Inject, Param, Post, Query, Request, UseGuards } from '@nestjs/common';
|
||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||
import { Logger } from 'winston';
|
||||
import { FileService } from '../file/file.service.js';
|
||||
import { OptionalJwtAuthGuard } from '../jwt-auth/optional-jwt-auth.guard.js';
|
||||
import { User } from '../models/db.model';
|
||||
import { Subscription } from '../models/main.model.js';
|
||||
import { JwtUser, Subscription } from '../models/main.model.js';
|
||||
import { UserService } from './user.service.js';
|
||||
|
||||
@Controller('user')
|
||||
@@ -13,14 +14,15 @@ export class UserController {
|
||||
private fileService: FileService,
|
||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||
) {}
|
||||
|
||||
@UseGuards(OptionalJwtAuthGuard)
|
||||
@Get()
|
||||
findByMail(@Query('mail') mail: string): any {
|
||||
findByMail(@Request() req, @Query('mail') mail: string): any {
|
||||
this.logger.info(`Searching for user with EMail: ${mail}`);
|
||||
const user = this.userService.getUserByMail(mail);
|
||||
const user = this.userService.getUserByMail(mail, req.user as JwtUser);
|
||||
this.logger.info(`Found user: ${JSON.stringify(user)}`);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findById(@Param('id') id: string): any {
|
||||
this.logger.info(`Searching for user with ID: ${id}`);
|
||||
|
||||
Reference in New Issue
Block a user