feat: Sprint 3 — Territory management (list, add, edit, delete, detail), GPS tagging, territory tab
This commit is contained in:
31
lib/territoryHelpers.ts
Normal file
31
lib/territoryHelpers.ts
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user