feat: Sprint 3 — Territory management (list, add, edit, delete, detail), GPS tagging, territory tab

This commit is contained in:
root
2026-02-18 16:41:47 +08:00
parent 419865e8cf
commit 9bd02b1a17
9 changed files with 425 additions and 8 deletions

31
lib/territoryHelpers.ts Normal file
View File

@@ -0,0 +1,31 @@
import * as Crypto from 'expo-crypto';
export interface Territory {
id: string;
territoryCode: string;
municipality?: string;
barangay?: string;
area?: string;
block?: string;
assignedTo?: string;
createdAt: number;
updatedAt: number;
}
export function dbToTerritory(row: any): Territory {
return {
id: row.id,
territoryCode: row.territory_code,
municipality: row.municipality,
barangay: row.barangay,
area: row.area,
block: row.block,
assignedTo: row.assigned_to,
createdAt: row.created_at,
updatedAt: row.updated_at,
};
}
export function newTerritoryId(): string {
return Crypto.randomUUID();
}