@flowselections/floriday-klanten-module 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/components/klanten/ExternalCacheBanner.d.ts +6 -0
- package/dist-lib/components/klanten/ExternalCacheBanner.d.ts.map +1 -0
- package/dist-lib/components/klanten/ExternalCacheBanner.js +22 -0
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +111 -79
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +4264 -1024
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +4264 -1024
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +4264 -1024
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +4364 -1041
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +10 -0
- package/dist-lib/lib/accounting/floriday/sync.server.d.ts.map +1 -1
- package/dist-lib/lib/accounting/floriday/sync.server.js +5 -3
- package/dist-lib/lib/accounting.functions.d.ts +13842 -4122
- package/dist-lib/lib/accounting.functions.d.ts.map +1 -1
- package/dist-lib/lib/customers.functions.d.ts +29788 -14456
- package/dist-lib/lib/customers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customers.functions.js +8 -31
- package/dist-lib/lib/external-customers.functions.d.ts +22814 -0
- package/dist-lib/lib/external-customers.functions.d.ts.map +1 -0
- package/dist-lib/lib/external-customers.functions.js +131 -0
- package/package.json +2 -2
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
3
3
|
import { customerCreateSchema, customerUpdateSchema, listFiltersSchema, } from "./customer-schemas";
|
|
4
|
-
import { syncAllFloridayCustomers, syncFloridayNetwork } from "./floriday.server";
|
|
5
4
|
export const listCustomers = createServerFn({ method: "POST" })
|
|
6
5
|
.middleware([requireSupabaseAuth])
|
|
7
6
|
.inputValidator((input) => listFiltersSchema.parse(input))
|
|
8
7
|
.handler(async ({ data, context }) => {
|
|
9
8
|
const { supabase } = context;
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
q =
|
|
9
|
+
// Floriday-klanten worden niet meer naar `customers` gespiegeld — die
|
|
10
|
+
// worden direct uit floriday_customers_cache gelezen via
|
|
11
|
+
// listFloridayCustomers(). Deze functie levert dus alleen lokale klanten.
|
|
12
|
+
let q = supabase
|
|
13
|
+
.from("customers")
|
|
14
|
+
.select("*")
|
|
15
|
+
.eq("source", "local")
|
|
16
|
+
.order("company_name");
|
|
14
17
|
if (data.customer_class)
|
|
15
18
|
q = q.eq("customer_class", data.customer_class);
|
|
16
19
|
if (data.country)
|
|
@@ -19,8 +22,6 @@ export const listCustomers = createServerFn({ method: "POST" })
|
|
|
19
22
|
q = q.eq("is_active", true);
|
|
20
23
|
if (data.is_active === "inactive")
|
|
21
24
|
q = q.eq("is_active", false);
|
|
22
|
-
if (data.source !== "all")
|
|
23
|
-
q = q.eq("source", data.source);
|
|
24
25
|
if (data.search) {
|
|
25
26
|
const s = `%${data.search}%`;
|
|
26
27
|
q = q.or(`company_name.ilike.${s},contact_person.ilike.${s},email.ilike.${s}`);
|
|
@@ -188,18 +189,6 @@ export const deleteCustomer = createServerFn({ method: "POST" })
|
|
|
188
189
|
throw new Error(error.message);
|
|
189
190
|
return { ok: true };
|
|
190
191
|
});
|
|
191
|
-
export const syncFloridayCustomers = createServerFn({ method: "POST" })
|
|
192
|
-
.middleware([requireSupabaseAuth])
|
|
193
|
-
.handler(async () => {
|
|
194
|
-
const result = await syncAllFloridayCustomers();
|
|
195
|
-
return result;
|
|
196
|
-
});
|
|
197
|
-
export const syncFloridayNetworkFn = createServerFn({ method: "POST" })
|
|
198
|
-
.middleware([requireSupabaseAuth])
|
|
199
|
-
.handler(async () => {
|
|
200
|
-
const result = await syncFloridayNetwork();
|
|
201
|
-
return result;
|
|
202
|
-
});
|
|
203
192
|
export const listFloridayNetwork = createServerFn({ method: "POST" })
|
|
204
193
|
.middleware([requireSupabaseAuth])
|
|
205
194
|
.inputValidator((input) => ({
|
|
@@ -220,18 +209,6 @@ export const listFloridayNetwork = createServerFn({ method: "POST" })
|
|
|
220
209
|
throw new Error(error.message);
|
|
221
210
|
return { organizations: rows ?? [] };
|
|
222
211
|
});
|
|
223
|
-
export const listFloridayCache = createServerFn({ method: "POST" })
|
|
224
|
-
.middleware([requireSupabaseAuth])
|
|
225
|
-
.handler(async ({ context }) => {
|
|
226
|
-
const { data, error } = await context.supabase
|
|
227
|
-
.from("floriday_customers_cache")
|
|
228
|
-
.select("*")
|
|
229
|
-
.order("fetched_at", { ascending: false })
|
|
230
|
-
.limit(500);
|
|
231
|
-
if (error)
|
|
232
|
-
throw new Error(error.message);
|
|
233
|
-
return { rows: data ?? [] };
|
|
234
|
-
});
|
|
235
212
|
export const listCustomerClasses = createServerFn({ method: "POST" })
|
|
236
213
|
.middleware([requireSupabaseAuth])
|
|
237
214
|
.handler(async ({ context }) => {
|