First part of the action comment refactoring

ref #39
Why did i volunteer for this? It's just a glorified sleeping aid 😴
This commit is contained in:
2020-12-21 16:08:10 +01:00
parent d20d738218
commit 1d0d79f3da
9 changed files with 123 additions and 32 deletions

View File

@@ -7,11 +7,23 @@ import { JwtCreator } from "../../jwtcreator";
import { User } from '../entities/User';
import { Auth } from '../responses/ResponseAuth';
/**
* This class is used to create refreshed auth credentials.
* To be a little bit more exact: Is takes in a refresh token and creates a new access and refresh token for it's user.
* It of course checks for user existance, jwt validity and so on.
*/
export class RefreshAuth {
/**
* A stringyfied jwt refresh token.
* Will get checked for validity.
*/
@IsString()
@IsOptional()
token?: string;
/**
* Creates a new auth object based on this.
*/
public async toAuth(): Promise<Auth> {
let newAuth: Auth = new Auth();
if (!this.token || this.token === undefined) {