refactor: merge AuthTokenDTOs into one file

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-03-04 13:51:50 +01:00
parent de952fe3b2
commit 5eab4f42d6
5 changed files with 11 additions and 18 deletions

View file

@ -15,8 +15,10 @@ import {
} from '@nestjs/common'; } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AuthTokenWithSecretDto } from '../../../auth/auth-token-with-secret.dto'; import {
import { AuthTokenDto } from '../../../auth/auth-token.dto'; AuthTokenDto,
AuthTokenWithSecretDto,
} from '../../../auth/auth-token.dto';
import { AuthService } from '../../../auth/auth.service'; import { AuthService } from '../../../auth/auth.service';
import { SessionGuard } from '../../../identity/session.guard'; import { SessionGuard } from '../../../identity/session.guard';
import { ConsoleLoggerService } from '../../../logger/console-logger.service'; import { ConsoleLoggerService } from '../../../logger/console-logger.service';

View file

@ -1,13 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { IsString } from 'class-validator';
import { AuthTokenDto } from './auth-token.dto';
export class AuthTokenWithSecretDto extends AuthTokenDto {
@IsString()
secret: string;
}

View file

@ -28,3 +28,8 @@ export class AuthTokenDto extends BaseDto {
@IsOptional() @IsOptional()
lastUsedAt: Date | null; lastUsedAt: Date | null;
} }
export class AuthTokenWithSecretDto extends AuthTokenDto {
@IsString()
secret: string;
}

View file

@ -19,8 +19,7 @@ import { User } from '../users/user.entity';
import { UsersService } from '../users/users.service'; import { UsersService } from '../users/users.service';
import { bufferToBase64Url } from '../utils/password'; import { bufferToBase64Url } from '../utils/password';
import { TimestampMillis } from '../utils/timestamp'; import { TimestampMillis } from '../utils/timestamp';
import { AuthTokenWithSecretDto } from './auth-token-with-secret.dto'; import { AuthTokenDto, AuthTokenWithSecretDto } from './auth-token.dto';
import { AuthTokenDto } from './auth-token.dto';
import { AuthToken } from './auth-token.entity'; import { AuthToken } from './auth-token.entity';
@Injectable() @Injectable()

View file

@ -12,7 +12,7 @@ import { Connection, createConnection } from 'typeorm';
import { PrivateApiModule } from '../src/api/private/private-api.module'; import { PrivateApiModule } from '../src/api/private/private-api.module';
import { PublicApiModule } from '../src/api/public/public-api.module'; import { PublicApiModule } from '../src/api/public/public-api.module';
import { AuthTokenWithSecretDto } from '../src/auth/auth-token-with-secret.dto'; import { AuthTokenWithSecretDto } from '../src/auth/auth-token.dto';
import { AuthModule } from '../src/auth/auth.module'; import { AuthModule } from '../src/auth/auth.module';
import { AuthService } from '../src/auth/auth.service'; import { AuthService } from '../src/auth/auth.service';
import { MockAuthGuard } from '../src/auth/mock-auth.guard'; import { MockAuthGuard } from '../src/auth/mock-auth.guard';