테스트 서버에 올리기 위한 준비

ID 중복 방지 - UUID v4 사용
This commit is contained in:
2026-08-20 17:09:43 +09:00
parent 2ed3c72b77
commit 3c458de80e
7 changed files with 336 additions and 76 deletions
+15
View File
@@ -83,6 +83,21 @@ export async function insertPole(pole) {
if (error) throw error;
}
export async function findDuplicatePole(lat, lng, timestamp) {
const tolerance = 0.0001;
const { data, error } = await supabase
.from('poles')
.select('id')
.gte('lat', lat - tolerance)
.lte('lat', lat + tolerance)
.gte('lng', lng - tolerance)
.lte('lng', lng + tolerance)
.eq('timestamp', timestamp)
.limit(1);
if (error) throw error;
return data?.length > 0;
}
export async function getPole(id) {
const { data, error } = await supabase
.from('poles')