forked from trent_larson/crowd-funder-for-time-pwa
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:
@@ -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,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user