mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
ci(core): Reduce memory usage in tests (part-2) (no-changelog) (#7671)
This also gets rid of `Db.collection`, which was another source of circular dependencies.
This commit is contained in:
committed by
GitHub
parent
37dd658dc5
commit
000e76e3b4
@@ -1,7 +1,6 @@
|
||||
import jwt from 'jsonwebtoken';
|
||||
import type { Response } from 'express';
|
||||
import { createHash } from 'crypto';
|
||||
import * as Db from '@/Db';
|
||||
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import type { JwtPayload, JwtToken } from '@/Interfaces';
|
||||
import type { User } from '@db/entities/User';
|
||||
@@ -9,6 +8,7 @@ import config from '@/config';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { License } from '@/License';
|
||||
import { Container } from 'typedi';
|
||||
import { UserRepository } from '@db/repositories/user.repository';
|
||||
|
||||
export function issueJWT(user: User): JwtToken {
|
||||
const { id, email, password } = user;
|
||||
@@ -50,7 +50,7 @@ export const createPasswordSha = (user: User) =>
|
||||
.digest('hex');
|
||||
|
||||
export async function resolveJwtContent(jwtPayload: JwtPayload): Promise<User> {
|
||||
const user = await Db.collections.User.findOne({
|
||||
const user = await Container.get(UserRepository).findOne({
|
||||
where: { id: jwtPayload.id },
|
||||
relations: ['globalRole'],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user