feat: Extend collection of usage metrics during license renewal (no-changelog) (#8369)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ebf2b0d55c
commit
d597c2ab29
@@ -18,6 +18,31 @@ async function encryptCredentialData(credential: CredentialsEntity) {
|
||||
return coreCredential.getDataToSave() as ICredentialsDb;
|
||||
}
|
||||
|
||||
const emptyAttributes = {
|
||||
name: 'test',
|
||||
type: 'test',
|
||||
data: '',
|
||||
nodesAccess: [],
|
||||
};
|
||||
|
||||
export async function createManyCredentials(
|
||||
amount: number,
|
||||
attributes: Partial<CredentialsEntity> = emptyAttributes,
|
||||
) {
|
||||
return await Promise.all(
|
||||
Array(amount)
|
||||
.fill(0)
|
||||
.map(async () => await createCredentials(attributes)),
|
||||
);
|
||||
}
|
||||
|
||||
export async function createCredentials(attributes: Partial<CredentialsEntity> = emptyAttributes) {
|
||||
const credentialsRepository = Container.get(CredentialsRepository);
|
||||
const entity = credentialsRepository.create(attributes);
|
||||
|
||||
return await credentialsRepository.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a credential to the test DB, sharing it with a user.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user