mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Extract all Auth-related User columns into a separate entity (#9557)
Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
This commit is contained in:
committed by
GitHub
parent
08902bf941
commit
5887ed6498
@@ -9,8 +9,6 @@ describe('User Entity', () => {
|
||||
lastName: 'Joe',
|
||||
password: '123456789',
|
||||
apiKey: '123',
|
||||
mfaSecret: '123',
|
||||
mfaRecoveryCodes: ['123'],
|
||||
});
|
||||
expect(JSON.stringify(user)).toEqual(
|
||||
'{"email":"test@example.com","firstName":"Don","lastName":"Joe"}',
|
||||
|
||||
@@ -30,15 +30,13 @@ describe('UserService', () => {
|
||||
});
|
||||
|
||||
type MaybeSensitiveProperties = Partial<
|
||||
Pick<User, 'password' | 'mfaSecret' | 'mfaRecoveryCodes' | 'updatedAt' | 'authIdentities'>
|
||||
Pick<User, 'password' | 'updatedAt' | 'authIdentities'>
|
||||
>;
|
||||
|
||||
// to prevent typechecking from blocking assertions
|
||||
const publicUser: MaybeSensitiveProperties = await userService.toPublic(mockUser);
|
||||
|
||||
expect(publicUser.password).toBeUndefined();
|
||||
expect(publicUser.mfaSecret).toBeUndefined();
|
||||
expect(publicUser.mfaRecoveryCodes).toBeUndefined();
|
||||
expect(publicUser.updatedAt).toBeUndefined();
|
||||
expect(publicUser.authIdentities).toBeUndefined();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user