save array

This commit is contained in:
tamaina 2024-03-10 16:00:25 +00:00
parent 9bfa38e601
commit e2b574a97c

View File

@ -396,18 +396,16 @@ export class ApPersonService implements OnModuleInit {
}));
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.publicKey.id, person.publicKey],
]);
for (const key of keys.values()) {
await transactionalEntityManager.save(new MiUserPublickey({
await this.userPublickeysRepository.save(Array.from(publicKeys.values(), key => ({
keyId: key.id,
userId: user.id,
userId: user!.id,
keyPem: key.publicKeyPem,
}));
}
})));
}
});
} catch (e) {