2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{a2 as i,a3 as o,a6 as n}from"./index-be457ac4.js";const l=async r=>{const{data:t,error:e}=await o.from("users").insert(r).select().single();if(e)throw e;return t},u=async r=>{const{data:t,error:e}=await o.from("users").select("*").eq("id",r).single();if(e)throw e;return t},m=async(r,t)=>{const{data:e,error:s}=await o.from("users").update(t).eq("id",r).select().single();if(s)throw s;return e},d=async r=>{const{TableEngineRequest:t}=await i(()=>import("./buildSupabaseQuery-874444c8.js"),["assets/buildSupabaseQuery-874444c8.js","assets/index-be457ac4.js","assets/index-f708971c.css"]),e=await t(r,"users");try{const s=Array.isArray(e==null?void 0:e.rows)?e.rows[0]:e;console.log("[getCustomerTable] sample row fields:",s)}catch(s){console.log("[getCustomerTable] log error:",s)}try{if(Array.isArray(e==null?void 0:e.rows)){const s=e.rows.map(a=>({id:a.id??null,fname:a.first_name,lname:a.last_name,mobile:a.phone,...a}));return{...e,rows:s}}}catch(s){console.log("[getCustomerTable] normalize error:",s)}return e},g=async r=>{const{data:t,error:e}=await o.from("users").update({is_active:!0}).eq("id",r).select().single();if(e)throw e;return t},f=async r=>{const{data:t,error:e}=await o.from("users").select("*").eq("id",r).eq("is_archived",!0).single();if(e)throw e;return t},y=async r=>{({...r,filters:[...r.filters||[]]},await i(()=>import("./buildSupabaseQuery-874444c8.js"),["assets/buildSupabaseQuery-874444c8.js","assets/index-be457ac4.js","assets/index-f708971c.css"]))},_=async r=>await n.get(`admin/customer/report/${r}`);export{u as a,f as b,g as c,y as d,_ as e,l as f,d as g,m as u};
|