revision
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { IsEmail, IsNotEmpty, IsString, MinLength } from "class-validator";
|
||||
|
||||
export class CreateUserDto{
|
||||
export class UserDto{
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { User } from './entities/user.entity';
|
||||
import { UserDto } from './dto/userDto.dto';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
@@ -19,11 +20,23 @@ export class UsersService {
|
||||
return this.users.save(newUser);
|
||||
}
|
||||
|
||||
async updateTokenAndDates(id: number, jwt: string, lastlog: Date, expirationjwt: Date): Promise<void> {
|
||||
await this.users.update(id, { jwt, lastlog, expirationjwt });
|
||||
async update(userId: number, updateUserDto: UserDto): Promise<User> {
|
||||
await this.users.update(userId, updateUserDto);
|
||||
return this.users.findOne({where:{userId}});
|
||||
}
|
||||
|
||||
async remove(userId: number): Promise<void> {
|
||||
await this.users.delete(userId);
|
||||
}
|
||||
|
||||
async updateTokenAndDates(id: number, token: string, lastLogin: Date, jwtExpiry: Date): Promise<void> {
|
||||
await this.users.update(id, {
|
||||
jwt:token,
|
||||
lastlog:lastLogin,
|
||||
expirationjwt:jwtExpiry,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user