Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 00fa17fa52 |
@@ -142,7 +142,7 @@ impl SupabaseClient {
|
|||||||
"frango": estado.get("frango").and_then(|v| v.as_i64()).unwrap_or(0),
|
"frango": estado.get("frango").and_then(|v| v.as_i64()).unwrap_or(0),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Upsert via POST com Prefer: resolution=merge-duplicates
|
// Primeiro tenta INSERT (upsert via Prefer)
|
||||||
let resp = self
|
let resp = self
|
||||||
.http
|
.http
|
||||||
.post(&format!("{}/rest/v1/fechamentos_web", self.base_url))
|
.post(&format!("{}/rest/v1/fechamentos_web", self.base_url))
|
||||||
@@ -152,7 +152,7 @@ impl SupabaseClient {
|
|||||||
.send()?;
|
.send()?;
|
||||||
|
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
if status.is_success() {
|
if status.is_success() || status.as_u16() == 409 {
|
||||||
Ok(serde_json::json!({ "ok": true, "id_fechamento": id_fechamento }))
|
Ok(serde_json::json!({ "ok": true, "id_fechamento": id_fechamento }))
|
||||||
} else {
|
} else {
|
||||||
let body = resp.text().unwrap_or_default();
|
let body = resp.text().unwrap_or_default();
|
||||||
|
|||||||
Reference in New Issue
Block a user