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.
This commit is contained in:
Matthew Raymer
2025-08-07 02:42:53 +00:00
parent 75e8b34e88
commit ed0f49656d

View File

@@ -900,30 +900,12 @@ export interface DatabaseExport {
* @returns DatabaseExport object in the standardized format * @returns DatabaseExport object in the standardized format
*/ */
export const contactsToExportJson = (contacts: Contact[]): DatabaseExport => { 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 { return {
data: { data: {
data: [ data: [
{ {
tableName: "contacts", tableName: "contacts",
rows, rows: contacts,
}, },
], ],
}, },