Browse Source

Simplify contactsToExportJson function

Remove unnecessary contact object mapping in contactsToExportJson function.
The contacts array can be used directly since it already contains all required
fields in the correct format.
get-get-hash
Matthew Raymer 1 week ago
parent
commit
ed0f49656d
  1. 20
      src/libs/util.ts

20
src/libs/util.ts

@ -900,30 +900,12 @@ export interface DatabaseExport {
* @returns DatabaseExport object in the standardized format
*/
export const contactsToExportJson = (contacts: Contact[]): DatabaseExport => {
// Convert each contact to a plain object and ensure all fields are included
const rows = contacts.map((contact) => {
// Create a plain object without stringifying contactMethods
const exContact = {
did: contact.did,
iViewContent: contact.iViewContent,
name: contact.name,
nextPubKeyHashB64: contact.nextPubKeyHashB64,
notes: contact.notes,
profileImageUrl: contact.profileImageUrl,
publicKeyBase64: contact.publicKeyBase64,
seesMe: contact.seesMe,
registered: contact.registered,
contactMethods: contact.contactMethods || [],
};
return exContact;
});
return {
data: {
data: [
{
tableName: "contacts",
rows,
rows: contacts,
},
],
},

Loading…
Cancel
Save