2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
import{a2 as i,a3 as o,a6 as n}from"./index-fccf7b13.js";const u=async r=>{const{data:t,error:e}=await o.from("users").insert(r).select().single();if(e)throw e;return t},l=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-5aeee7d3.js"),["assets/buildSupabaseQuery-5aeee7d3.js","assets/index-fccf7b13.js","assets/index-d933e911.css"]),e=await t(r,"users");try{const s=Array.isArray(e==null?void 0:e.rows)?e.rows[0]:e}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-5aeee7d3.js"),["assets/buildSupabaseQuery-5aeee7d3.js","assets/index-fccf7b13.js","assets/index-d933e911.css"]))},_=async r=>await n.get(`admin/customer/report/${r}`);export{l as a,f as b,g as c,y as d,_ as e,u as f,d as g,m as u};
|