feat: Sprint 1 — Onboarding screen, user persistence, Contact management (list, add, edit, delete, detail, search, filter)
This commit is contained in:
26
lib/contactHelpers.ts
Normal file
26
lib/contactHelpers.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Contact } from '@/store/useContactStore';
|
||||
import * as Crypto from 'expo-crypto';
|
||||
|
||||
export function dbToContact(row: any): Contact {
|
||||
return {
|
||||
id: row.id,
|
||||
ownerId: row.owner_id,
|
||||
fullName: row.full_name,
|
||||
address: row.address,
|
||||
householdCount: row.household_count ?? 1,
|
||||
gender: row.gender,
|
||||
category: row.category,
|
||||
status: row.status,
|
||||
tags: JSON.parse(row.tags ?? '[]'),
|
||||
notes: row.notes,
|
||||
territoryCode: row.territory_code,
|
||||
latitude: row.latitude,
|
||||
longitude: row.longitude,
|
||||
createdAt: row.created_at,
|
||||
updatedAt: row.updated_at,
|
||||
};
|
||||
}
|
||||
|
||||
export function newContactId(): string {
|
||||
return Crypto.randomUUID();
|
||||
}
|
||||
Reference in New Issue
Block a user