apps/api: move jwt types to src/types

This commit is contained in:
vchikalkin 2024-05-14 16:12:22 +03:00
parent 20b1aeda5c
commit becce3218d
4 changed files with 6 additions and 4 deletions

View File

@ -8,8 +8,8 @@ import * as bcrypt from 'bcrypt';
import { Model } from 'mongoose';
import { omit } from 'radash';
import type { Credentials } from 'src/dto/credentials';
import type { DecodedToken, TokenPayload } from 'src/ldap/types/jwt';
import { Account } from 'src/schemas/account.schema';
import type { DecodedToken, TokenPayload } from 'src/types/jwt';
import { generatePassword } from 'src/utils/password';
@Injectable()

View File

@ -1,4 +1,4 @@
import type { DecodedToken } from './ldap/types/jwt';
import type { DecodedToken } from './types/jwt';
import { Injectable } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { omit } from 'radash';

View File

@ -1,4 +1,4 @@
import type { DecodedToken, TokenPayload } from './types/jwt';
import type { DecodedToken, TokenPayload } from '../types/jwt';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { Inject, Injectable, UnauthorizedException } from '@nestjs/common';
import type { JwtSignOptions } from '@nestjs/jwt';

View File

@ -1,10 +1,12 @@
import type { JwtSignOptions } from '@nestjs/jwt';
export type TokenPayload = {
[key: string]: unknown;
username: string;
};
export type DecodedToken = {
aud?: string;
aud?: JwtSignOptions['audience'];
exp: number;
iat: number;
} & TokenPayload;