save array
This commit is contained in:
parent
9bfa38e601
commit
e2b574a97c
|
@ -396,18 +396,16 @@ export class ApPersonService implements OnModuleInit {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (person.publicKey) {
|
if (person.publicKey) {
|
||||||
const keys = new Map<string, IKey>([
|
const publicKeys = new Map<string, IKey>([
|
||||||
...(person.additionalPublicKeys ? person.additionalPublicKeys.map(key => [key.id, key] as const) : []),
|
...(person.additionalPublicKeys ? person.additionalPublicKeys.map(key => [key.id, key] as const) : []),
|
||||||
[person.publicKey.id, person.publicKey],
|
[person.publicKey.id, person.publicKey],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for (const key of keys.values()) {
|
await this.userPublickeysRepository.save(Array.from(publicKeys.values(), key => ({
|
||||||
await transactionalEntityManager.save(new MiUserPublickey({
|
|
||||||
keyId: key.id,
|
keyId: key.id,
|
||||||
userId: user.id,
|
userId: user!.id,
|
||||||
keyPem: key.publicKeyPem,
|
keyPem: key.publicKeyPem,
|
||||||
}));
|
})));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue