Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Company id to string (#136)
crudmachine5210636a324f
diff --git a/apps/carbon/app/components/Form/Service.tsx b/apps/carbon/app/components/Form/Service.tsxindex e98e95f3ec..9c251238a8 100644--- a/apps/carbon/app/components/Form/Service.tsx+++ b/apps/carbon/app/components/Form/Service.tsx@@ -22,7 +22,7 @@ Service.displayName = "Service";export default Service;-export const useServices = (serviceType: ServiceType) => {+export const useServices = (serviceType?: ServiceType) => {const servicesFetcher =useFetcher<Awaited<ReturnType<typeof getServicesList>>>();diff --git a/apps/carbon/app/hooks/usePermissions.tsx b/apps/carbon/app/hooks/usePermissions.tsxindex 0914f32fe7..48697deebc 100644--- a/apps/carbon/app/hooks/usePermissions.tsx+++ b/apps/carbon/app/hooks/usePermissions.tsx@@ -25,7 +25,7 @@ export function usePermissions() {const can = useCallback((action: "view" | "create" | "update" | "delete", feature: string) => {return (- data?.permissions[feature]?.[action].includes(0) ||+ data?.permissions[feature]?.[action].includes("0") ||data?.permissions[feature]?.[action].includes(companyId));},diff --git a/apps/carbon/app/hooks/useUser.tsx b/apps/carbon/app/hooks/useUser.tsxindex 30cdc667ec..7310c29ecf 100644--- a/apps/carbon/app/hooks/useUser.tsx+++ b/apps/carbon/app/hooks/useUser.tsx@@ -10,7 +10,7 @@ type PersonalData = {};type Company = {- id: number;+ id: string;name: string;logo: string | null;};@@ -59,7 +59,7 @@ export function useUser(): User {function isCompany(value: any): value is Company {return (- typeof value.id === "number" &&+ typeof value.id === "string" &&typeof value.name === "string" &&(typeof value.logo === "string" || value.logo === null));diff --git a/apps/carbon/app/jobs.server/send-email-resend.server.ts b/apps/carbon/app/jobs.server/send-email-resend.server.tsindex 1ab1d6560b..a5398d821d 100644--- a/apps/carbon/app/jobs.server/send-email-resend.server.ts+++ b/apps/carbon/app/jobs.server/send-email-resend.server.ts@@ -29,7 +29,7 @@ const job = triggerClient.defineJob({}).array().optional(),- companyId: z.number(),+ companyId: z.string(),}),}),run: async (payload, io, ctx) => {diff --git a/apps/carbon/app/jobs.server/update-permissions.server.ts b/apps/carbon/app/jobs.server/update-permissions.server.tsindex 8b311d586c..c76bd1c288 100644--- a/apps/carbon/app/jobs.server/update-permissions.server.ts+++ b/apps/carbon/app/jobs.server/update-permissions.server.ts@@ -18,7 +18,7 @@ export const permissionsUpdateSchema = z.object({delete: z.boolean(),})),- companyId: z.number(),+ companyId: z.string(),});const job = triggerClient.defineJob({diff --git a/apps/carbon/app/modules/account/account.service.ts b/apps/carbon/app/modules/account/account.service.tsindex 4df002ca60..6885af7e6c 100644--- a/apps/carbon/app/modules/account/account.service.ts+++ b/apps/carbon/app/modules/account/account.service.ts@@ -25,7 +25,7 @@ export async function getAccount(client: SupabaseClient<Database>, id: string) {export async function getAttributes(client: SupabaseClient<Database>,userId: string,- companyId: number,+ companyId: string,isPublic: boolean) {return client@@ -50,7 +50,7 @@ export async function getAttributes(export async function getPrivateAttributes(client: SupabaseClient<Database>,userId: string,- companyId: number+ companyId: string) {return getAttributes(client, userId, companyId, false);}@@ -58,7 +58,7 @@ export async function getPrivateAttributes(export async function getPublicAttributes(client: SupabaseClient<Database>,userId: string,- companyId: number+ companyId: string) {return getAttributes(client, userId, companyId, true);}diff --git a/apps/carbon/app/modules/accounting/accounting.service.ts b/apps/carbon/app/modules/accounting/accounting.service.tsindex 4d3b2e4aea..adab090a63 100644--- a/apps/carbon/app/modules/accounting/accounting.service.ts+++ b/apps/carbon/app/modules/accounting/accounting.service.ts@@ -110,7 +110,7 @@ export async function getAccount(export async function getAccounts(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -135,7 +135,7 @@ export async function getAccounts(export async function getAccountsList(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: {type?: string | null;incomeBalance?: string | null;@@ -166,7 +166,7 @@ export async function getAccountsList(export async function getAccountCategories(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -192,7 +192,7 @@ export async function getAccountCategories(export async function getAccountCategoriesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("accountCategory")@@ -214,7 +214,7 @@ export async function getAccountCategory(export async function getAccountSubcategories(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -303,7 +303,7 @@ function getAccountTotal(export async function getBaseCurrency(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("currency")@@ -315,7 +315,7 @@ export async function getBaseCurrency(export async function getChartOfAccounts(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: Omit<GenericQueryFilters, "limit" | "offset"> & {name: string | null;incomeBalance: string | null;@@ -398,7 +398,7 @@ export async function getCurrency(export async function getCurrencies(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -423,7 +423,7 @@ export async function getCurrencies(export async function getCurrenciesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("currency")@@ -434,7 +434,7 @@ export async function getCurrenciesList(export async function getCurrentAccountingPeriod(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,date: string) {return client@@ -448,7 +448,7 @@ export async function getCurrentAccountingPeriod(export async function getDefaultAccounts(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("accountDefault")@@ -459,7 +459,7 @@ export async function getDefaultAccounts(export async function getFiscalYearSettings(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("fiscalYearSettings")@@ -494,7 +494,7 @@ export async function getInventoryPostingGroup(export async function getInventoryPostingGroups(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters) {let query = client@@ -523,7 +523,7 @@ export async function getPaymentTerm(export async function getPaymentTerms(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -548,7 +548,7 @@ export async function getPaymentTerms(export async function getPaymentTermsList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("paymentTerm")@@ -584,7 +584,7 @@ export async function getPurchasingPostingGroup(export async function getPurchasingPostingGroups(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters) {let query = client@@ -626,7 +626,7 @@ export async function getPurchasingSalesGroup(export async function getSalesPostingGroups(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters) {let query = client@@ -645,7 +645,7 @@ export async function getSalesPostingGroups(export async function insertPartEntries(client: SupabaseClient<Database>,partEntries: (z.infer<typeof partLedgerValidator> & {- companyId: number;+ companyId: string;})[]) {return client.from("partLedger").insert(partEntries);@@ -654,7 +654,7 @@ export async function insertPartEntries(export async function insertPartLedger(client: SupabaseClient<Database>,partEntry: z.infer<typeof partLedgerValidator> & {- companyId: number;+ companyId: string;}) {return client.from("partLedger").insert([partEntry]);@@ -663,7 +663,7 @@ export async function insertPartLedger(export async function updateDefaultAccounts(client: SupabaseClient<Database>,defaultAccounts: z.infer<typeof defaultAcountValidator> & {- companyId: number;+ companyId: string;updatedBy: string;}) {@@ -676,7 +676,7 @@ export async function updateDefaultAccounts(export async function updateFiscalYearSettings(client: SupabaseClient<Database>,fiscalYearSettings: z.infer<typeof fiscalYearSettingsValidator> & {- companyId: number;+ companyId: string;updatedBy: string;}) {@@ -690,7 +690,7 @@ export async function upsertAccount(client: SupabaseClient<Database>,account:| (Omit<z.infer<typeof accountValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -715,7 +715,7 @@ export async function upsertAccountCategory(client: SupabaseClient<Database>,accountCategory:| (Omit<z.infer<typeof accountCategoryValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -744,7 +744,7 @@ export async function upsertAccountSubcategory(client: SupabaseClient<Database>,accountSubcategory:| (Omit<z.infer<typeof accountSubcategoryValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -773,13 +773,13 @@ export async function upsertCurrency(client: SupabaseClient<Database>,currency:| (Omit<z.infer<typeof currencyValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})| (Omit<z.infer<typeof currencyValidator>, "id"> & {id: string;- companyId: number;+ companyId: string;updatedBy: string;customFields?: Json;})@@ -807,7 +807,7 @@ export async function upsertPaymentTerm(client: SupabaseClient<Database>,paymentTerm:| (Omit<z.infer<typeof paymentTermValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/documents/documents.service.ts b/apps/carbon/app/modules/documents/documents.service.tsindex e6ba722e5d..5ea8d4fcd8 100644--- a/apps/carbon/app/modules/documents/documents.service.ts+++ b/apps/carbon/app/modules/documents/documents.service.ts@@ -59,7 +59,7 @@ export async function getDocument(export async function getDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;favorite?: boolean;@@ -194,7 +194,7 @@ export async function upsertDocument(| (Omit<z.infer<typeof documentValidator>, "id"> & {path: string;size: number;- companyId: number;+ companyId: string;createdBy: string;} & SourceDocumentData)| (Omit<z.infer<typeof documentValidator>, "id"> & {diff --git a/apps/carbon/app/modules/inventory/inventory.service.ts b/apps/carbon/app/modules/inventory/inventory.service.tsindex d19ba8805e..8597d76cae 100644--- a/apps/carbon/app/modules/inventory/inventory.service.ts+++ b/apps/carbon/app/modules/inventory/inventory.service.ts@@ -29,7 +29,7 @@ export async function deleteShippingMethod(export async function getReceipts(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -81,7 +81,7 @@ export async function getShippingMethod(export async function getShippingMethods(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -108,7 +108,7 @@ export async function getShippingMethods(export async function getShippingMethodsList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("shippingMethod")@@ -120,7 +120,7 @@ export async function getShippingMethodsList(export async function getShippingTermsList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("shippingTerm")@@ -135,7 +135,7 @@ export async function upsertReceipt(receipt:| (Omit<z.infer<typeof receiptValidator>, "id" | "receiptId"> & {receiptId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -164,7 +164,7 @@ export async function upsertShippingMethod(client: SupabaseClient<Database>,shippingMethod:| (Omit<z.infer<typeof shippingMethodValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/invoicing/invoicing.server.ts b/apps/carbon/app/modules/invoicing/invoicing.server.tsindex ceebefdb6a..7a941cd2d4 100644--- a/apps/carbon/app/modules/invoicing/invoicing.server.ts+++ b/apps/carbon/app/modules/invoicing/invoicing.server.ts@@ -2,7 +2,7 @@ import { getSupabaseServiceRole } from "~/lib/supabase";export async function createPurchaseInvoiceFromPurchaseOrder(purchaseOrderId: string,- companyId: number,+ companyId: string,userId: string) {const client = getSupabaseServiceRole();diff --git a/apps/carbon/app/modules/invoicing/invoicing.service.ts b/apps/carbon/app/modules/invoicing/invoicing.service.tsindex 9f7b2dc700..037560a3e7 100644--- a/apps/carbon/app/modules/invoicing/invoicing.service.ts+++ b/apps/carbon/app/modules/invoicing/invoicing.service.ts@@ -44,7 +44,7 @@ export async function getPurchaseInvoice(export async function getPurchaseInvoices(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;supplierId: string | null;@@ -96,7 +96,7 @@ export async function upsertPurchaseInvoice(purchaseInvoice:| (Omit<z.infer<typeof purchaseInvoiceValidator>, "id" | "invoiceId"> & {invoiceId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -146,7 +146,7 @@ export async function upsertPurchaseInvoiceLine(client: SupabaseClient<Database>,purchaseInvoiceLine:| (Omit<z.infer<typeof purchaseInvoiceLineValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/parts/parts.service.ts b/apps/carbon/app/modules/parts/parts.service.tsindex 0488827e73..112903142d 100644--- a/apps/carbon/app/modules/parts/parts.service.ts+++ b/apps/carbon/app/modules/parts/parts.service.ts@@ -38,7 +38,7 @@ export async function deleteUnitOfMeasure(export async function getPartCost(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("partCost")@@ -57,7 +57,7 @@ export async function getPartGroup(export async function getPartGroups(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -82,7 +82,7 @@ export async function getPartGroups(export async function getPartGroupsList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("partGroup")@@ -94,7 +94,7 @@ export async function getPartGroupsList(export async function getPartInventory(client: SupabaseClient<Database>,partId: string,- companyId: number,+ companyId: string,locationId: string) {return client@@ -109,7 +109,7 @@ export async function getPartInventory(export async function getPartManufacturing(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("partReplenishment")@@ -122,7 +122,7 @@ export async function getPartManufacturing(export async function getPartPlanning(client: SupabaseClient<Database>,partId: string,- companyId: number,+ companyId: string,locationId: string) {return client@@ -137,7 +137,7 @@ export async function getPartPlanning(export async function getPartReplenishment(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("partReplenishment")@@ -149,7 +149,7 @@ export async function getPartReplenishment(export async function getParts(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;supplierId: string | null;@@ -180,7 +180,7 @@ export async function getParts(export async function getPartsList(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,replenishmentSystem: PartReplenishmentSystem | null) {let query = client@@ -202,7 +202,7 @@ export async function getPartsList(export async function getPartQuantities(client: SupabaseClient<Database>,partId: string,- companyId: number,+ companyId: string,locationId: string) {return client@@ -217,7 +217,7 @@ export async function getPartQuantities(export async function getPart(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("part")@@ -230,7 +230,7 @@ export async function getPart(export async function getPartSuppliers(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("partSupplier")@@ -251,7 +251,7 @@ export async function getPartSuppliers(export async function getPartUnitSalePrice(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("partUnitSalePrice")@@ -263,7 +263,7 @@ export async function getPartUnitSalePrice(export async function getServices(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;type: string | null;@@ -305,7 +305,7 @@ export async function getServices(export async function getService(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("services")@@ -317,7 +317,7 @@ export async function getService(export async function getServicesList(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,type: ServiceType | null) {let query = client@@ -338,7 +338,7 @@ export async function getServicesList(export async function getServiceSuppliers(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("serviceSupplier")@@ -363,7 +363,7 @@ export async function getShelvesList(export async function getUnitOfMeasure(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("unitOfMeasure")@@ -375,7 +375,7 @@ export async function getUnitOfMeasure(export async function getUnitOfMeasures(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & { search: string | null }) {let query = client@@ -397,7 +397,7 @@ export async function getUnitOfMeasures(export async function getUnitOfMeasuresList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("unitOfMeasure")@@ -411,7 +411,7 @@ export async function insertShelf(shelfId: string,locationId: string,userId: string,- companyId: number+ companyId: string) {const shelfLookup = await client.from("shelf")@@ -445,7 +445,7 @@ export async function upsertPart(client: SupabaseClient<Database>,part:| (z.infer<typeof partValidator> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -483,7 +483,7 @@ export async function upsertPartInventory(client: SupabaseClient<Database>,partInventory:| (z.infer<typeof partInventoryValidator> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -520,7 +520,7 @@ export async function upsertPartPlanning(client: SupabaseClient<Database>,partPlanning:| {- companyId: number;+ companyId: string;partId: string;locationId: string;createdBy: string;@@ -556,7 +556,7 @@ export async function upsertPartGroup(client: SupabaseClient<Database>,partGroup:| (Omit<z.infer<typeof partGroupValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -584,7 +584,7 @@ export async function upsertPartSupplier(client: SupabaseClient<Database>,partSupplier:| (Omit<z.infer<typeof partSupplierValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -626,7 +626,7 @@ export async function upsertService(client: SupabaseClient<Database>,service:| (z.infer<typeof serviceValidator> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -652,7 +652,7 @@ export async function upsertServiceSupplier(client: SupabaseClient<Database>,serviceSupplier:| (Omit<z.infer<typeof serviceSupplierValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -681,7 +681,7 @@ export async function upsertUnitOfMeasure(client: SupabaseClient<Database>,unitOfMeasure:| (Omit<z.infer<typeof unitOfMeasureValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/purchasing/purchasing.service.ts b/apps/carbon/app/modules/purchasing/purchasing.service.tsindex dd5f562ca8..8ec08a2be0 100644--- a/apps/carbon/app/modules/purchasing/purchasing.service.ts+++ b/apps/carbon/app/modules/purchasing/purchasing.service.ts@@ -111,7 +111,7 @@ export async function deleteSupplierType(export async function getPurchaseOrderExternalDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,purchaseOrderId: string) {return client.storage@@ -121,7 +121,7 @@ export async function getPurchaseOrderExternalDocuments(export async function getPurchaseOrderInternalDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,purchaseOrderId: string) {return client.storage@@ -142,7 +142,7 @@ export async function getPurchaseOrder(export async function getPurchaseOrders(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;status: string | null;@@ -229,7 +229,7 @@ export async function getPurchaseOrderLine(export async function getPurchaseOrderSuppliers(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("purchaseOrderSuppliers")@@ -240,7 +240,7 @@ export async function getPurchaseOrderSuppliers(export async function getRequestsForQuotes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -344,7 +344,7 @@ export async function getSupplierShipping(export async function getSuppliers(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;type: string | null;@@ -378,7 +378,7 @@ export async function getSuppliers(export async function getSuppliersList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("supplier")@@ -400,7 +400,7 @@ export async function getSupplierStatus(export async function getSupplierStatuses(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -423,7 +423,7 @@ export async function getSupplierStatuses(export async function getSupplierStatusesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("supplierStatus")@@ -445,7 +445,7 @@ export async function getSupplierType(export async function getSupplierTypes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -468,7 +468,7 @@ export async function getSupplierTypes(export async function getSupplierTypesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("supplierType")@@ -480,7 +480,7 @@ export async function getSupplierTypesList(export async function insertSupplier(client: SupabaseClient<Database>,supplier: Omit<z.infer<typeof supplierValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;}@@ -492,7 +492,7 @@ export async function insertSupplierContact(client: SupabaseClient<Database>,supplierContact: {supplierId: string;- companyId: number;+ companyId: string;contact: z.infer<typeof supplierContactValidator>;customFields?: Json;}@@ -531,7 +531,7 @@ export async function insertSupplierLocation(client: SupabaseClient<Database>,supplierLocation: {supplierId: string;- companyId: number;+ companyId: string;address: {addressLine1?: string;addressLine2?: string;@@ -635,7 +635,7 @@ export async function upsertSupplier(client: SupabaseClient<Database>,supplier:| (Omit<z.infer<typeof supplierValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -752,7 +752,7 @@ export async function upsertPurchaseOrder("id" | "purchaseOrderId"> & {purchaseOrderId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -843,7 +843,7 @@ export async function upsertPurchaseOrderDelivery(client: SupabaseClient<Database>,purchaseOrderDelivery:| (z.infer<typeof purchaseOrderDeliveryValidator> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -872,7 +872,7 @@ export async function upsertPurchaseOrderLine(client: SupabaseClient<Database>,purchaseOrderLine:| (Omit<z.infer<typeof purchaseOrderLineValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -933,7 +933,7 @@ export async function upsertRequestForQuote("id" | "requestForQuoteId"> & {requestForQuoteId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -967,7 +967,7 @@ export async function upsertSupplierStatus(client: SupabaseClient<Database>,supplierStatus:| (Omit<z.infer<typeof supplierStatusValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -995,7 +995,7 @@ export async function upsertSupplierType(client: SupabaseClient<Database>,supplierType:| (Omit<z.infer<typeof supplierTypeValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/resources/resources.service.ts b/apps/carbon/app/modules/resources/resources.service.tsindex d548f3e4f4..e01526ce21 100644--- a/apps/carbon/app/modules/resources/resources.service.ts+++ b/apps/carbon/app/modules/resources/resources.service.ts@@ -142,7 +142,7 @@ export async function deleteWorkCellType(export async function getAbilities(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & { search: string | null }) {let query = client@@ -167,7 +167,7 @@ export async function getAbilities(export async function getAbilitiesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("ability")@@ -209,7 +209,7 @@ export async function getAttribute(async function getAttributes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,userIds: string[]) {return client@@ -231,7 +231,7 @@ async function getAttributes(export async function getAttributeCategories(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: { search: string | null } & GenericQueryFilters) {let query = client@@ -295,7 +295,7 @@ export async function getContractor(export async function getContractors(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -328,7 +328,7 @@ export async function getDepartment(export async function getDepartments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -353,7 +353,7 @@ export async function getDepartments(export async function getDepartmentsList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("department")@@ -390,7 +390,7 @@ export async function getEmployeeAbilities(export async function getEmployeeJob(client: SupabaseClient<Database>,employeeId: string,- companyId: number+ companyId: string) {return client.from("employeeJob")@@ -439,7 +439,7 @@ export async function getEquipmentType(export async function getEquipmentTypes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: { search: string | null } & GenericQueryFilters) {let query = client@@ -466,7 +466,7 @@ export async function getEquipmentTypes(export async function getEquipmentTypesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("equipmentType")@@ -484,7 +484,7 @@ export async function getHoliday(export async function getHolidays(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -509,7 +509,7 @@ export async function getHolidays(export function getHolidayYears(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("holidayYears").select("year").eq("companyId", companyId);}@@ -523,7 +523,7 @@ export async function getLocation(export async function getLocations(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -546,7 +546,7 @@ export async function getLocations(export async function getLocationsList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("location")@@ -581,7 +581,7 @@ export async function getPartner(export async function getPartners(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -624,7 +624,7 @@ type Person = Employee & {export async function getPeople(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -714,7 +714,7 @@ export async function getShift(export async function getShifts(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & { search: string | null }) {let query = client@@ -794,7 +794,7 @@ export async function getWorkCellType(export async function getWorkCellTypes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: { search: string | null } & GenericQueryFilters) {let query = client@@ -821,7 +821,7 @@ export async function getWorkCellTypes(export async function getWorkCellTypesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("workCellType")@@ -841,7 +841,7 @@ export async function insertAbility(}[];};shadowWeeks: number;- companyId: number;+ companyId: string;createdBy: string;}) {@@ -914,7 +914,7 @@ export async function insertEmployeeJob(client: SupabaseClient<Database>,job: {id: string;- companyId: number;+ companyId: string;locationId: string;}) {@@ -996,7 +996,7 @@ export async function updateEmployeeJob(client: SupabaseClient<Database>,employeeId: string,employeeJob: z.infer<typeof employeeJobValidator> & {- companyId: number;+ companyId: string;updatedBy: string;customFields?: Json;}@@ -1015,7 +1015,7 @@ export async function upsertContractor(id: string;hoursPerWeek?: number;abilities: string[];- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;}@@ -1068,7 +1068,7 @@ export async function upsertDepartment(client: SupabaseClient<Database>,department:| (Omit<z.infer<typeof departmentValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1128,7 +1128,7 @@ export async function upsertEquipment(client: SupabaseClient<Database>,equipment:| (Omit<z.infer<typeof equipmentValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1150,7 +1150,7 @@ export async function upsertEquipmentType(client: SupabaseClient<Database>,equipmentType:| (Omit<z.infer<typeof equipmentTypeValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1175,7 +1175,7 @@ export async function upsertHoliday(client: SupabaseClient<Database>,holiday:| (Omit<z.infer<typeof holidayValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1195,7 +1195,7 @@ export async function upsertLocation(client: SupabaseClient<Database>,location:| (Omit<z.infer<typeof locationValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1218,7 +1218,7 @@ export async function upsertPartner(client: SupabaseClient<Database>,partner:| (Omit<z.infer<typeof partnerValidator>, "supplierId"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1243,7 +1243,7 @@ export async function upsertShift(shift:| (Omit<z.infer<typeof shiftValidator>, "id"> & {createdBy: string;- companyId: number;+ companyId: string;customFields?: Json;})| (Omit<z.infer<typeof shiftValidator>, "id"> & {@@ -1262,7 +1262,7 @@ export async function upsertWorkCell(client: SupabaseClient<Database>,workCell:| (Omit<z.infer<typeof workCellValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1285,7 +1285,7 @@ export async function upsertWorkCellType(client: SupabaseClient<Database>,workCellType:| (Omit<z.infer<typeof workCellTypeValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm.tsx b/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm.tsxindex f03b8ccbd2..4a64820e2e 100644--- a/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm.tsx+++ b/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm.tsx@@ -93,7 +93,7 @@ const EmployeeAbilityForm = ({<Employeename="employeeId"label="Employee"- readOnly={isEditing}+ isReadOnly={isEditing}/><Selectname="trainingStatus"diff --git a/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsxindex e4888c0f6a..20f6b7ebc6 100644--- a/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx+++ b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx@@ -21,12 +21,10 @@ const HolidaysTable = memo(({ data, count, years }: HolidaysTableProps) => {const permissions = usePermissions();const [params] = useUrlParams();-const customColumns = useCustomColumns<(typeof data)[number]>("holiday");const columns = useMemo<ColumnDef<(typeof data)[number]>[]>(() => {- return [-+ const defaultColumns: ColumnDef<(typeof data)[number]>[] = [{accessorKey: "name",header: "Holiday",@@ -59,7 +57,6 @@ const HolidaysTable = memo(({ data, count, years }: HolidaysTableProps) => {return [...defaultColumns, ...customColumns];}, [customColumns, years]);-const renderContextMenu = useCallback((row: (typeof data)[number]) => {return (diff --git a/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx b/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsxindex 863a1f9ea9..7dcce34960 100644--- a/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx+++ b/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx@@ -101,7 +101,7 @@ const PeopleTable = memo(/><Hyperlink to={path.to.personDetails(row?.original.id!)}>- {row.original.fullName}+ {row.original.name}</Hyperlink></HStack>),@@ -127,7 +127,9 @@ const PeopleTable = memo(header: "Employee Type",cell: ({ row }) => (<Enumerable- value={employeeTypesById[row.original.employeeTypeId].name}+ value={+ employeeTypesById[row.original.employeeTypeId!].name as string+ }/>),meta: {@@ -190,9 +192,7 @@ const PeopleTable = memo(<MenuItemonClick={() =>navigate(- `${path.to.personDetails(- row.user?.id!- )}?${params.toString()}`+ `${path.to.personDetails(row.id!)}?${params.toString()}`)}>diff --git a/apps/carbon/app/modules/sales/sales.service.ts b/apps/carbon/app/modules/sales/sales.service.tsindex 5a7b3f0871..fdd5bc04bb 100644--- a/apps/carbon/app/modules/sales/sales.service.ts+++ b/apps/carbon/app/modules/sales/sales.service.ts@@ -239,7 +239,7 @@ export async function getCustomerShipping(export async function getCustomers(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -263,7 +263,7 @@ export async function getCustomers(export async function getCustomersList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("customer")@@ -285,7 +285,7 @@ export async function getCustomerStatus(export async function getCustomerStatuses(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -308,7 +308,7 @@ export async function getCustomerStatuses(export async function getCustomerStatusesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("customerStatus")@@ -330,7 +330,7 @@ export async function getCustomerType(export async function getCustomerTypes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -353,7 +353,7 @@ export async function getCustomerTypes(export async function getCustomerTypesList(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("customerType")@@ -371,7 +371,7 @@ export async function getQuote(export async function getQuotes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -424,7 +424,7 @@ export async function getQuoteAssemblies(export async function getQuoteExternalDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,quoteId: string) {return client.storage@@ -434,7 +434,7 @@ export async function getQuoteExternalDocuments(export async function getQuoteInternalDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,quoteId: string) {return client.storage@@ -548,7 +548,7 @@ export async function insertCustomerContact(client: SupabaseClient<Database>,customerContact: {customerId: string;- companyId: number;+ companyId: string;contact: z.infer<typeof customerContactValidator>;customFields?: Json;}@@ -586,7 +586,7 @@ export async function insertCustomerLocation(client: SupabaseClient<Database>,customerLocation: {customerId: string;- companyId: number;+ companyId: string;address: {addressLine1?: string;addressLine2?: string;@@ -703,7 +703,7 @@ export async function upsertCustomer(client: SupabaseClient<Database>,customer:| (Omit<z.infer<typeof customerValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -813,7 +813,7 @@ export async function upsertCustomerStatus(client: SupabaseClient<Database>,customerStatus:| (Omit<z.infer<typeof customerStatusValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -837,7 +837,7 @@ export async function upsertCustomerType(client: SupabaseClient<Database>,customerType:| (Omit<z.infer<typeof customerTypeValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -882,7 +882,7 @@ export async function upsertQuote(quote:| (Omit<z.infer<typeof quotationValidator>, "id" | "quoteId"> & {quoteId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -912,7 +912,7 @@ export async function upsertQuoteAssembly(| (Omit<z.infer<typeof quotationAssemblyValidator>, "id"> & {quoteId: string;quoteLineId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -943,7 +943,7 @@ export async function upsertQuoteLine(client: SupabaseClient<Database>,quotationLine:| (Omit<z.infer<typeof quotationLineValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -985,7 +985,7 @@ export async function upsertQuoteMaterial(quoteId: string;quoteLineId: string;quoteOperationId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1019,7 +1019,7 @@ export async function upsertQuoteOperation(| (Omit<z.infer<typeof quotationOperationValidator>, "id"> & {quoteId: string;quoteLineId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1048,7 +1048,7 @@ export async function upsertQuoteOperation(export async function getSalesOrderExternalDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,salesOrderId: string) {return client.storage@@ -1058,7 +1058,7 @@ export async function getSalesOrderExternalDocuments(/*export async function getSalesOrderInternalDocuments(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,salesOrderId: string) {return client.storage@@ -1164,7 +1164,7 @@ export async function insertSalesOrderLines(client: SupabaseClient<Database>,salesOrderLines:| (Omit<z.infer<typeof salesOrderLineValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})[]@@ -1214,7 +1214,7 @@ export async function upsertSalesOrder(salesOrder:| (Omit<z.infer<typeof salesOrderValidator>, "id" | "salesOrderId"> & {salesOrderId: string;- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})@@ -1330,7 +1330,7 @@ export async function upsertSalesOrderLine(client: SupabaseClient<Database>,salesOrderLine:| (Omit<z.infer<typeof salesOrderLineValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;customFields?: Json;})diff --git a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLines/SalesOrderLines.tsx b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLines/SalesOrderLines.tsxindex 6c21669b9a..a7cc81588e 100644--- a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLines/SalesOrderLines.tsx+++ b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLines/SalesOrderLines.tsx@@ -205,19 +205,19 @@ const SalesOrderLines = () => {},},{- id: "quantityReceived",+ accessorKey: "quantitySent",header: "Quantity Received",cell: ({ row }) => {switch (row.original.salesOrderLineType) {case "Comment":return null;default:- return <span>{row.original.quantityReceived}</span>;+ return <span>{row.original.quantitySent}</span>;}},},{- id: "quantityInvoiced",+ accessorKey: "quantityInvoiced",header: "Quantity Invoiced",cell: ({ row }) => {switch (row.original.salesOrderLineType) {@@ -229,14 +229,14 @@ const SalesOrderLines = () => {},},{- id: "receivedComplete",- header: "Received Complete",+ accessorKey: "sentComplete",+ header: "Shipped Com`plete",cell: ({ row }) => {switch (row.original.salesOrderLineType) {case "Comment":return null;default:- return <Checkbox isChecked={!!row.original.receivedComplete} />;+ return <Checkbox isChecked={!!row.original.sentComplete} />;}},},diff --git a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderSidebar/useSalesOrderSidebar.tsx b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderSidebar/useSalesOrderSidebar.tsxindex bc958bf5d9..a05cf728ce 100644--- a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderSidebar/useSalesOrderSidebar.tsx+++ b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderSidebar/useSalesOrderSidebar.tsx@@ -1,9 +1,5 @@import { useParams } from "@remix-run/react";-import { BsBank, BsCreditCard, BsListCheck, BsTruck } from "react-icons/bs";-import {- HiOutlineDocumentArrowDown,- HiOutlineDocumentArrowUp,-} from "react-icons/hi2";+import { BsBank, BsListCheck } from "react-icons/bs";import { usePermissions } from "~/hooks";import type { Role } from "~/types";import { path } from "~/utils/path";@@ -36,6 +32,7 @@ export function useSalesOrderSidebar({count: lines,icon: BsListCheck,shortcut: "Command+Shift+l",+ role: ["employee", "customer"],},/*{name: "Shipment",diff --git a/apps/carbon/app/modules/settings/settings.server.ts b/apps/carbon/app/modules/settings/settings.server.tsindex 7c65d2633d..c27ae4bd10 100644--- a/apps/carbon/app/modules/settings/settings.server.ts+++ b/apps/carbon/app/modules/settings/settings.server.ts@@ -5,7 +5,7 @@ import type { z } from "zod";import { sanitize } from "~/utils/supabase";import type { customFieldValidator } from "./settings.models";-export async function clearCustomFieldsCache(companyId?: number) {+export async function clearCustomFieldsCache(companyId?: string) {const keys = companyId ? `customFields:${companyId}:*` : "customFields:*";redis.keys(keys).then(function (keys) {const pipeline = redis.pipeline();@@ -19,7 +19,7 @@ export async function clearCustomFieldsCache(companyId?: number) {export async function deleteCustomField(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {try {clearCustomFieldsCache(companyId);@@ -32,7 +32,7 @@ export async function upsertCustomField(client: SupabaseClient<Database>,customField:| (Omit<z.infer<typeof customFieldValidator>, "id"> & {- companyId: number;+ companyId: string;createdBy: string;})| (Omit<z.infer<typeof customFieldValidator>, "id"> & {diff --git a/apps/carbon/app/modules/settings/settings.service.ts b/apps/carbon/app/modules/settings/settings.service.tsindex 8dc7e54c02..e576a4b40e 100644--- a/apps/carbon/app/modules/settings/settings.service.ts+++ b/apps/carbon/app/modules/settings/settings.service.ts@@ -35,7 +35,7 @@ export async function getCompanies(export async function getCompany(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {const company = await client.from("company")@@ -60,7 +60,7 @@ export async function getCompany(export async function getCurrentSequence(client: SupabaseClient<Database>,table: string,- companyId: number+ companyId: string) {const sequence = await getSequence(client, table, companyId);if (sequence.error) {@@ -127,7 +127,7 @@ export async function getIntegration(export async function getIntegrations(client: SupabaseClient<Database>,- companyId: number+ companyId: string) {return client.from("integration")@@ -140,7 +140,7 @@ export async function getIntegrations(export async function getNextSequence(client: SupabaseClient<Database>,table: string,- companyId: number+ companyId: string) {const sequence = await getSequence(client, table, companyId);if (sequence.error) {@@ -172,7 +172,7 @@ export async function getNextSequence(export async function getSequence(client: SupabaseClient<Database>,table: string,- companyId: number+ companyId: string) {return client.from("sequence")@@ -184,7 +184,7 @@ export async function getSequence(export async function getSequences(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -209,7 +209,7 @@ export async function getSequences(export async function getSequencesList(client: SupabaseClient<Database>,table: string,- companyId: number+ companyId: string) {return client.from("sequence")@@ -229,7 +229,7 @@ export async function insertCompany(export async function rollbackNextSequence(client: SupabaseClient<Database>,table: string,- companyId: number+ companyId: string) {const sequence = await getSequence(client, table, companyId);if (sequence.error) {@@ -248,7 +248,7 @@ export async function rollbackNextSequence(export async function seedCompany(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,userId: string) {return client.functions.invoke("seed-company", {@@ -261,7 +261,7 @@ export async function seedCompany(export async function updateCompany(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,company: Partial<z.infer<typeof companyValidator>> & {updatedBy: string;}@@ -284,7 +284,7 @@ export async function updateIntegration(export async function updateLogo(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,logo: string | null) {return client@@ -300,7 +300,7 @@ export async function updateLogo(export async function updateSequence(client: SupabaseClient<Database>,table: string,- companyId: number,+ companyId: string,sequence: Partial<z.infer<typeof sequenceValidator>> & {updatedBy: string;}diff --git a/apps/carbon/app/modules/shared/shared.server.ts b/apps/carbon/app/modules/shared/shared.server.tsindex e272c3e80d..25ee5d55fc 100644--- a/apps/carbon/app/modules/shared/shared.server.ts+++ b/apps/carbon/app/modules/shared/shared.server.ts@@ -23,7 +23,7 @@ export async function assign(}export async function getCustomFieldsCacheKey(args?: {- companyId?: number;+ companyId?: string;module?: string;table?: string;}) {@@ -35,7 +35,7 @@ export async function getCustomFieldsCacheKey(args?: {export async function getCustomFieldsSchemas(client: SupabaseClient<Database>,args?: {- companyId: number;+ companyId: string;module?: string;table?: string;}diff --git a/apps/carbon/app/modules/shared/shared.service.ts b/apps/carbon/app/modules/shared/shared.service.tsindex e3b2ce4946..0c9a8c8d8e 100644--- a/apps/carbon/app/modules/shared/shared.service.ts+++ b/apps/carbon/app/modules/shared/shared.service.ts@@ -25,7 +25,7 @@ export async function insertNote(note: {note: string;documentId: string;- companyId: number;+ companyId: string;createdBy: string;}) {diff --git a/apps/carbon/app/modules/users/types.ts b/apps/carbon/app/modules/users/types.tsindex 0b4d099008..8576222735 100644--- a/apps/carbon/app/modules/users/types.ts+++ b/apps/carbon/app/modules/users/types.ts@@ -34,7 +34,7 @@ export type Module = NonNullable<export type Group = {data: {id: string;- companyId: number;+ companyId: string;isEmployeeTypeGroup: boolean;isCustomerOrgGroup: boolean;isCustomerTypeGroup: boolean;@@ -54,10 +54,10 @@ export type CompanyPermission = {};export type Permission = {- view: number[];- create: number[];- update: number[];- delete: number[];+ view: string[];+ create: string[];+ update: string[];+ delete: string[];};export type Supplier = NonNullable<diff --git a/apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx b/apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsxindex 5d52328e2f..6962e1526f 100644--- a/apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx+++ b/apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx@@ -14,7 +14,7 @@ import { ValidatedForm } from "@carbon/remix-validated-form";import { useFetcher } from "@remix-run/react";import { useEffect, useState } from "react";import { Employees, Hidden, Radios, Submit } from "~/components/Form";-import type { Permission } from "~/modules/users";+import type { CompanyPermission } from "~/modules/users";import { bulkPermissionsValidator } from "~/modules/users";import { path } from "~/utils/path";import PermissionCheckboxes from "../components/Permission";@@ -30,11 +30,11 @@ const BulkEditPermissions = ({isOpen,onClose,}: BulkEditPermissionsProps) => {- const [permissions, setPermissions] = useState<Record<string, Permission>>(- {}- );+ const [permissions, setPermissions] = useState<+ Record<string, CompanyPermission>+ >({});- const updatePermissions = (module: string, permission: Permission) => {+ const updatePermissions = (module: string, permission: CompanyPermission) => {setPermissions((prevPermissions) => ({...prevPermissions,[module]: permission,@@ -46,7 +46,7 @@ const BulkEditPermissions = ({string,{name: string;- permission: Permission;+ permission: CompanyPermission;}>;}>();@@ -57,7 +57,7 @@ const BulkEditPermissions = ({useEffect(() => {if (emptyPermissionsFetcher.data) {- let emptyPermissions: Record<string, Permission> = {};+ let emptyPermissions: Record<string, CompanyPermission> = {};Object.entries(emptyPermissionsFetcher.data.permissions).forEach(([module, data]) => {emptyPermissions[module] = data.permission;diff --git a/apps/carbon/app/modules/users/users.server.ts b/apps/carbon/app/modules/users/users.server.tsindex 412139c7cd..71c64e6378 100644--- a/apps/carbon/app/modules/users/users.server.ts+++ b/apps/carbon/app/modules/users/users.server.ts@@ -30,7 +30,7 @@ export async function addUserToCompany(client: SupabaseClient<Database>,userToCompany: {userId: string;- companyId: number;+ companyId: string;}) {return client.from("userToCompany").insert(userToCompany);@@ -45,7 +45,7 @@ export async function createCustomerAccount(}: {id: string;customerId: string;- companyId: number;+ companyId: string;}): Promise<Result> {// TODO: convert to transaction and call this at the end of the transaction@@ -160,7 +160,7 @@ export async function createEmployeeAccount(firstName: string;lastName: string;employeeType: string;- companyId: number;+ companyId: string;}): Promise<Result> {// TODO: convert to transaction and call this at the end of the transaction@@ -262,7 +262,7 @@ export async function createSupplierAccount(}: {id: string;supplierId: string;- companyId: number;+ companyId: string;}): Promise<Result> {// TODO: convert to transaction and call this at the end of the transaction@@ -489,7 +489,7 @@ export async function getUserGroups(export async function getUserDefaults(client: SupabaseClient<Database>,userId: string,- companyId: number+ companyId: string) {return client.from("userDefaults")@@ -504,7 +504,7 @@ async function insertCustomerAccount(customerAccount: {id: string;customerId: string;- companyId: number;+ companyId: string;}) {return client@@ -526,7 +526,7 @@ async function insertSupplierAccount(supplierAccount: {id: string;supplierId: string;- companyId: number;+ companyId: string;}) {return client@@ -547,14 +547,14 @@ function makePermissionsFromEmployeeType({data,}: {data: {- view: number[];- create: number[];- update: number[];- delete: number[];+ view: string[];+ create: string[];+ update: string[];+ delete: string[];module: string;}[];}) {- const permissions: Record<string, number[]> = {};+ const permissions: Record<string, string[]> = {};data.forEach((permission) => {if (!permission.module) {@@ -583,9 +583,9 @@ function isClaimPermission(key: string, value: unknown) {);}-function makeCustomerPermissions(companyId: number) {+function makeCustomerPermissions(companyId: string) {// TODO: this should be more dynamic- const permissions: Record<string, number[]> = {+ const permissions: Record<string, string[]> = {documents_view: [companyId],jobs_view: [companyId],sales_view: [companyId],@@ -616,7 +616,7 @@ export function makeEmptyPermissionsFromModules(data: Module[]) {export function makeCompanyPermissionsFromClaims(claims: Json[] | null,- companyId: number+ companyId: string) {if (typeof claims !== "object" || claims === null) return null;let permissions: Record<string, CompanyPermission> = {};@@ -645,19 +645,19 @@ export function makeCompanyPermissionsFromClaims(switch (action) {case "view":permissions[module]["view"] =- value.includes(0) || value.includes(companyId);+ value.includes("0") || value.includes(companyId);break;case "create":permissions[module]["create"] =- value.includes(0) || value.includes(companyId);+ value.includes("0") || value.includes(companyId);break;case "update":permissions[module]["update"] =- value.includes(0) || value.includes(companyId);+ value.includes("0") || value.includes(companyId);break;case "delete":permissions[module]["delete"] =- value.includes(0) || value.includes(companyId);+ value.includes("0") || value.includes(companyId);break;}}@@ -690,16 +690,16 @@ export function makePermissionsFromClaims(claims: Json[] | null) {switch (action) {case "view":- permissions[module]["view"] = value as number[];+ permissions[module]["view"] = value as string[];break;case "create":- permissions[module]["create"] = value as number[];+ permissions[module]["create"] = value as string[];break;case "update":- permissions[module]["update"] = value as number[];+ permissions[module]["update"] = value as string[];break;case "delete":- permissions[module]["delete"] = value as number[];+ permissions[module]["delete"] = value as string[];break;}}@@ -714,7 +714,7 @@ export function makePermissionsFromClaims(claims: Json[] | null) {export function makeCompanyPermissionsFromEmployeeType(data: EmployeeTypePermission[],- companyId: number+ companyId: string) {const result: Record<string,@@ -731,15 +731,16 @@ export function makeCompanyPermissionsFromEmployeeType(name: permission.module.toLowerCase(),permission: {view:- permission.view.includes(0) || permission.view.includes(companyId),+ permission.view.includes("0") ||+ permission.view.includes(companyId),create:- permission.create.includes(0) ||+ permission.create.includes("0") ||permission.create.includes(companyId),update:- permission.update.includes(0) ||+ permission.update.includes("0") ||permission.update.includes(companyId),delete:- permission.delete.includes(0) ||+ permission.delete.includes("0") ||permission.delete.includes(companyId),},};@@ -749,9 +750,9 @@ export function makeCompanyPermissionsFromEmployeeType(return result;}-function makeSupplierPermissions(companyId: number) {+function makeSupplierPermissions(companyId: string) {// TODO: this should be more dynamic- const permissions: Record<string, number[]> = {+ const permissions: Record<string, string[]> = {documents_view: [companyId],purchasing_view: [companyId],parts_view: [companyId],@@ -802,7 +803,7 @@ async function setUserClaims(async function setUserPermissions(client: SupabaseClient<Database>,userId: string,- permissions: Record<string, number[]>+ permissions: Record<string, string[]>) {const user = await client.from("user")@@ -813,7 +814,7 @@ async function setUserPermissions(const currentPermissions = (user.data?.permissions ?? {}) as Record<string,- number[]+ string[]>;const newPermissions = { ...currentPermissions };@@ -842,7 +843,7 @@ export async function updateEmployee(id: string;employeeType: string;permissions: Record<string, CompanyPermission>;- companyId: number;+ companyId: string;}): Promise<Result> {const updateEmployeeEmployeeType = await client@@ -865,7 +866,7 @@ export async function updatePermissions(}: {id: string;permissions: Record<string, CompanyPermission>;- companyId: number;+ companyId: string;addOnly?: boolean;}): Promise<Result> {@@ -880,7 +881,7 @@ export async function updatePermissions(claims.data === null? {}: claims.data- ) as Record<string, number[]>;+ ) as Record<string, string[]>;// add any missing claims to the current claimsObject.keys(permissions).forEach((name) => {@@ -938,8 +939,8 @@ export async function updatePermissions(}} else {updatedPermissions[`${module}_view`] = (- updatedPermissions[`${module}_view`] as number[]- ).filter((c: number) => c !== companyId);+ updatedPermissions[`${module}_view`] as string[]+ ).filter((c: string) => c !== companyId);}if (permission.create) {@@ -951,8 +952,8 @@ export async function updatePermissions(}} else {updatedPermissions[`${module}_create`] = (- updatedPermissions[`${module}_create`] as number[]- ).filter((c: number) => c !== companyId);+ updatedPermissions[`${module}_create`] as string[]+ ).filter((c: string) => c !== companyId);}if (permission.update) {@@ -964,8 +965,8 @@ export async function updatePermissions(}} else {updatedPermissions[`${module}_update`] = (- updatedPermissions[`${module}_update`] as number[]- ).filter((c: number) => c !== companyId);+ updatedPermissions[`${module}_update`] as string[]+ ).filter((c: string) => c !== companyId);}if (permission.delete) {@@ -977,8 +978,8 @@ export async function updatePermissions(}} else {updatedPermissions[`${module}_delete`] = (- updatedPermissions[`${module}_delete`] as number[]- ).filter((c: number) => c !== companyId);+ updatedPermissions[`${module}_delete`] as string[]+ ).filter((c: string) => c !== companyId);}});}diff --git a/apps/carbon/app/modules/users/users.service.ts b/apps/carbon/app/modules/users/users.service.tsindex dfe430440f..f21a2c7acb 100644--- a/apps/carbon/app/modules/users/users.service.ts+++ b/apps/carbon/app/modules/users/users.service.ts@@ -40,7 +40,7 @@ export async function getCompaniesForUser(export async function getCustomers(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -68,7 +68,7 @@ export async function getCustomers(export async function getEmployee(client: SupabaseClient<Database>,id: string,- companyId: number+ companyId: string) {return client.from("employees")@@ -80,7 +80,7 @@ export async function getEmployee(export async function getEmployees(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -113,7 +113,7 @@ export async function getEmployeeType(export async function getEmployeeTypes(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & { search: string | null }) {let query = client@@ -157,7 +157,7 @@ export async function getGroupMembers(export async function getGroups(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args?: GenericQueryFilters & {search: string | null;uid: string | null;@@ -187,7 +187,7 @@ export async function getPermissionsByEmployeeType(export async function getSuppliers(client: SupabaseClient<Database>,- companyId: number,+ companyId: string,args: GenericQueryFilters & {search: string | null;}@@ -222,7 +222,7 @@ export async function getUsers(client: SupabaseClient<Database>) {export async function insertEmployeeType(client: SupabaseClient<Database>,- employeeType: { name: string; companyId: number }+ employeeType: { name: string; companyId: string }) {return client.from("employeeType")@@ -233,7 +233,7 @@ export async function insertEmployeeType(export async function insertGroup(client: SupabaseClient<Database>,- group: { name: string; companyId: number }+ group: { name: string; companyId: string }) {return client.from("group").insert(group).select("*").single();}@@ -241,7 +241,7 @@ export async function insertGroup(export async function upsertEmployeeType(client: SupabaseClient<Database>,employeeType:- | { name: string; companyId: number }+ | { name: string; companyId: string }| { id: string; name: string }) {if ("id" in employeeType) {@@ -262,7 +262,7 @@ export async function upsertEmployeeType(export async function upsertEmployeeTypePermissions(client: SupabaseClient<Database>,employeeTypeId: string,- companyId: number,+ companyId: string,permissions: { name: string; permission: CompanyPermission }[]) {const employeeTypePermissions = permissions.map(({ name, permission }) => ({@@ -286,7 +286,7 @@ export async function upsertGroup(}: {id: string;name: string;- companyId: number;+ companyId: string;}) {return client.from("group").upsert([{ id, name, companyId }]);diff --git a/apps/carbon/app/routes/_public+/healthcheck.tsx b/apps/carbon/app/routes/_public+/healthcheck.tsxindex 5bc46729d8..8950f859af 100644--- a/apps/carbon/app/routes/_public+/healthcheck.tsx+++ b/apps/carbon/app/routes/_public+/healthcheck.tsx@@ -3,7 +3,7 @@ import { getSupabaseServiceRole } from "~/lib/supabase";export async function loader() {try {const test = await getSupabaseServiceRole()- .from("users")+ .from("userAttributeDataType").select("id", { head: true }).single();if (test.error) throw test.error;diff --git a/apps/carbon/app/routes/onboarding+/company.tsx b/apps/carbon/app/routes/onboarding+/company.tsxindex 9cb826f631..7f8d5a2599 100644--- a/apps/carbon/app/routes/onboarding+/company.tsx+++ b/apps/carbon/app/routes/onboarding+/company.tsx@@ -28,6 +28,7 @@ import {upsertLocation,} from "~/modules/resources";import {+ getCompanies,getCompany,insertCompany,onboardingCompanyValidator,@@ -39,7 +40,10 @@ import {getPermissionCacheKey,} from "~/modules/users/users.server";import { requirePermissions } from "~/services/auth/auth.server";-import { commitAuthSession } from "~/services/session.server";+import {+ destroyAuthSession,+ updateCompanySession,+} from "~/services/session.server";import { assertIsPost } from "~/utils/http";export async function loader({ request }: ActionFunctionArgs) {@@ -78,18 +82,20 @@ export async function action({ request }: ActionFunctionArgs) {const supabaseClient = getSupabaseServiceRole();const { next, ...data } = validation.data;- let companyId: number | undefined;+ let companyId: string | undefined;- const [company, locations] = await Promise.all([- getCompany(client, 1),- getLocationsList(client, 1),- ]);+ const companies = await getCompanies(client, userId);+ const company = companies?.data?.[0];+ const locations = await getLocationsList(client, company?.id ?? "");const location = locations?.data?.[0];- if (company.data && location) {+ if (company && location) {const [companyUpdate, locationUpdate] = await Promise.all([- updateCompany(supabaseClient, 1, { ...data, updatedBy: userId }),+ updateCompany(supabaseClient, company.id!, {+ ...data,+ updatedBy: userId,+ }),upsertLocation(supabaseClient, {...location,...data,@@ -168,11 +174,13 @@ export async function action({ request }: ActionFunctionArgs) {}}+ if (!companyId) {+ await destroyAuthSession(request);+ }+throw redirect(next, {headers: {- "Set-Cookie": await commitAuthSession(request, {- company: companyId ?? 1,- }),+ "Set-Cookie": await updateCompanySession(request, companyId!),},});}diff --git a/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsxindex 0f02668e40..9fbe1336eb 100644--- a/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx+++ b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx@@ -77,18 +77,18 @@ export default function ShiftRoute() {const { shift } = useLoaderData<typeof loader>();const initialValues = {- id: shift.id,- name: shift.name,- startTime: shift.startTime,- endTime: shift.endTime,- locationId: shift.locationId,- monday: shift.monday,- tuesday: shift.tuesday,- wednesday: shift.wednesday,- thursday: shift.thursday,- friday: shift.friday,- saturday: shift.saturday,- sunday: shift.sunday,+ id: shift.id ?? "",+ name: shift.name ?? "",+ startTime: shift.startTime ?? "",+ endTime: shift.endTime ?? "",+ locationId: shift.locationId ?? "",+ monday: shift.monday ?? false,+ tuesday: shift.tuesday ?? false,+ wednesday: shift.wednesday ?? false,+ thursday: shift.thursday ?? false,+ friday: shift.friday ?? false,+ saturday: shift.saturday ?? false,+ sunday: shift.sunday ?? false,...getCustomFields(shift.customFields),};diff --git a/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsxindex 3dac1bef07..ed9e5073f8 100644--- a/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx+++ b/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx@@ -71,9 +71,9 @@ export default function DeleteShiftRoute() {return (<ConfirmDeleteaction={path.to.deleteShift(shiftId)}- name={shift.name}+ name={shift.name ?? "Shift"}text={`Are you sure you want to delete the shift: ${shift.name} from ${- shift.location?.name ?? "unknown location"+ shift.locationName ?? "unknown location"}? This cannot be undone.`}onCancel={onCancel}/>diff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.shipment.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.shipment.tsxindex 8ac66f9756..2d7d32e900 100644--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.shipment.tsx+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.shipment.tsx@@ -127,7 +127,7 @@ export default function SalesOrderShipmentRoute() {trackingNumber: salesOrderShipment.trackingNumber ?? "",receiptRequestedDate: salesOrderShipment.receiptRequestedDate ?? "",receiptPromisedDate: salesOrderShipment.receiptPromisedDate ?? "",- shipmentDate: salesOrderShipment.shipmentDate ?? "",+ deliveryDate: salesOrderShipment.deliveryDate ?? "",notes: salesOrderShipment.notes ?? "",dropShipment: salesOrderShipment.dropShipment ?? false,customerId: salesOrderShipment.customerId ?? "",diff --git a/apps/carbon/app/routes/x+/settings+/company.switch.$companyId.tsx b/apps/carbon/app/routes/x+/settings+/company.switch.$companyId.tsxindex e7f21b830f..c6c6e84d5a 100644--- a/apps/carbon/app/routes/x+/settings+/company.switch.$companyId.tsx+++ b/apps/carbon/app/routes/x+/settings+/company.switch.$companyId.tsx@@ -1,7 +1,11 @@import { redirect, type ActionFunctionArgs } from "@remix-run/node";import { getCompanies } from "~/modules/settings";import { requirePermissions } from "~/services/auth/auth.server";-import { flash, updateCompanySession } from "~/services/session.server";+import {+ destroyAuthSession,+ flash,+ updateCompanySession,+} from "~/services/session.server";import { path, requestReferrer } from "~/utils/path";import { error } from "~/utils/result";@@ -16,7 +20,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- const companyId = Number(params.companyId);+ const companyId = params.companyId;if (!companies.data?.find((company) => company.id === companyId)) {throw redirect(requestReferrer(request) ?? path.to.authenticatedRoot,@@ -24,9 +28,13 @@ export async function action({ request, params }: ActionFunctionArgs) {);}+ if (!companyId) {+ await destroyAuthSession(request);+ }+throw redirect(path.to.authenticatedRoot, {headers: {- "Set-Cookie": await updateCompanySession(request, companyId),+ "Set-Cookie": await updateCompanySession(request, companyId!),},});}diff --git a/apps/carbon/app/routes/x+/users+/deactivate.tsx b/apps/carbon/app/routes/x+/users+/deactivate.tsxindex d01a9fd6aa..cf805370f2 100644--- a/apps/carbon/app/routes/x+/users+/deactivate.tsx+++ b/apps/carbon/app/routes/x+/users+/deactivate.tsx@@ -2,7 +2,7 @@ import { validationError, validator } from "@carbon/remix-validated-form";import type { ActionFunctionArgs } from "@remix-run/node";import { redirect } from "@remix-run/node";import type { z } from "zod";-import type { userAdminSchema } from "~/jobs/user-admin.server";+import type { userAdminSchema } from "~/jobs.server/user-admin.server";import { triggerClient } from "~/lib/trigger.server";import { deactivateUsersValidator } from "~/modules/users";import { deactivateUser } from "~/modules/users/users.server";diff --git a/apps/carbon/app/routes/x+/users+/resend-invite.tsx b/apps/carbon/app/routes/x+/users+/resend-invite.tsxindex d650c4d14c..d26ad95dc5 100644--- a/apps/carbon/app/routes/x+/users+/resend-invite.tsx+++ b/apps/carbon/app/routes/x+/users+/resend-invite.tsx@@ -2,7 +2,7 @@ import { validationError, validator } from "@carbon/remix-validated-form";import type { ActionFunctionArgs } from "@remix-run/node";import { json } from "@remix-run/node";import type { z } from "zod";-import type { userAdminSchema } from "~/jobs/user-admin.server";+import type { userAdminSchema } from "~/jobs.server/user-admin.server";import { triggerClient } from "~/lib/trigger.server";import { resendInviteValidator } from "~/modules/users";import { resendInvite } from "~/modules/users/users.server";diff --git a/apps/carbon/app/services/auth/auth.server.ts b/apps/carbon/app/services/auth/auth.server.tsindex b08bb3c3f4..2804c98de9 100644--- a/apps/carbon/app/services/auth/auth.server.ts+++ b/apps/carbon/app/services/auth/auth.server.ts@@ -54,7 +54,7 @@ export async function getAuthAccountByAccessToken(accessToken: string) {function makeAuthSession(supabaseSession: SupabaseAuthSession | null,- companyId: number+ companyId: string): AuthSession | null {if (!supabaseSession) return null;@@ -87,7 +87,7 @@ export async function requirePermissions(}): Promise<{client: SupabaseClient<Database>;- companyId: number;+ companyId: string;email: string;userId: string;}> {@@ -114,7 +114,7 @@ export async function requirePermissions(action as "view" | "create" | "update" | "delete"];return (- permissionForCompany.includes(0) || // 0 is the wildcard for all companies+ permissionForCompany.includes("0") || // 0 is the wildcard for all companiespermissionForCompany.includes(companyId));} else if (Array.isArray(permission)) {@@ -124,7 +124,7 @@ export async function requirePermissions(action as "view" | "create" | "update" | "delete"];return (- permissionForCompany.includes(0) || // 0 is the wildcard for all companies+ permissionForCompany.includes("0") || // 0 is the wildcard for all companiespermissionForCompany.includes(companyId));});@@ -191,7 +191,7 @@ export async function signInWithEmail(email: string, password: string) {export async function refreshAccessToken(refreshToken?: string,- companyId?: number+ companyId?: string): Promise<AuthSession | null> {if (!refreshToken) return null;diff --git a/apps/carbon/app/services/auth/types.ts b/apps/carbon/app/services/auth/types.tsindex 8490fc4f79..9aaa488934 100644--- a/apps/carbon/app/services/auth/types.ts+++ b/apps/carbon/app/services/auth/types.ts@@ -2,7 +2,7 @@ export interface AuthSession {accessToken: string;refreshToken: string;userId: string;- companyId: number;+ companyId: string;email: string;expiresIn: number;expiresAt: number;diff --git a/apps/carbon/app/services/session.server.ts b/apps/carbon/app/services/session.server.tsindex 71210feee1..ed86f2fe02 100644--- a/apps/carbon/app/services/session.server.ts+++ b/apps/carbon/app/services/session.server.ts@@ -63,7 +63,7 @@ export async function commitAuthSession(export async function destroyAuthSession(request: Request) {const session = await getSession(request);- return redirect(path.to.login, {+ throw redirect(path.to.login, {headers: {"Set-Cookie": await sessionStorage.destroySession(session),},@@ -179,7 +179,7 @@ export async function refreshAuthSession(export async function updateCompanySession(request: Request,- companyId: number+ companyId: string) {const session = await getSession(request);const authSession = await getAuthSession(request);diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.tsindex aff8c9757f..72b8a60e71 100644--- a/apps/carbon/app/utils/path.ts+++ b/apps/carbon/app/utils/path.ts@@ -100,7 +100,7 @@ export const path = {generatePath(`${x}/accounting/charts/${id}`),chartOfAccounts: `${x}/accounting/charts`,company: `${x}/settings/company`,- companySwitch: (companyId: number) =>+ companySwitch: (companyId: string) =>generatePath(`${x}/settings/company/switch/${companyId}`),contractor: (id: string) =>generatePath(`${x}/resources/contractors/${id}`),diff --git a/package-lock.json b/package-lock.jsonindex 70ad57b0ed..f7d0732160 100644--- a/package-lock.json+++ b/package-lock.json@@ -17,7 +17,7 @@"npm-run-all": "^4.1.5","prettier": "^2.8.0","rimraf": "^5.0.5",- "supabase": "1.164.1",+ "supabase": "1.165.0","ts-morph": "^22.0.0","tsx": "^3.12.1","turbo": "^1.13.3"@@ -1983,6 +1983,18 @@"url": "https://github.com/chalk/strip-ansi?sponsor=1"}},+ "node_modules/@isaacs/fs-minipass": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",+ "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",+ "dev": true,+ "dependencies": {+ "minipass": "^7.0.4"+ },+ "engines": {+ "node": ">=18.0.0"+ }+ },"node_modules/@istanbuljs/load-nyc-config": {"version": "1.1.0","resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",@@ -34863,16 +34875,16 @@}},"node_modules/supabase": {- "version": "1.164.1",- "resolved": "https://registry.npmjs.org/supabase/-/supabase-1.164.1.tgz",- "integrity": "sha512-j6OvAQjTNcJ8SBlqZpUTFJ7C3iXliZ8VjcleFvUBAlFLqot1EhXT8tqSLZiOP1B91Ks2DPOxT8D94cAIWYWvLQ==",+ "version": "1.165.0",+ "resolved": "https://registry.npmjs.org/supabase/-/supabase-1.165.0.tgz",+ "integrity": "sha512-bN1TSR6p4POxCQqb3OsO6vo2H9yKIUB2HW44SiLAV9leBIjdm4AsrJJ1hmc/YecqjtuBooAr7RXz/uGKQEQbEQ==","dev": true,"hasInstallScript": true,"dependencies": {"bin-links": "^4.0.3","https-proxy-agent": "^7.0.2","node-fetch": "^3.3.2",- "tar": "6.2.0"+ "tar": "7.0.1"},"bin": {"supabase": "bin/supabase"@@ -34881,6 +34893,87 @@"npm": ">=8"}},+ "node_modules/supabase/node_modules/chownr": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",+ "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",+ "dev": true,+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/supabase/node_modules/minipass": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",+ "dev": true,+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/supabase/node_modules/minizlib": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz",+ "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==",+ "dev": true,+ "dependencies": {+ "minipass": "^7.0.4",+ "rimraf": "^5.0.5"+ },+ "engines": {+ "node": ">= 18"+ }+ },+ "node_modules/supabase/node_modules/minizlib/node_modules/minipass": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz",+ "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==",+ "dev": true,+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/supabase/node_modules/mkdirp": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",+ "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",+ "dev": true,+ "bin": {+ "mkdirp": "dist/cjs/src/bin.js"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/supabase/node_modules/tar": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/tar/-/tar-7.0.1.tgz",+ "integrity": "sha512-IjMhdQMZFpKsHEQT3woZVxBtCQY+0wk3CVxdRkGXEgyGa0dNS/ehPvOMr2nmfC7x5Zj2N+l6yZUpmICjLGS35w==",+ "dev": true,+ "dependencies": {+ "@isaacs/fs-minipass": "^4.0.0",+ "chownr": "^3.0.0",+ "minipass": "^5.0.0",+ "minizlib": "^3.0.1",+ "mkdirp": "^3.0.1",+ "yallist": "^5.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/supabase/node_modules/yallist": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",+ "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",+ "dev": true,+ "engines": {+ "node": ">=18"+ }+ },"node_modules/supports-color": {"version": "7.2.0","resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",@@ -38609,6 +38702,106 @@"uuid": "9.0.0"}},+ "packages/database/node_modules/chownr": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",+ "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",+ "dev": true,+ "engines": {+ "node": ">=18"+ }+ },+ "packages/database/node_modules/minipass": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",+ "dev": true,+ "engines": {+ "node": ">=8"+ }+ },+ "packages/database/node_modules/minizlib": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz",+ "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==",+ "dev": true,+ "dependencies": {+ "minipass": "^7.0.4",+ "rimraf": "^5.0.5"+ },+ "engines": {+ "node": ">= 18"+ }+ },+ "packages/database/node_modules/minizlib/node_modules/minipass": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz",+ "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==",+ "dev": true,+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "packages/database/node_modules/mkdirp": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",+ "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",+ "dev": true,+ "bin": {+ "mkdirp": "dist/cjs/src/bin.js"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "packages/database/node_modules/supabase": {+ "version": "1.164.1",+ "resolved": "https://registry.npmjs.org/supabase/-/supabase-1.164.1.tgz",+ "integrity": "sha512-1NwkDBW9Ny28Nhdxwf79tyU/x3BLNWNw/9m5olZXvJZvhaZhOCKt1JZgPnSYX/eXS2OQiKd8MJkE0gMYRZorew==",+ "dev": true,+ "hasInstallScript": true,+ "dependencies": {+ "bin-links": "^4.0.3",+ "https-proxy-agent": "^7.0.2",+ "node-fetch": "^3.3.2",+ "tar": "7.0.1"+ },+ "bin": {+ "supabase": "bin/supabase"+ },+ "engines": {+ "npm": ">=8"+ }+ },+ "packages/database/node_modules/tar": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/tar/-/tar-7.0.1.tgz",+ "integrity": "sha512-IjMhdQMZFpKsHEQT3woZVxBtCQY+0wk3CVxdRkGXEgyGa0dNS/ehPvOMr2nmfC7x5Zj2N+l6yZUpmICjLGS35w==",+ "dev": true,+ "dependencies": {+ "@isaacs/fs-minipass": "^4.0.0",+ "chownr": "^3.0.0",+ "minipass": "^5.0.0",+ "minizlib": "^3.0.1",+ "mkdirp": "^3.0.1",+ "yallist": "^5.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "packages/database/node_modules/yallist": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",+ "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",+ "dev": true,+ "engines": {+ "node": ">=18"+ }+ },"packages/documents": {"name": "@carbon/documents","version": "*",diff --git a/packages/database/src/seed/admin.ts b/packages/database/src/seed/admin.tsindex ca40b4ef43..d2c3c4126d 100644--- a/packages/database/src/seed/admin.ts+++ b/packages/database/src/seed/admin.ts@@ -5,13 +5,13 @@ const admin = {lastName: "Admin",};-const ALL_TEAMS_ID = 0;+const ALL_TEAMS_ID = "0";const claims: Record<string, string> = {role: "employee",};-const permissions: Record<string, number[]> = {+const permissions: Record<string, string[]> = {settings_update: [ALL_TEAMS_ID],users_update: [ALL_TEAMS_ID],};diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 6ac27c8c97..6e5713a3c4 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -37,7 +37,7 @@ export type Database = {ability: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurve: Json@@ -49,7 +49,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurve?: Json@@ -61,7 +61,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurve?: Json@@ -150,7 +150,7 @@ export type Database = {accountSubcategoryId: string | nullactive: booleanclass: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number+ companyId: stringconsolidatedRate:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -171,7 +171,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: booleanclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number+ companyId: stringconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -192,7 +192,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: booleanclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number+ companyId?: stringconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -299,7 +299,7 @@ export type Database = {Row: {category: stringclass: Database["public"]["Enums"]["glAccountClass"]- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -311,7 +311,7 @@ export type Database = {Insert: {category: stringclass: Database["public"]["Enums"]["glAccountClass"]- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -323,7 +323,7 @@ export type Database = {Update: {category?: stringclass?: Database["public"]["Enums"]["glAccountClass"]- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -417,7 +417,7 @@ export type Database = {bankForeignCurrencyAccount: stringbankLocalCurrencyAccount: stringcapacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringcustomerPaymentDiscountAccount: stringdirectCostAppliedAccount: string@@ -460,7 +460,7 @@ export type Database = {bankForeignCurrencyAccount: stringbankLocalCurrencyAccount: stringcapacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringcustomerPaymentDiscountAccount: stringdirectCostAppliedAccount: string@@ -503,7 +503,7 @@ export type Database = {bankForeignCurrencyAccount?: stringbankLocalCurrencyAccount?: stringcapacityVarianceAccount?: string- companyId?: number+ companyId?: stringcostOfGoodsSoldAccount?: stringcustomerPaymentDiscountAccount?: stringdirectCostAppliedAccount?: string@@ -1116,7 +1116,7 @@ export type Database = {Row: {closedAt: string | nullclosedBy: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringendDate: string@@ -1129,7 +1129,7 @@ export type Database = {Insert: {closedAt?: string | nullclosedBy?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringendDate: string@@ -1142,7 +1142,7 @@ export type Database = {Update: {closedAt?: string | nullclosedBy?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringendDate?: string@@ -1365,7 +1365,7 @@ export type Database = {addressLine1: string | nulladdressLine2: string | nullcity: string | null- companyId: number+ companyId: stringcountryCode: number | nullfax: string | nullid: string@@ -1377,7 +1377,7 @@ export type Database = {addressLine1?: string | nulladdressLine2?: string | nullcity?: string | null- companyId: number+ companyId: stringcountryCode?: number | nullfax?: string | nullid?: string@@ -1389,7 +1389,7 @@ export type Database = {addressLine1?: string | nulladdressLine2?: string | nullcity?: string | null- companyId?: number+ companyId?: stringcountryCode?: number | nullfax?: string | nullid?: string@@ -1462,7 +1462,7 @@ export type Database = {countryCode: string | nullemail: string | nullfax: string | null- id: number+ id: stringlogo: string | nullname: stringphone: string | null@@ -1479,7 +1479,7 @@ export type Database = {countryCode?: string | nullemail?: string | nullfax?: string | null- id?: number+ id?: stringlogo?: string | nullname: stringphone?: string | null@@ -1496,7 +1496,7 @@ export type Database = {countryCode?: string | nullemail?: string | nullfax?: string | null- id?: number+ id?: stringlogo?: string | nullname?: stringphone?: string | null@@ -1543,7 +1543,7 @@ export type Database = {addressLine2: string | nullbirthday: string | nullcity: string | null- companyId: number+ companyId: stringcountryCode: number | nullemail: stringfax: string | null@@ -1564,7 +1564,7 @@ export type Database = {addressLine2?: string | nullbirthday?: string | nullcity?: string | null- companyId: number+ companyId: stringcountryCode?: number | nullemail: stringfax?: string | null@@ -1585,7 +1585,7 @@ export type Database = {addressLine2?: string | nullbirthday?: string | nullcity?: string | null- companyId?: number+ companyId?: stringcountryCode?: number | nullemail?: stringfax?: string | null@@ -1628,7 +1628,7 @@ export type Database = {contractor: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -1639,7 +1639,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -1650,7 +1650,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -1813,7 +1813,7 @@ export type Database = {costLedger: {Row: {adjustment: boolean- companyId: number+ companyId: stringcost: numbercostLedgerType: Database["public"]["Enums"]["costLedgerType"]costPostedToGL: number@@ -1832,7 +1832,7 @@ export type Database = {}Insert: {adjustment?: boolean- companyId: number+ companyId: stringcost?: numbercostLedgerType: Database["public"]["Enums"]["costLedgerType"]costPostedToGL?: number@@ -1851,7 +1851,7 @@ export type Database = {}Update: {adjustment?: boolean- companyId?: number+ companyId?: stringcost?: numbercostLedgerType?: Database["public"]["Enums"]["costLedgerType"]costPostedToGL?: number@@ -1905,7 +1905,7 @@ export type Database = {}crew: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcrewLeaderId: string | null@@ -1918,7 +1918,7 @@ export type Database = {workCellId: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcrewLeaderId?: string | null@@ -1931,7 +1931,7 @@ export type Database = {workCellId?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcrewLeaderId?: string | null@@ -2084,7 +2084,7 @@ export type Database = {Row: {active: booleancode: string- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -2100,7 +2100,7 @@ export type Database = {Insert: {active?: booleancode: string- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -2116,7 +2116,7 @@ export type Database = {Update: {active?: booleancode?: string- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -2178,7 +2178,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: string | nullcustomerStatusId: string | null@@ -2194,7 +2194,7 @@ export type Database = {Insert: {accountManagerId?: string | nullassignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy?: string | nullcustomerStatusId?: string | null@@ -2210,7 +2210,7 @@ export type Database = {Update: {accountManagerId?: string | nullassignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: string | nullcustomerStatusId?: string | null@@ -2368,17 +2368,17 @@ export type Database = {}customerAccount: {Row: {- companyId: number+ companyId: stringcustomerId: stringid: string}Insert: {- companyId: number+ companyId: stringcustomerId: stringid: string}Update: {- companyId?: number+ companyId?: stringcustomerId?: stringid?: string}@@ -2591,7 +2591,7 @@ export type Database = {}customerPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: string | nullcustomerId: stringinvoiceCustomerContactId: string | null@@ -2602,7 +2602,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: string | nullcustomerId: stringinvoiceCustomerContactId?: string | null@@ -2613,7 +2613,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: string | nullcustomerId?: stringinvoiceCustomerContactId?: string | null@@ -2740,7 +2740,7 @@ export type Database = {}customerShipping: {Row: {- companyId: number+ companyId: stringcustomerId: stringshippingCustomerContactId: string | nullshippingCustomerId: string | null@@ -2751,7 +2751,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomerId: stringshippingCustomerContactId?: string | nullshippingCustomerId?: string | null@@ -2762,7 +2762,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomerId?: stringshippingCustomerContactId?: string | nullshippingCustomerId?: string | null@@ -2889,7 +2889,7 @@ export type Database = {}customerStatus: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -2899,7 +2899,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -2909,7 +2909,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -2993,7 +2993,7 @@ export type Database = {}customerType: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -3004,7 +3004,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -3015,7 +3015,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3101,7 +3101,7 @@ export type Database = {customField: {Row: {active: boolean | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFieldTableId: string@@ -3115,7 +3115,7 @@ export type Database = {}Insert: {active?: boolean | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFieldTableId: string@@ -3129,7 +3129,7 @@ export type Database = {}Update: {active?: boolean | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFieldTableId?: string@@ -3237,21 +3237,21 @@ export type Database = {}customFieldTable: {Row: {- companyId: number+ companyId: stringid: stringmodule: Database["public"]["Enums"]["module"]name: stringtable: string}Insert: {- companyId: number+ companyId: stringid?: stringmodule: Database["public"]["Enums"]["module"]name: stringtable: string}Update: {- companyId?: number+ companyId?: stringid?: stringmodule?: Database["public"]["Enums"]["module"]name?: string@@ -3276,7 +3276,7 @@ export type Database = {}department: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -3287,7 +3287,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -3298,7 +3298,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3335,7 +3335,7 @@ export type Database = {document: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringdescription: string | null@@ -3356,7 +3356,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringdescription?: string | null@@ -3377,7 +3377,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringdescription?: string | null@@ -3643,17 +3643,17 @@ export type Database = {}employee: {Row: {- companyId: number+ companyId: stringemployeeTypeId: stringid: string}Insert: {- companyId: number+ companyId: stringemployeeTypeId: stringid: string}Update: {- companyId?: number+ companyId?: stringemployeeTypeId?: stringid?: string}@@ -3749,7 +3749,7 @@ export type Database = {}employeeJob: {Row: {- companyId: number+ companyId: stringcustomFields: Json | nulldepartmentId: string | nullid: string@@ -3763,7 +3763,7 @@ export type Database = {workCellId: string | null}Insert: {- companyId: number+ companyId: stringcustomFields?: Json | nulldepartmentId?: string | nullid: string@@ -3777,7 +3777,7 @@ export type Database = {workCellId?: string | null}Update: {- companyId?: number+ companyId?: stringcustomFields?: Json | nulldepartmentId?: string | nullid?: string@@ -4010,7 +4010,7 @@ export type Database = {}employeeType: {Row: {- companyId: number+ companyId: stringcreatedAt: stringid: stringname: string@@ -4018,7 +4018,7 @@ export type Database = {updatedAt: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringid?: stringname: string@@ -4026,7 +4026,7 @@ export type Database = {updatedAt?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringid?: stringname?: string@@ -4052,34 +4052,34 @@ export type Database = {}employeeTypePermission: {Row: {- create: number[]+ create: string[]createdAt: string- delete: number[]+ delete: string[]employeeTypeId: stringmodule: Database["public"]["Enums"]["module"]- update: number[]+ update: string[]updatedAt: string | null- view: number[]+ view: string[]}Insert: {- create?: number[]+ create?: string[]createdAt?: string- delete?: number[]+ delete?: string[]employeeTypeId: stringmodule: Database["public"]["Enums"]["module"]- update?: number[]+ update?: string[]updatedAt?: string | null- view?: number[]+ view?: string[]}Update: {- create?: number[]+ create?: string[]createdAt?: string- delete?: number[]+ delete?: string[]employeeTypeId?: stringmodule?: Database["public"]["Enums"]["module"]- update?: number[]+ update?: string[]updatedAt?: string | null- view?: number[]+ view?: string[]}Relationships: [{@@ -4095,7 +4095,7 @@ export type Database = {Row: {active: booleanactiveDate: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4113,7 +4113,7 @@ export type Database = {Insert: {active?: booleanactiveDate?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4131,7 +4131,7 @@ export type Database = {Update: {active?: booleanactiveDate?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4264,7 +4264,7 @@ export type Database = {equipmentType: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4278,7 +4278,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4292,7 +4292,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4386,19 +4386,19 @@ export type Database = {}fiscalYearSettings: {Row: {- companyId: number+ companyId: stringstartMonth: Database["public"]["Enums"]["month"]taxStartMonth: Database["public"]["Enums"]["month"]updatedBy: string}Insert: {- companyId: number+ companyId: stringstartMonth?: Database["public"]["Enums"]["month"]taxStartMonth?: Database["public"]["Enums"]["month"]updatedBy: string}Update: {- companyId?: number+ companyId?: stringstartMonth?: Database["public"]["Enums"]["month"]taxStartMonth?: Database["public"]["Enums"]["month"]updatedBy?: string@@ -4450,7 +4450,7 @@ export type Database = {}group: {Row: {- companyId: number | null+ companyId: string | nullcreatedAt: stringid: stringisCustomerOrgGroup: boolean@@ -4463,7 +4463,7 @@ export type Database = {updatedAt: string | null}Insert: {- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringid?: stringisCustomerOrgGroup?: boolean@@ -4476,7 +4476,7 @@ export type Database = {updatedAt?: string | null}Update: {- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringid?: stringisCustomerOrgGroup?: boolean@@ -4507,7 +4507,7 @@ export type Database = {}holiday: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4519,7 +4519,7 @@ export type Database = {year: number | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4531,7 +4531,7 @@ export type Database = {year?: number | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4618,7 +4618,7 @@ export type Database = {integration: {Row: {active: boolean- companyId: number+ companyId: stringdescription: string | nullid: stringjsonschema: Json@@ -4631,7 +4631,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringdescription?: string | nullid: stringjsonschema: Json@@ -4644,7 +4644,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringdescription?: string | nullid?: stringjsonschema?: Json@@ -4689,7 +4689,7 @@ export type Database = {journal: {Row: {accountingPeriodId: string | null- companyId: number+ companyId: stringcreatedAt: stringcustomFields: Json | nulldescription: string | null@@ -4698,7 +4698,7 @@ export type Database = {}Insert: {accountingPeriodId?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4707,7 +4707,7 @@ export type Database = {}Update: {accountingPeriodId?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4743,7 +4743,7 @@ export type Database = {accountNumber: stringaccrual: booleanamount: number- companyId: number+ companyId: stringcreatedAt: stringcustomFields: Json | nulldescription: string | null@@ -4762,7 +4762,7 @@ export type Database = {accountNumber: stringaccrual?: booleanamount: number- companyId: number+ companyId: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4781,7 +4781,7 @@ export type Database = {accountNumber?: stringaccrual?: booleanamount?: number- companyId?: number+ companyId?: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4832,7 +4832,7 @@ export type Database = {addressLine1: stringaddressLine2: string | nullcity: string- companyId: number+ companyId: stringcountryCode: string | nullcreatedAt: stringcreatedBy: string@@ -4851,7 +4851,7 @@ export type Database = {addressLine1: stringaddressLine2?: string | nullcity: string- companyId: number+ companyId: stringcountryCode?: string | nullcreatedAt?: stringcreatedBy: string@@ -4870,7 +4870,7 @@ export type Database = {addressLine1?: stringaddressLine2?: string | nullcity?: string- companyId?: number+ companyId?: stringcountryCode?: string | nullcreatedAt?: stringcreatedBy?: string@@ -4969,7 +4969,7 @@ export type Database = {note: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringdocumentId: string@@ -4980,7 +4980,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringdocumentId: string@@ -4991,7 +4991,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringdocumentId?: string@@ -5052,7 +5052,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5075,7 +5075,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5098,7 +5098,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5260,7 +5260,7 @@ export type Database = {}partCost: {Row: {- companyId: number+ companyId: stringcostingMethod: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted: booleancreatedAt: string@@ -5273,7 +5273,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcostingMethod: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted?: booleancreatedAt?: string@@ -5286,7 +5286,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcostingMethod?: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted?: booleancreatedAt?: string@@ -5395,7 +5395,7 @@ export type Database = {partGroup: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5407,7 +5407,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5419,7 +5419,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5504,7 +5504,7 @@ export type Database = {}partInventory: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5515,7 +5515,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5526,7 +5526,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5667,7 +5667,7 @@ export type Database = {}partLedger: {Row: {- companyId: number+ companyId: stringcreatedAt: stringdocumentId: string | nulldocumentType:@@ -5684,7 +5684,7 @@ export type Database = {shelfId: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -5701,7 +5701,7 @@ export type Database = {shelfId?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -5794,7 +5794,7 @@ export type Database = {Row: {abilityId: stringactive: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5806,7 +5806,7 @@ export type Database = {Insert: {abilityId: stringactive?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5818,7 +5818,7 @@ export type Database = {Update: {abilityId?: stringactive?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5916,7 +5916,7 @@ export type Database = {}partPlanning: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcritical: boolean@@ -5939,7 +5939,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcritical?: boolean@@ -5962,7 +5962,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcritical?: boolean@@ -6108,7 +6108,7 @@ export type Database = {}partReplenishment: {Row: {- companyId: number+ companyId: stringconversionFactor: numbercreatedAt: stringcreatedBy: string@@ -6128,7 +6128,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringconversionFactor?: numbercreatedAt?: stringcreatedBy: string@@ -6148,7 +6148,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringconversionFactor?: numbercreatedAt?: stringcreatedBy?: string@@ -6306,7 +6306,7 @@ export type Database = {partSupplier: {Row: {active: boolean- companyId: number+ companyId: stringconversionFactor: numbercreatedAt: stringcreatedBy: string@@ -6323,7 +6323,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringconversionFactor?: numbercreatedAt?: stringcreatedBy: string@@ -6340,7 +6340,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringconversionFactor?: numbercreatedAt?: stringcreatedBy?: string@@ -6487,7 +6487,7 @@ export type Database = {partUnitSalePrice: {Row: {allowInvoiceDiscount: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -6502,7 +6502,7 @@ export type Database = {}Insert: {allowInvoiceDiscount?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -6517,7 +6517,7 @@ export type Database = {}Update: {allowInvoiceDiscount?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -6642,7 +6642,7 @@ export type Database = {Row: {active: booleancalculationMethod: Database["public"]["Enums"]["paymentTermCalculationMethod"]- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -6657,7 +6657,7 @@ export type Database = {Insert: {active?: booleancalculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"]- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -6672,7 +6672,7 @@ export type Database = {Update: {active?: booleancalculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"]- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -6760,7 +6760,7 @@ export type Database = {postingGroupInventory: {Row: {capacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringdirectCostAppliedAccount: stringid: string@@ -6781,7 +6781,7 @@ export type Database = {}Insert: {capacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringdirectCostAppliedAccount: stringid?: string@@ -6802,7 +6802,7 @@ export type Database = {}Update: {capacityVarianceAccount?: string- companyId?: number+ companyId?: stringcostOfGoodsSoldAccount?: stringdirectCostAppliedAccount?: stringid?: string@@ -7085,7 +7085,7 @@ export type Database = {}postingGroupPurchasing: {Row: {- companyId: number+ companyId: stringid: stringpartGroupId: string | nullpayablesAccount: string@@ -7098,7 +7098,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringid?: stringpartGroupId?: string | nullpayablesAccount: string@@ -7111,7 +7111,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringid?: stringpartGroupId?: string | nullpayablesAccount?: string@@ -7268,7 +7268,7 @@ export type Database = {}postingGroupSales: {Row: {- companyId: number+ companyId: stringcustomerTypeId: string | nullid: stringpartGroupId: string | null@@ -7281,7 +7281,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomerTypeId?: string | nullid?: stringpartGroupId?: string | null@@ -7294,7 +7294,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomerTypeId?: string | nullid?: stringpartGroupId?: string | null@@ -7453,7 +7453,7 @@ export type Database = {Row: {assignee: string | nullbalance: number- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -7482,7 +7482,7 @@ export type Database = {Insert: {assignee?: string | nullbalance?: number- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -7511,7 +7511,7 @@ export type Database = {Update: {assignee?: string | nullbalance?: number- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -7740,7 +7740,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number+ companyId: stringconversionFactor: number | nullcreatedAt: stringcreatedBy: string@@ -7768,7 +7768,7 @@ export type Database = {Insert: {accountNumber?: string | nullassetId?: string | null- companyId: number+ companyId: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy: string@@ -7796,7 +7796,7 @@ export type Database = {Update: {accountNumber?: string | nullassetId?: string | null- companyId?: number+ companyId?: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy?: string@@ -8212,7 +8212,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -8234,7 +8234,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -8256,7 +8256,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -8454,7 +8454,7 @@ export type Database = {}purchaseOrderDelivery: {Row: {- companyId: number+ companyId: stringcustomerId: string | nullcustomerLocationId: string | nullcustomFields: Json | null@@ -8472,7 +8472,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -8490,7 +8490,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -8698,7 +8698,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number+ companyId: stringconversionFactor: number | nullcreatedAt: stringcreatedBy: string@@ -8729,7 +8729,7 @@ export type Database = {Insert: {accountNumber?: string | nullassetId?: string | null- companyId: number+ companyId: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy: string@@ -8760,7 +8760,7 @@ export type Database = {Update: {accountNumber?: string | nullassetId?: string | null- companyId?: number+ companyId?: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy?: string@@ -8940,7 +8940,7 @@ export type Database = {}purchaseOrderPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: stringcustomFields: Json | nullid: string@@ -8953,7 +8953,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: stringcustomFields?: Json | nullid: string@@ -8966,7 +8966,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: stringcustomFields?: Json | nullid?: string@@ -9215,7 +9215,7 @@ export type Database = {}purchasePayment: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -9230,7 +9230,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -9245,7 +9245,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -9377,7 +9377,7 @@ export type Database = {quote: {Row: {assignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomerContactId: string | null@@ -9399,7 +9399,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomerContactId?: string | null@@ -9421,7 +9421,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomerContactId?: string | null@@ -9607,7 +9607,7 @@ export type Database = {}quoteAssembly: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -9623,7 +9623,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -9639,7 +9639,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -9864,7 +9864,7 @@ export type Database = {}quoteLine: {Row: {- companyId: number+ companyId: stringcreatedBy: stringcustomerPartId: string | nullcustomerPartRevision: string | null@@ -9881,7 +9881,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedBy: stringcustomerPartId?: string | nullcustomerPartRevision?: string | null@@ -9898,7 +9898,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedBy?: stringcustomerPartId?: string | nullcustomerPartRevision?: string | null@@ -10178,7 +10178,7 @@ export type Database = {}quoteMaterial: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -10195,7 +10195,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -10212,7 +10212,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -10373,7 +10373,7 @@ export type Database = {}quoteOperation: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -10394,7 +10394,7 @@ export type Database = {workCellTypeId: string}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -10415,7 +10415,7 @@ export type Database = {workCellTypeId: string}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -10567,7 +10567,7 @@ export type Database = {receipt: {Row: {assignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -10589,7 +10589,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -10611,7 +10611,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -10797,7 +10797,7 @@ export type Database = {}receiptLine: {Row: {- companyId: number+ companyId: stringconversionFactor: number | nullcreatedAt: stringcreatedBy: string@@ -10816,7 +10816,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy: string@@ -10835,7 +10835,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy?: string@@ -10985,7 +10985,7 @@ export type Database = {requestForQuote: {Row: {assignee: string | null- companyId: number+ companyId: stringcreatedAt: string | nullcreatedBy: stringcustomFields: Json | null@@ -11003,7 +11003,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcreatedAt?: string | nullcreatedBy: stringcustomFields?: Json | null@@ -11021,7 +11021,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: string | nullcreatedBy?: stringcustomFields?: Json | null@@ -11226,7 +11226,7 @@ export type Database = {}requestForQuoteLine: {Row: {- companyId: number+ companyId: stringcreatedAt: string | nullcreatedBy: stringcustomFields: Json | null@@ -11243,7 +11243,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: string | nullcreatedBy: stringcustomFields?: Json | null@@ -11260,7 +11260,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: string | nullcreatedBy?: stringcustomFields?: Json | null@@ -11724,7 +11724,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -11747,7 +11747,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode?: string@@ -11770,7 +11770,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -12043,7 +12043,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -12072,7 +12072,7 @@ export type Database = {Insert: {accountNumber?: string | nullassetId?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -12101,7 +12101,7 @@ export type Database = {Update: {accountNumber?: string | nullassetId?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -12265,7 +12265,7 @@ export type Database = {}salesOrderPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: stringcustomFields: Json | nullid: string@@ -12278,7 +12278,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: stringcustomFields?: Json | nullid: string@@ -12291,7 +12291,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: stringcustomFields?: Json | nullid?: string@@ -12386,7 +12386,7 @@ export type Database = {salesOrderShipment: {Row: {assignee: string | null- companyId: number+ companyId: stringcustomerId: string | nullcustomerLocationId: string | nullcustomFields: Json | null@@ -12407,7 +12407,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -12428,7 +12428,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -12740,7 +12740,7 @@ export type Database = {}search: {Row: {- companyId: number+ companyId: stringdescription: string | nullentity: Database["public"]["Enums"]["searchEntity"] | nullfts: unknown | null@@ -12750,7 +12750,7 @@ export type Database = {uuid: string | null}Insert: {- companyId: number+ companyId: stringdescription?: string | nullentity?: Database["public"]["Enums"]["searchEntity"] | nullfts?: unknown | null@@ -12760,7 +12760,7 @@ export type Database = {uuid?: string | null}Update: {- companyId?: number+ companyId?: stringdescription?: string | nullentity?: Database["public"]["Enums"]["searchEntity"] | nullfts?: unknown | null@@ -12788,7 +12788,7 @@ export type Database = {}sequence: {Row: {- companyId: number+ companyId: stringid: stringname: stringnext: number@@ -12801,7 +12801,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringid?: stringname: stringnext?: number@@ -12814,7 +12814,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringid?: stringname?: stringnext?: number@@ -12878,7 +12878,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -12898,7 +12898,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -12918,7 +12918,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13071,7 +13071,7 @@ export type Database = {serviceSupplier: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13084,7 +13084,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13097,7 +13097,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13233,7 +13233,7 @@ export type Database = {shelf: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13245,7 +13245,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13257,7 +13257,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13378,7 +13378,7 @@ export type Database = {shift: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13399,7 +13399,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13420,7 +13420,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13545,7 +13545,7 @@ export type Database = {active: booleancarrier: Database["public"]["Enums"]["shippingCarrier"]carrierAccountId: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13559,7 +13559,7 @@ export type Database = {active?: booleancarrier?: Database["public"]["Enums"]["shippingCarrier"]carrierAccountId?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13573,7 +13573,7 @@ export type Database = {active?: booleancarrier?: Database["public"]["Enums"]["shippingCarrier"]carrierAccountId?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13673,7 +13673,7 @@ export type Database = {shippingTerm: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringid: string@@ -13683,7 +13683,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringid?: string@@ -13693,7 +13693,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringid?: string@@ -13778,7 +13778,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: string | nullcustomFields: Json | null@@ -13794,7 +13794,7 @@ export type Database = {Insert: {accountManagerId?: string | nullassignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy?: string | nullcustomFields?: Json | null@@ -13810,7 +13810,7 @@ export type Database = {Update: {accountManagerId?: string | nullassignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: string | nullcustomFields?: Json | null@@ -13968,17 +13968,17 @@ export type Database = {}supplierAccount: {Row: {- companyId: number+ companyId: stringid: stringsupplierId: string}Insert: {- companyId: number+ companyId: stringid: stringsupplierId: string}Update: {- companyId?: number+ companyId?: stringid?: stringsupplierId?: string}@@ -14170,7 +14170,7 @@ export type Database = {supplierLedger: {Row: {amount: number- companyId: number+ companyId: stringcreatedAt: stringdocumentId: string | nulldocumentType:@@ -14184,7 +14184,7 @@ export type Database = {}Insert: {amount: number- companyId: number+ companyId: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -14198,7 +14198,7 @@ export type Database = {}Update: {amount?: number- companyId?: number+ companyId?: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -14328,7 +14328,7 @@ export type Database = {}supplierPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: string | nullcustomFields: Json | nullinvoiceSupplierContactId: string | null@@ -14340,7 +14340,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: string | nullcustomFields?: Json | nullinvoiceSupplierContactId?: string | null@@ -14352,7 +14352,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: string | nullcustomFields?: Json | nullinvoiceSupplierContactId?: string | null@@ -14508,7 +14508,7 @@ export type Database = {}supplierShipping: {Row: {- companyId: number+ companyId: stringcustomFields: Json | nullshippingMethodId: string | nullshippingSupplierContactId: string | null@@ -14520,7 +14520,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomFields?: Json | nullshippingMethodId?: string | nullshippingSupplierContactId?: string | null@@ -14532,7 +14532,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomFields?: Json | nullshippingMethodId?: string | nullshippingSupplierContactId?: string | null@@ -14688,7 +14688,7 @@ export type Database = {}supplierStatus: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14698,7 +14698,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14708,7 +14708,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -14792,7 +14792,7 @@ export type Database = {}supplierType: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14803,7 +14803,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14814,7 +14814,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -14901,7 +14901,7 @@ export type Database = {Row: {active: booleancode: string- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14913,7 +14913,7 @@ export type Database = {Insert: {active?: booleancode: string- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14925,7 +14925,7 @@ export type Database = {Update: {active?: booleancode?: string- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -15168,7 +15168,7 @@ export type Database = {userAttributeCategory: {Row: {active: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: stringcreatedBy: stringid: string@@ -15180,7 +15180,7 @@ export type Database = {}Insert: {active?: boolean | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringcreatedBy: stringid?: string@@ -15192,7 +15192,7 @@ export type Database = {}Update: {active?: boolean | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringcreatedBy?: stringid?: string@@ -15442,15 +15442,15 @@ export type Database = {}userToCompany: {Row: {- companyId: number+ companyId: stringuserId: string}Insert: {- companyId: number+ companyId: stringuserId: string}Update: {- companyId?: number+ companyId?: stringuserId?: string}Relationships: [@@ -15501,7 +15501,7 @@ export type Database = {warehouse: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringid: string@@ -15517,7 +15517,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringid?: string@@ -15533,7 +15533,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringid?: string@@ -15652,7 +15652,7 @@ export type Database = {Row: {active: booleanactiveDate: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -15669,7 +15669,7 @@ export type Database = {Insert: {active?: booleanactiveDate?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -15686,7 +15686,7 @@ export type Database = {Update: {active?: booleanactiveDate?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -15818,7 +15818,7 @@ export type Database = {workCellType: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -15835,7 +15835,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -15852,7 +15852,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -15953,7 +15953,7 @@ export type Database = {Row: {category: string | nullclass: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -15966,7 +15966,7 @@ export type Database = {Insert: {category?: string | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: string | nullcreatedBy?: string | nullcustomFields?: Json | null@@ -15979,7 +15979,7 @@ export type Database = {Update: {category?: string | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: string | nullcreatedBy?: string | nullcustomFields?: Json | null@@ -16070,7 +16070,7 @@ export type Database = {accountSubcategoryId: string | nullactive: boolean | nullclass: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number | null+ companyId: string | nullconsolidatedRate:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -16093,7 +16093,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: boolean | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -16116,7 +16116,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: boolean | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -16224,12 +16224,12 @@ export type Database = {addressLine1: string | nulladdressLine2: string | nullcity: string | null- companyId: number | null+ companyId: string | nullcountryCode: string | nullemail: string | nullemployeeType: string | nullfax: string | null- id: number | null+ id: string | nulllogo: string | nullname: string | nullphone: string | null@@ -16317,7 +16317,7 @@ export type Database = {Row: {abilityIds: string[] | nullactive: boolean | null- companyId: number | null+ companyId: string | nullcustomFields: Json | nullemail: string | nullfirstName: string | null@@ -16355,7 +16355,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomerStatusId: string | null@@ -16516,7 +16516,7 @@ export type Database = {}customFieldTables: {Row: {- companyId: number | null+ companyId: string | nullfields: Json | nullid: string | nullmodule: Database["public"]["Enums"]["module"] | null@@ -16585,7 +16585,7 @@ export type Database = {documents: {Row: {active: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nulldescription: string | null@@ -16670,7 +16670,7 @@ export type Database = {Row: {active: boolean | nullavatarUrl: string | null- companyId: number | null+ companyId: string | nullemail: string | nullemployeeTypeId: string | nullfirstName: string | null@@ -16705,7 +16705,7 @@ export type Database = {employeeSummary: {Row: {avatarUrl: string | null- companyId: number | null+ companyId: string | nulldepartmentName: string | nullid: string | nulllocationName: string | null@@ -16733,7 +16733,7 @@ export type Database = {}groupMembers: {Row: {- companyId: number | null+ companyId: string | nullgroupId: string | nullid: number | nullisCustomerOrgGroup: boolean | null@@ -16808,7 +16808,7 @@ export type Database = {}groups: {Row: {- companyId: number | null+ companyId: string | nullid: string | nullisCustomerOrgGroup: boolean | nullisCustomerTypeGroup: boolean | null@@ -16823,7 +16823,7 @@ export type Database = {}groups_recursive: {Row: {- companyId: number | null+ companyId: string | nullgroupId: string | nullisCustomerOrgGroup: boolean | nullisCustomerTypeGroup: boolean | null@@ -16839,7 +16839,7 @@ export type Database = {}holidayYears: {Row: {- companyId: number | null+ companyId: string | nullyear: number | null}Relationships: [@@ -16871,7 +16871,7 @@ export type Database = {abilityName: string | nullactive: boolean | nullcity: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -16980,7 +16980,7 @@ export type Database = {}partQuantities: {Row: {- companyId: number | null+ companyId: string | nulllocationId: string | nullpartId: string | nullquantityAvailable: number | null@@ -17013,7 +17013,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -17181,7 +17181,7 @@ export type Database = {Row: {assignee: string | nullbalance: number | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcurrencyCode: string | null@@ -17395,7 +17395,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number | null+ companyId: string | nullconversionFactor: number | nullcreatedAt: string | nullcreatedBy: string | null@@ -17665,7 +17665,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -17872,7 +17872,7 @@ export type Database = {}purchaseOrderSuppliers: {Row: {- companyId: number | null+ companyId: string | nullid: string | nullname: string | null}@@ -17916,7 +17916,7 @@ export type Database = {}quoteLines: {Row: {- companyId: number | null+ companyId: string | nullcreatedBy: string | nullcustomerPartId: string | nullcustomerPartRevision: string | null@@ -18063,7 +18063,7 @@ export type Database = {quotes: {Row: {assignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomerContactId: string | null@@ -18253,7 +18253,7 @@ export type Database = {receipts: {Row: {assignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -18441,7 +18441,7 @@ export type Database = {requestForQuotes: {Row: {assignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -18592,7 +18592,7 @@ export type Database = {}salesOrderCustomers: {Row: {- companyId: number | null+ companyId: string | nullid: string | nullname: string | null}@@ -18617,7 +18617,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomerId: string | null@@ -18812,7 +18812,7 @@ export type Database = {closedBy: string | nullclosedByAvatar: string | nullclosedByFullName: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcreatedByAvatar: string | null@@ -19044,7 +19044,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -19199,7 +19199,7 @@ export type Database = {shifts: {Row: {active: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -19324,7 +19324,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -19486,7 +19486,7 @@ export type Database = {}userDefaults: {Row: {- companyId: number | null+ companyId: string | nulllocationId: string | nulluserId: string | null}@@ -19552,7 +19552,7 @@ export type Database = {foreign_key: stringtbl: string}- Returns: number+ Returns: string}get_my_claim: {Args: {@@ -19570,19 +19570,13 @@ export type Database = {Args: {claim: string}- Returns: unknown- }- get_permission_companies_as_text: {- Args: {- claim: string- }- Returns: unknown+ Returns: string[]}groups_for_user: {Args: {uid: string}- Returns: unknown+ Returns: string[]}groups_query: {Args: {@@ -19592,7 +19586,7 @@ export type Database = {Returns: {id: stringname: string- companyId: number+ companyId: stringparentId: stringisEmployeeTypeGroup: booleanisCustomerOrgGroup: boolean@@ -19611,7 +19605,7 @@ export type Database = {has_company_permission: {Args: {claim: string- company: number+ company: string}Returns: boolean}@@ -19632,23 +19626,17 @@ export type Database = {}Returns: {number: string- companyId: number+ companyId: stringbalance: numberbalanceAtDate: numbernetChange: number}[]}- jsonb_to_integer_array: {- Args: {- "": Json- }- Returns: unknown- }jsonb_to_text_array: {Args: {"": Json}- Returns: unknown+ Returns: string[]}users_for_groups: {Args: {@@ -19672,7 +19660,7 @@ export type Database = {Args: {_xid: unknown}- Returns: unknown+ Returns: number[]}xid_encode: {Args: {@@ -19684,7 +19672,7 @@ export type Database = {Args: {_xid: unknown}- Returns: unknown+ Returns: number[]}xid_pid: {Args: {@@ -20067,6 +20055,101 @@ export type Database = {},]}+ s3_multipart_uploads: {+ Row: {+ bucket_id: string+ created_at: string+ id: string+ in_progress_size: number+ key: string+ owner_id: string | null+ upload_signature: string+ version: string+ }+ Insert: {+ bucket_id: string+ created_at?: string+ id: string+ in_progress_size?: number+ key: string+ owner_id?: string | null+ upload_signature: string+ version: string+ }+ Update: {+ bucket_id?: string+ created_at?: string+ id?: string+ in_progress_size?: number+ key?: string+ owner_id?: string | null+ upload_signature?: string+ version?: string+ }+ Relationships: [+ {+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"+ columns: ["bucket_id"]+ isOneToOne: false+ referencedRelation: "buckets"+ referencedColumns: ["id"]+ },+ ]+ }+ s3_multipart_uploads_parts: {+ Row: {+ bucket_id: string+ created_at: string+ etag: string+ id: string+ key: string+ owner_id: string | null+ part_number: number+ size: number+ upload_id: string+ version: string+ }+ Insert: {+ bucket_id: string+ created_at?: string+ etag: string+ id?: string+ key: string+ owner_id?: string | null+ part_number: number+ size?: number+ upload_id: string+ version: string+ }+ Update: {+ bucket_id?: string+ created_at?: string+ etag?: string+ id?: string+ key?: string+ owner_id?: string | null+ part_number?: number+ size?: number+ upload_id?: string+ version?: string+ }+ Relationships: [+ {+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"+ columns: ["bucket_id"]+ isOneToOne: false+ referencedRelation: "buckets"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"+ columns: ["upload_id"]+ isOneToOne: false+ referencedRelation: "s3_multipart_uploads"+ referencedColumns: ["id"]+ },+ ]+ }}Views: {[_ in never]: never@@ -20097,7 +20180,7 @@ export type Database = {Args: {name: string}- Returns: unknown+ Returns: string[]}get_size_by_bucket: {Args: Record<PropertyKey, never>@@ -20106,6 +20189,37 @@ export type Database = {bucket_id: string}[]}+ list_multipart_uploads_with_delimiter: {+ Args: {+ bucket_id: string+ prefix_param: string+ delimiter_param: string+ max_keys?: number+ next_key_token?: string+ next_upload_token?: string+ }+ Returns: {+ key: string+ id: string+ created_at: string+ }[]+ }+ list_objects_with_delimiter: {+ Args: {+ bucket_id: string+ prefix_param: string+ delimiter_param: string+ max_keys?: number+ start_after?: string+ next_token?: string+ }+ Returns: {+ name: string+ id: string+ metadata: Json+ updated_at: string+ }[]+ }search: {Args: {prefix: string@@ -20136,9 +20250,11 @@ export type Database = {}}+type PublicSchema = Database[Extract<keyof Database, "public">]+export type Tables<PublicTableNameOrOptions extends- | keyof (Database["public"]["Tables"] & Database["public"]["Views"])+ | keyof (PublicSchema["Tables"] & PublicSchema["Views"])| { schema: keyof Database },TableName extends PublicTableNameOrOptions extends { schema: keyof Database }? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &@@ -20151,10 +20267,10 @@ export type Tables<}? R: never- : PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] &- Database["public"]["Views"])- ? (Database["public"]["Tables"] &- Database["public"]["Views"])[PublicTableNameOrOptions] extends {+ : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &+ PublicSchema["Views"])+ ? (PublicSchema["Tables"] &+ PublicSchema["Views"])[PublicTableNameOrOptions] extends {Row: infer R}? R@@ -20163,7 +20279,7 @@ export type Tables<export type TablesInsert<PublicTableNameOrOptions extends- | keyof Database["public"]["Tables"]+ | keyof PublicSchema["Tables"]| { schema: keyof Database },TableName extends PublicTableNameOrOptions extends { schema: keyof Database }? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]@@ -20174,8 +20290,8 @@ export type TablesInsert<}? I: never- : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]- ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {Insert: infer I}? I@@ -20184,7 +20300,7 @@ export type TablesInsert<export type TablesUpdate<PublicTableNameOrOptions extends- | keyof Database["public"]["Tables"]+ | keyof PublicSchema["Tables"]| { schema: keyof Database },TableName extends PublicTableNameOrOptions extends { schema: keyof Database }? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]@@ -20195,8 +20311,8 @@ export type TablesUpdate<}? U: never- : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]- ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {Update: infer U}? U@@ -20205,14 +20321,14 @@ export type TablesUpdate<export type Enums<PublicEnumNameOrOptions extends- | keyof Database["public"]["Enums"]+ | keyof PublicSchema["Enums"]| { schema: keyof Database },EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]: never = never,> = PublicEnumNameOrOptions extends { schema: keyof Database }? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]- : PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]- ? Database["public"]["Enums"][PublicEnumNameOrOptions]+ : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]+ ? PublicSchema["Enums"][PublicEnumNameOrOptions]: neverdiff --git a/packages/database/supabase/functions/create-receipt-default/index.ts b/packages/database/supabase/functions/create-receipt-default/index.tsindex f106dbad0c..5be5395969 100644--- a/packages/database/supabase/functions/create-receipt-default/index.ts+++ b/packages/database/supabase/functions/create-receipt-default/index.ts@@ -30,7 +30,7 @@ serve(async (req: Request) => {.insertInto("receipt").values({receiptId,- companyId: Number(companyId),+ companyId: companyId,locationId: locationId,createdBy: userId,})diff --git a/packages/database/supabase/functions/create-receipt-from-purchase-order/index.ts b/packages/database/supabase/functions/create-receipt-from-purchase-order/index.tsindex 52b31e8ce7..c8c406a02f 100644--- a/packages/database/supabase/functions/create-receipt-from-purchase-order/index.ts+++ b/packages/database/supabase/functions/create-receipt-from-purchase-order/index.ts@@ -81,7 +81,7 @@ serve(async (req: Request) => {acc.push({lineId: d.id,- companyId: Number(companyId),+ companyId: companyId,partId: d.partId,orderQuantity: d.purchaseQuantity * (d.conversionFactor ?? 1),outstandingQuantity: outstandingQuantity * (d.conversionFactor ?? 1),@@ -131,7 +131,7 @@ serve(async (req: Request) => {sourceDocument: "Purchase Order",sourceDocumentId: purchaseOrder.data.id,sourceDocumentReadableId: purchaseOrder.data.purchaseOrderId,- companyId: Number(companyId),+ companyId: companyId,locationId: locationId,createdBy: userId,})diff --git a/packages/database/supabase/functions/lib/seed.ts b/packages/database/supabase/functions/lib/seed.tsindex 81497b76e4..e901d851cb 100644--- a/packages/database/supabase/functions/lib/seed.ts+++ b/packages/database/supabase/functions/lib/seed.ts@@ -2196,24 +2196,24 @@ function getDefaultAccount(key: string) {return accountDefaults[key];}-export const groupCompanyTemplate = "<%=12-digit-company-id=%>";+export const groupCompanyTemplate = "<%=XXXX-YYYY-ZZZZZZZZZZZZ=%>";export const groups = [{- id: `00000000-0000-0000-0000-${groupCompanyTemplate}`,+ id: `00000000-0000-${groupCompanyTemplate}`,name: "All Employees",isCustomerTypeGroup: false,isEmployeeTypeGroup: true,isSupplierTypeGroup: false,},{- id: `11111111-1111-1111-1111-${groupCompanyTemplate}`,+ id: `11111111-1111-${groupCompanyTemplate}`,name: "All Customers",isCustomerTypeGroup: true,isEmployeeTypeGroup: false,isSupplierTypeGroup: false,},{- id: `22222222-2222-2222-2222-${groupCompanyTemplate}`,+ id: `22222222-2222-${groupCompanyTemplate}`,name: "All Suppliers",isCustomerTypeGroup: false,isEmployeeTypeGroup: false,diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 6ac27c8c97..6e5713a3c4 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -37,7 +37,7 @@ export type Database = {ability: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurve: Json@@ -49,7 +49,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurve?: Json@@ -61,7 +61,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurve?: Json@@ -150,7 +150,7 @@ export type Database = {accountSubcategoryId: string | nullactive: booleanclass: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number+ companyId: stringconsolidatedRate:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -171,7 +171,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: booleanclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number+ companyId: stringconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -192,7 +192,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: booleanclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number+ companyId?: stringconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -299,7 +299,7 @@ export type Database = {Row: {category: stringclass: Database["public"]["Enums"]["glAccountClass"]- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -311,7 +311,7 @@ export type Database = {Insert: {category: stringclass: Database["public"]["Enums"]["glAccountClass"]- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -323,7 +323,7 @@ export type Database = {Update: {category?: stringclass?: Database["public"]["Enums"]["glAccountClass"]- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -417,7 +417,7 @@ export type Database = {bankForeignCurrencyAccount: stringbankLocalCurrencyAccount: stringcapacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringcustomerPaymentDiscountAccount: stringdirectCostAppliedAccount: string@@ -460,7 +460,7 @@ export type Database = {bankForeignCurrencyAccount: stringbankLocalCurrencyAccount: stringcapacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringcustomerPaymentDiscountAccount: stringdirectCostAppliedAccount: string@@ -503,7 +503,7 @@ export type Database = {bankForeignCurrencyAccount?: stringbankLocalCurrencyAccount?: stringcapacityVarianceAccount?: string- companyId?: number+ companyId?: stringcostOfGoodsSoldAccount?: stringcustomerPaymentDiscountAccount?: stringdirectCostAppliedAccount?: string@@ -1116,7 +1116,7 @@ export type Database = {Row: {closedAt: string | nullclosedBy: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringendDate: string@@ -1129,7 +1129,7 @@ export type Database = {Insert: {closedAt?: string | nullclosedBy?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringendDate: string@@ -1142,7 +1142,7 @@ export type Database = {Update: {closedAt?: string | nullclosedBy?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringendDate?: string@@ -1365,7 +1365,7 @@ export type Database = {addressLine1: string | nulladdressLine2: string | nullcity: string | null- companyId: number+ companyId: stringcountryCode: number | nullfax: string | nullid: string@@ -1377,7 +1377,7 @@ export type Database = {addressLine1?: string | nulladdressLine2?: string | nullcity?: string | null- companyId: number+ companyId: stringcountryCode?: number | nullfax?: string | nullid?: string@@ -1389,7 +1389,7 @@ export type Database = {addressLine1?: string | nulladdressLine2?: string | nullcity?: string | null- companyId?: number+ companyId?: stringcountryCode?: number | nullfax?: string | nullid?: string@@ -1462,7 +1462,7 @@ export type Database = {countryCode: string | nullemail: string | nullfax: string | null- id: number+ id: stringlogo: string | nullname: stringphone: string | null@@ -1479,7 +1479,7 @@ export type Database = {countryCode?: string | nullemail?: string | nullfax?: string | null- id?: number+ id?: stringlogo?: string | nullname: stringphone?: string | null@@ -1496,7 +1496,7 @@ export type Database = {countryCode?: string | nullemail?: string | nullfax?: string | null- id?: number+ id?: stringlogo?: string | nullname?: stringphone?: string | null@@ -1543,7 +1543,7 @@ export type Database = {addressLine2: string | nullbirthday: string | nullcity: string | null- companyId: number+ companyId: stringcountryCode: number | nullemail: stringfax: string | null@@ -1564,7 +1564,7 @@ export type Database = {addressLine2?: string | nullbirthday?: string | nullcity?: string | null- companyId: number+ companyId: stringcountryCode?: number | nullemail: stringfax?: string | null@@ -1585,7 +1585,7 @@ export type Database = {addressLine2?: string | nullbirthday?: string | nullcity?: string | null- companyId?: number+ companyId?: stringcountryCode?: number | nullemail?: stringfax?: string | null@@ -1628,7 +1628,7 @@ export type Database = {contractor: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -1639,7 +1639,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -1650,7 +1650,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -1813,7 +1813,7 @@ export type Database = {costLedger: {Row: {adjustment: boolean- companyId: number+ companyId: stringcost: numbercostLedgerType: Database["public"]["Enums"]["costLedgerType"]costPostedToGL: number@@ -1832,7 +1832,7 @@ export type Database = {}Insert: {adjustment?: boolean- companyId: number+ companyId: stringcost?: numbercostLedgerType: Database["public"]["Enums"]["costLedgerType"]costPostedToGL?: number@@ -1851,7 +1851,7 @@ export type Database = {}Update: {adjustment?: boolean- companyId?: number+ companyId?: stringcost?: numbercostLedgerType?: Database["public"]["Enums"]["costLedgerType"]costPostedToGL?: number@@ -1905,7 +1905,7 @@ export type Database = {}crew: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcrewLeaderId: string | null@@ -1918,7 +1918,7 @@ export type Database = {workCellId: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcrewLeaderId?: string | null@@ -1931,7 +1931,7 @@ export type Database = {workCellId?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcrewLeaderId?: string | null@@ -2084,7 +2084,7 @@ export type Database = {Row: {active: booleancode: string- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -2100,7 +2100,7 @@ export type Database = {Insert: {active?: booleancode: string- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -2116,7 +2116,7 @@ export type Database = {Update: {active?: booleancode?: string- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -2178,7 +2178,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: string | nullcustomerStatusId: string | null@@ -2194,7 +2194,7 @@ export type Database = {Insert: {accountManagerId?: string | nullassignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy?: string | nullcustomerStatusId?: string | null@@ -2210,7 +2210,7 @@ export type Database = {Update: {accountManagerId?: string | nullassignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: string | nullcustomerStatusId?: string | null@@ -2368,17 +2368,17 @@ export type Database = {}customerAccount: {Row: {- companyId: number+ companyId: stringcustomerId: stringid: string}Insert: {- companyId: number+ companyId: stringcustomerId: stringid: string}Update: {- companyId?: number+ companyId?: stringcustomerId?: stringid?: string}@@ -2591,7 +2591,7 @@ export type Database = {}customerPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: string | nullcustomerId: stringinvoiceCustomerContactId: string | null@@ -2602,7 +2602,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: string | nullcustomerId: stringinvoiceCustomerContactId?: string | null@@ -2613,7 +2613,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: string | nullcustomerId?: stringinvoiceCustomerContactId?: string | null@@ -2740,7 +2740,7 @@ export type Database = {}customerShipping: {Row: {- companyId: number+ companyId: stringcustomerId: stringshippingCustomerContactId: string | nullshippingCustomerId: string | null@@ -2751,7 +2751,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomerId: stringshippingCustomerContactId?: string | nullshippingCustomerId?: string | null@@ -2762,7 +2762,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomerId?: stringshippingCustomerContactId?: string | nullshippingCustomerId?: string | null@@ -2889,7 +2889,7 @@ export type Database = {}customerStatus: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -2899,7 +2899,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -2909,7 +2909,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -2993,7 +2993,7 @@ export type Database = {}customerType: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -3004,7 +3004,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -3015,7 +3015,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3101,7 +3101,7 @@ export type Database = {customField: {Row: {active: boolean | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFieldTableId: string@@ -3115,7 +3115,7 @@ export type Database = {}Insert: {active?: boolean | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFieldTableId: string@@ -3129,7 +3129,7 @@ export type Database = {}Update: {active?: boolean | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFieldTableId?: string@@ -3237,21 +3237,21 @@ export type Database = {}customFieldTable: {Row: {- companyId: number+ companyId: stringid: stringmodule: Database["public"]["Enums"]["module"]name: stringtable: string}Insert: {- companyId: number+ companyId: stringid?: stringmodule: Database["public"]["Enums"]["module"]name: stringtable: string}Update: {- companyId?: number+ companyId?: stringid?: stringmodule?: Database["public"]["Enums"]["module"]name?: string@@ -3276,7 +3276,7 @@ export type Database = {}department: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -3287,7 +3287,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -3298,7 +3298,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3335,7 +3335,7 @@ export type Database = {document: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringdescription: string | null@@ -3356,7 +3356,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringdescription?: string | null@@ -3377,7 +3377,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringdescription?: string | null@@ -3643,17 +3643,17 @@ export type Database = {}employee: {Row: {- companyId: number+ companyId: stringemployeeTypeId: stringid: string}Insert: {- companyId: number+ companyId: stringemployeeTypeId: stringid: string}Update: {- companyId?: number+ companyId?: stringemployeeTypeId?: stringid?: string}@@ -3749,7 +3749,7 @@ export type Database = {}employeeJob: {Row: {- companyId: number+ companyId: stringcustomFields: Json | nulldepartmentId: string | nullid: string@@ -3763,7 +3763,7 @@ export type Database = {workCellId: string | null}Insert: {- companyId: number+ companyId: stringcustomFields?: Json | nulldepartmentId?: string | nullid: string@@ -3777,7 +3777,7 @@ export type Database = {workCellId?: string | null}Update: {- companyId?: number+ companyId?: stringcustomFields?: Json | nulldepartmentId?: string | nullid?: string@@ -4010,7 +4010,7 @@ export type Database = {}employeeType: {Row: {- companyId: number+ companyId: stringcreatedAt: stringid: stringname: string@@ -4018,7 +4018,7 @@ export type Database = {updatedAt: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringid?: stringname: string@@ -4026,7 +4026,7 @@ export type Database = {updatedAt?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringid?: stringname?: string@@ -4052,34 +4052,34 @@ export type Database = {}employeeTypePermission: {Row: {- create: number[]+ create: string[]createdAt: string- delete: number[]+ delete: string[]employeeTypeId: stringmodule: Database["public"]["Enums"]["module"]- update: number[]+ update: string[]updatedAt: string | null- view: number[]+ view: string[]}Insert: {- create?: number[]+ create?: string[]createdAt?: string- delete?: number[]+ delete?: string[]employeeTypeId: stringmodule: Database["public"]["Enums"]["module"]- update?: number[]+ update?: string[]updatedAt?: string | null- view?: number[]+ view?: string[]}Update: {- create?: number[]+ create?: string[]createdAt?: string- delete?: number[]+ delete?: string[]employeeTypeId?: stringmodule?: Database["public"]["Enums"]["module"]- update?: number[]+ update?: string[]updatedAt?: string | null- view?: number[]+ view?: string[]}Relationships: [{@@ -4095,7 +4095,7 @@ export type Database = {Row: {active: booleanactiveDate: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4113,7 +4113,7 @@ export type Database = {Insert: {active?: booleanactiveDate?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4131,7 +4131,7 @@ export type Database = {Update: {active?: booleanactiveDate?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4264,7 +4264,7 @@ export type Database = {equipmentType: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4278,7 +4278,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4292,7 +4292,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4386,19 +4386,19 @@ export type Database = {}fiscalYearSettings: {Row: {- companyId: number+ companyId: stringstartMonth: Database["public"]["Enums"]["month"]taxStartMonth: Database["public"]["Enums"]["month"]updatedBy: string}Insert: {- companyId: number+ companyId: stringstartMonth?: Database["public"]["Enums"]["month"]taxStartMonth?: Database["public"]["Enums"]["month"]updatedBy: string}Update: {- companyId?: number+ companyId?: stringstartMonth?: Database["public"]["Enums"]["month"]taxStartMonth?: Database["public"]["Enums"]["month"]updatedBy?: string@@ -4450,7 +4450,7 @@ export type Database = {}group: {Row: {- companyId: number | null+ companyId: string | nullcreatedAt: stringid: stringisCustomerOrgGroup: boolean@@ -4463,7 +4463,7 @@ export type Database = {updatedAt: string | null}Insert: {- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringid?: stringisCustomerOrgGroup?: boolean@@ -4476,7 +4476,7 @@ export type Database = {updatedAt?: string | null}Update: {- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringid?: stringisCustomerOrgGroup?: boolean@@ -4507,7 +4507,7 @@ export type Database = {}holiday: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4519,7 +4519,7 @@ export type Database = {year: number | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4531,7 +4531,7 @@ export type Database = {year?: number | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4618,7 +4618,7 @@ export type Database = {integration: {Row: {active: boolean- companyId: number+ companyId: stringdescription: string | nullid: stringjsonschema: Json@@ -4631,7 +4631,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringdescription?: string | nullid: stringjsonschema: Json@@ -4644,7 +4644,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringdescription?: string | nullid?: stringjsonschema?: Json@@ -4689,7 +4689,7 @@ export type Database = {journal: {Row: {accountingPeriodId: string | null- companyId: number+ companyId: stringcreatedAt: stringcustomFields: Json | nulldescription: string | null@@ -4698,7 +4698,7 @@ export type Database = {}Insert: {accountingPeriodId?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4707,7 +4707,7 @@ export type Database = {}Update: {accountingPeriodId?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4743,7 +4743,7 @@ export type Database = {accountNumber: stringaccrual: booleanamount: number- companyId: number+ companyId: stringcreatedAt: stringcustomFields: Json | nulldescription: string | null@@ -4762,7 +4762,7 @@ export type Database = {accountNumber: stringaccrual?: booleanamount: number- companyId: number+ companyId: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4781,7 +4781,7 @@ export type Database = {accountNumber?: stringaccrual?: booleanamount?: number- companyId?: number+ companyId?: stringcreatedAt?: stringcustomFields?: Json | nulldescription?: string | null@@ -4832,7 +4832,7 @@ export type Database = {addressLine1: stringaddressLine2: string | nullcity: string- companyId: number+ companyId: stringcountryCode: string | nullcreatedAt: stringcreatedBy: string@@ -4851,7 +4851,7 @@ export type Database = {addressLine1: stringaddressLine2?: string | nullcity: string- companyId: number+ companyId: stringcountryCode?: string | nullcreatedAt?: stringcreatedBy: string@@ -4870,7 +4870,7 @@ export type Database = {addressLine1?: stringaddressLine2?: string | nullcity?: string- companyId?: number+ companyId?: stringcountryCode?: string | nullcreatedAt?: stringcreatedBy?: string@@ -4969,7 +4969,7 @@ export type Database = {note: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringdocumentId: string@@ -4980,7 +4980,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringdocumentId: string@@ -4991,7 +4991,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringdocumentId?: string@@ -5052,7 +5052,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5075,7 +5075,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5098,7 +5098,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5260,7 +5260,7 @@ export type Database = {}partCost: {Row: {- companyId: number+ companyId: stringcostingMethod: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted: booleancreatedAt: string@@ -5273,7 +5273,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcostingMethod: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted?: booleancreatedAt?: string@@ -5286,7 +5286,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcostingMethod?: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted?: booleancreatedAt?: string@@ -5395,7 +5395,7 @@ export type Database = {partGroup: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5407,7 +5407,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5419,7 +5419,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5504,7 +5504,7 @@ export type Database = {}partInventory: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5515,7 +5515,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5526,7 +5526,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5667,7 +5667,7 @@ export type Database = {}partLedger: {Row: {- companyId: number+ companyId: stringcreatedAt: stringdocumentId: string | nulldocumentType:@@ -5684,7 +5684,7 @@ export type Database = {shelfId: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -5701,7 +5701,7 @@ export type Database = {shelfId?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -5794,7 +5794,7 @@ export type Database = {Row: {abilityId: stringactive: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5806,7 +5806,7 @@ export type Database = {Insert: {abilityId: stringactive?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5818,7 +5818,7 @@ export type Database = {Update: {abilityId?: stringactive?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5916,7 +5916,7 @@ export type Database = {}partPlanning: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcritical: boolean@@ -5939,7 +5939,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcritical?: boolean@@ -5962,7 +5962,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcritical?: boolean@@ -6108,7 +6108,7 @@ export type Database = {}partReplenishment: {Row: {- companyId: number+ companyId: stringconversionFactor: numbercreatedAt: stringcreatedBy: string@@ -6128,7 +6128,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringconversionFactor?: numbercreatedAt?: stringcreatedBy: string@@ -6148,7 +6148,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringconversionFactor?: numbercreatedAt?: stringcreatedBy?: string@@ -6306,7 +6306,7 @@ export type Database = {partSupplier: {Row: {active: boolean- companyId: number+ companyId: stringconversionFactor: numbercreatedAt: stringcreatedBy: string@@ -6323,7 +6323,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringconversionFactor?: numbercreatedAt?: stringcreatedBy: string@@ -6340,7 +6340,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringconversionFactor?: numbercreatedAt?: stringcreatedBy?: string@@ -6487,7 +6487,7 @@ export type Database = {partUnitSalePrice: {Row: {allowInvoiceDiscount: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -6502,7 +6502,7 @@ export type Database = {}Insert: {allowInvoiceDiscount?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -6517,7 +6517,7 @@ export type Database = {}Update: {allowInvoiceDiscount?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -6642,7 +6642,7 @@ export type Database = {Row: {active: booleancalculationMethod: Database["public"]["Enums"]["paymentTermCalculationMethod"]- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -6657,7 +6657,7 @@ export type Database = {Insert: {active?: booleancalculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"]- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -6672,7 +6672,7 @@ export type Database = {Update: {active?: booleancalculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"]- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -6760,7 +6760,7 @@ export type Database = {postingGroupInventory: {Row: {capacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringdirectCostAppliedAccount: stringid: string@@ -6781,7 +6781,7 @@ export type Database = {}Insert: {capacityVarianceAccount: string- companyId: number+ companyId: stringcostOfGoodsSoldAccount: stringdirectCostAppliedAccount: stringid?: string@@ -6802,7 +6802,7 @@ export type Database = {}Update: {capacityVarianceAccount?: string- companyId?: number+ companyId?: stringcostOfGoodsSoldAccount?: stringdirectCostAppliedAccount?: stringid?: string@@ -7085,7 +7085,7 @@ export type Database = {}postingGroupPurchasing: {Row: {- companyId: number+ companyId: stringid: stringpartGroupId: string | nullpayablesAccount: string@@ -7098,7 +7098,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringid?: stringpartGroupId?: string | nullpayablesAccount: string@@ -7111,7 +7111,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringid?: stringpartGroupId?: string | nullpayablesAccount?: string@@ -7268,7 +7268,7 @@ export type Database = {}postingGroupSales: {Row: {- companyId: number+ companyId: stringcustomerTypeId: string | nullid: stringpartGroupId: string | null@@ -7281,7 +7281,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomerTypeId?: string | nullid?: stringpartGroupId?: string | null@@ -7294,7 +7294,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomerTypeId?: string | nullid?: stringpartGroupId?: string | null@@ -7453,7 +7453,7 @@ export type Database = {Row: {assignee: string | nullbalance: number- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -7482,7 +7482,7 @@ export type Database = {Insert: {assignee?: string | nullbalance?: number- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -7511,7 +7511,7 @@ export type Database = {Update: {assignee?: string | nullbalance?: number- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -7740,7 +7740,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number+ companyId: stringconversionFactor: number | nullcreatedAt: stringcreatedBy: string@@ -7768,7 +7768,7 @@ export type Database = {Insert: {accountNumber?: string | nullassetId?: string | null- companyId: number+ companyId: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy: string@@ -7796,7 +7796,7 @@ export type Database = {Update: {accountNumber?: string | nullassetId?: string | null- companyId?: number+ companyId?: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy?: string@@ -8212,7 +8212,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -8234,7 +8234,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -8256,7 +8256,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -8454,7 +8454,7 @@ export type Database = {}purchaseOrderDelivery: {Row: {- companyId: number+ companyId: stringcustomerId: string | nullcustomerLocationId: string | nullcustomFields: Json | null@@ -8472,7 +8472,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -8490,7 +8490,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -8698,7 +8698,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number+ companyId: stringconversionFactor: number | nullcreatedAt: stringcreatedBy: string@@ -8729,7 +8729,7 @@ export type Database = {Insert: {accountNumber?: string | nullassetId?: string | null- companyId: number+ companyId: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy: string@@ -8760,7 +8760,7 @@ export type Database = {Update: {accountNumber?: string | nullassetId?: string | null- companyId?: number+ companyId?: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy?: string@@ -8940,7 +8940,7 @@ export type Database = {}purchaseOrderPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: stringcustomFields: Json | nullid: string@@ -8953,7 +8953,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: stringcustomFields?: Json | nullid: string@@ -8966,7 +8966,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: stringcustomFields?: Json | nullid?: string@@ -9215,7 +9215,7 @@ export type Database = {}purchasePayment: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -9230,7 +9230,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -9245,7 +9245,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -9377,7 +9377,7 @@ export type Database = {quote: {Row: {assignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomerContactId: string | null@@ -9399,7 +9399,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomerContactId?: string | null@@ -9421,7 +9421,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomerContactId?: string | null@@ -9607,7 +9607,7 @@ export type Database = {}quoteAssembly: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -9623,7 +9623,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -9639,7 +9639,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -9864,7 +9864,7 @@ export type Database = {}quoteLine: {Row: {- companyId: number+ companyId: stringcreatedBy: stringcustomerPartId: string | nullcustomerPartRevision: string | null@@ -9881,7 +9881,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedBy: stringcustomerPartId?: string | nullcustomerPartRevision?: string | null@@ -9898,7 +9898,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedBy?: stringcustomerPartId?: string | nullcustomerPartRevision?: string | null@@ -10178,7 +10178,7 @@ export type Database = {}quoteMaterial: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -10195,7 +10195,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -10212,7 +10212,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -10373,7 +10373,7 @@ export type Database = {}quoteOperation: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -10394,7 +10394,7 @@ export type Database = {workCellTypeId: string}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -10415,7 +10415,7 @@ export type Database = {workCellTypeId: string}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -10567,7 +10567,7 @@ export type Database = {receipt: {Row: {assignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -10589,7 +10589,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -10611,7 +10611,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -10797,7 +10797,7 @@ export type Database = {}receiptLine: {Row: {- companyId: number+ companyId: stringconversionFactor: number | nullcreatedAt: stringcreatedBy: string@@ -10816,7 +10816,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy: string@@ -10835,7 +10835,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringconversionFactor?: number | nullcreatedAt?: stringcreatedBy?: string@@ -10985,7 +10985,7 @@ export type Database = {requestForQuote: {Row: {assignee: string | null- companyId: number+ companyId: stringcreatedAt: string | nullcreatedBy: stringcustomFields: Json | null@@ -11003,7 +11003,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcreatedAt?: string | nullcreatedBy: stringcustomFields?: Json | null@@ -11021,7 +11021,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: string | nullcreatedBy?: stringcustomFields?: Json | null@@ -11226,7 +11226,7 @@ export type Database = {}requestForQuoteLine: {Row: {- companyId: number+ companyId: stringcreatedAt: string | nullcreatedBy: stringcustomFields: Json | null@@ -11243,7 +11243,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: string | nullcreatedBy: stringcustomFields?: Json | null@@ -11260,7 +11260,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: string | nullcreatedBy?: stringcustomFields?: Json | null@@ -11724,7 +11724,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -11747,7 +11747,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcurrencyCode?: string@@ -11770,7 +11770,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -12043,7 +12043,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -12072,7 +12072,7 @@ export type Database = {Insert: {accountNumber?: string | nullassetId?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -12101,7 +12101,7 @@ export type Database = {Update: {accountNumber?: string | nullassetId?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -12265,7 +12265,7 @@ export type Database = {}salesOrderPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: stringcustomFields: Json | nullid: string@@ -12278,7 +12278,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: stringcustomFields?: Json | nullid: string@@ -12291,7 +12291,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: stringcustomFields?: Json | nullid?: string@@ -12386,7 +12386,7 @@ export type Database = {salesOrderShipment: {Row: {assignee: string | null- companyId: number+ companyId: stringcustomerId: string | nullcustomerLocationId: string | nullcustomFields: Json | null@@ -12407,7 +12407,7 @@ export type Database = {}Insert: {assignee?: string | null- companyId: number+ companyId: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -12428,7 +12428,7 @@ export type Database = {}Update: {assignee?: string | null- companyId?: number+ companyId?: stringcustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -12740,7 +12740,7 @@ export type Database = {}search: {Row: {- companyId: number+ companyId: stringdescription: string | nullentity: Database["public"]["Enums"]["searchEntity"] | nullfts: unknown | null@@ -12750,7 +12750,7 @@ export type Database = {uuid: string | null}Insert: {- companyId: number+ companyId: stringdescription?: string | nullentity?: Database["public"]["Enums"]["searchEntity"] | nullfts?: unknown | null@@ -12760,7 +12760,7 @@ export type Database = {uuid?: string | null}Update: {- companyId?: number+ companyId?: stringdescription?: string | nullentity?: Database["public"]["Enums"]["searchEntity"] | nullfts?: unknown | null@@ -12788,7 +12788,7 @@ export type Database = {}sequence: {Row: {- companyId: number+ companyId: stringid: stringname: stringnext: number@@ -12801,7 +12801,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringid?: stringname: stringnext?: number@@ -12814,7 +12814,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringid?: stringname?: stringnext?: number@@ -12878,7 +12878,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -12898,7 +12898,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -12918,7 +12918,7 @@ export type Database = {approvedBy?: string | nullassignee?: string | nullblocked?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13071,7 +13071,7 @@ export type Database = {serviceSupplier: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13084,7 +13084,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13097,7 +13097,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13233,7 +13233,7 @@ export type Database = {shelf: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13245,7 +13245,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13257,7 +13257,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13378,7 +13378,7 @@ export type Database = {shift: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13399,7 +13399,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13420,7 +13420,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13545,7 +13545,7 @@ export type Database = {active: booleancarrier: Database["public"]["Enums"]["shippingCarrier"]carrierAccountId: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -13559,7 +13559,7 @@ export type Database = {active?: booleancarrier?: Database["public"]["Enums"]["shippingCarrier"]carrierAccountId?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -13573,7 +13573,7 @@ export type Database = {active?: booleancarrier?: Database["public"]["Enums"]["shippingCarrier"]carrierAccountId?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -13673,7 +13673,7 @@ export type Database = {shippingTerm: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringid: string@@ -13683,7 +13683,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringid?: string@@ -13693,7 +13693,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringid?: string@@ -13778,7 +13778,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: string | nullcustomFields: Json | null@@ -13794,7 +13794,7 @@ export type Database = {Insert: {accountManagerId?: string | nullassignee?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy?: string | nullcustomFields?: Json | null@@ -13810,7 +13810,7 @@ export type Database = {Update: {accountManagerId?: string | nullassignee?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: string | nullcustomFields?: Json | null@@ -13968,17 +13968,17 @@ export type Database = {}supplierAccount: {Row: {- companyId: number+ companyId: stringid: stringsupplierId: string}Insert: {- companyId: number+ companyId: stringid: stringsupplierId: string}Update: {- companyId?: number+ companyId?: stringid?: stringsupplierId?: string}@@ -14170,7 +14170,7 @@ export type Database = {supplierLedger: {Row: {amount: number- companyId: number+ companyId: stringcreatedAt: stringdocumentId: string | nulldocumentType:@@ -14184,7 +14184,7 @@ export type Database = {}Insert: {amount: number- companyId: number+ companyId: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -14198,7 +14198,7 @@ export type Database = {}Update: {amount?: number- companyId?: number+ companyId?: stringcreatedAt?: stringdocumentId?: string | nulldocumentType?:@@ -14328,7 +14328,7 @@ export type Database = {}supplierPayment: {Row: {- companyId: number+ companyId: stringcurrencyCode: string | nullcustomFields: Json | nullinvoiceSupplierContactId: string | null@@ -14340,7 +14340,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcurrencyCode?: string | nullcustomFields?: Json | nullinvoiceSupplierContactId?: string | null@@ -14352,7 +14352,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcurrencyCode?: string | nullcustomFields?: Json | nullinvoiceSupplierContactId?: string | null@@ -14508,7 +14508,7 @@ export type Database = {}supplierShipping: {Row: {- companyId: number+ companyId: stringcustomFields: Json | nullshippingMethodId: string | nullshippingSupplierContactId: string | null@@ -14520,7 +14520,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcustomFields?: Json | nullshippingMethodId?: string | nullshippingSupplierContactId?: string | null@@ -14532,7 +14532,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcustomFields?: Json | nullshippingMethodId?: string | nullshippingSupplierContactId?: string | null@@ -14688,7 +14688,7 @@ export type Database = {}supplierStatus: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14698,7 +14698,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14708,7 +14708,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -14792,7 +14792,7 @@ export type Database = {}supplierType: {Row: {- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14803,7 +14803,7 @@ export type Database = {updatedBy: string | null}Insert: {- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14814,7 +14814,7 @@ export type Database = {updatedBy?: string | null}Update: {- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -14901,7 +14901,7 @@ export type Database = {Row: {active: booleancode: string- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14913,7 +14913,7 @@ export type Database = {Insert: {active?: booleancode: string- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14925,7 +14925,7 @@ export type Database = {Update: {active?: booleancode?: string- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -15168,7 +15168,7 @@ export type Database = {userAttributeCategory: {Row: {active: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: stringcreatedBy: stringid: string@@ -15180,7 +15180,7 @@ export type Database = {}Insert: {active?: boolean | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringcreatedBy: stringid?: string@@ -15192,7 +15192,7 @@ export type Database = {}Update: {active?: boolean | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: stringcreatedBy?: stringid?: string@@ -15442,15 +15442,15 @@ export type Database = {}userToCompany: {Row: {- companyId: number+ companyId: stringuserId: string}Insert: {- companyId: number+ companyId: stringuserId: string}Update: {- companyId?: number+ companyId?: stringuserId?: string}Relationships: [@@ -15501,7 +15501,7 @@ export type Database = {warehouse: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringid: string@@ -15517,7 +15517,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringid?: string@@ -15533,7 +15533,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringid?: string@@ -15652,7 +15652,7 @@ export type Database = {Row: {active: booleanactiveDate: string | null- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -15669,7 +15669,7 @@ export type Database = {Insert: {active?: booleanactiveDate?: string | null- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -15686,7 +15686,7 @@ export type Database = {Update: {active?: booleanactiveDate?: string | null- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -15818,7 +15818,7 @@ export type Database = {workCellType: {Row: {active: boolean- companyId: number+ companyId: stringcreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -15835,7 +15835,7 @@ export type Database = {}Insert: {active?: boolean- companyId: number+ companyId: stringcreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -15852,7 +15852,7 @@ export type Database = {}Update: {active?: boolean- companyId?: number+ companyId?: stringcreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -15953,7 +15953,7 @@ export type Database = {Row: {category: string | nullclass: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -15966,7 +15966,7 @@ export type Database = {Insert: {category?: string | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: string | nullcreatedBy?: string | nullcustomFields?: Json | null@@ -15979,7 +15979,7 @@ export type Database = {Update: {category?: string | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullcreatedAt?: string | nullcreatedBy?: string | nullcustomFields?: Json | null@@ -16070,7 +16070,7 @@ export type Database = {accountSubcategoryId: string | nullactive: boolean | nullclass: Database["public"]["Enums"]["glAccountClass"] | null- companyId: number | null+ companyId: string | nullconsolidatedRate:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -16093,7 +16093,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: boolean | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -16116,7 +16116,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: boolean | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null- companyId?: number | null+ companyId?: string | nullconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -16224,12 +16224,12 @@ export type Database = {addressLine1: string | nulladdressLine2: string | nullcity: string | null- companyId: number | null+ companyId: string | nullcountryCode: string | nullemail: string | nullemployeeType: string | nullfax: string | null- id: number | null+ id: string | nulllogo: string | nullname: string | nullphone: string | null@@ -16317,7 +16317,7 @@ export type Database = {Row: {abilityIds: string[] | nullactive: boolean | null- companyId: number | null+ companyId: string | nullcustomFields: Json | nullemail: string | nullfirstName: string | null@@ -16355,7 +16355,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomerStatusId: string | null@@ -16516,7 +16516,7 @@ export type Database = {}customFieldTables: {Row: {- companyId: number | null+ companyId: string | nullfields: Json | nullid: string | nullmodule: Database["public"]["Enums"]["module"] | null@@ -16585,7 +16585,7 @@ export type Database = {documents: {Row: {active: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nulldescription: string | null@@ -16670,7 +16670,7 @@ export type Database = {Row: {active: boolean | nullavatarUrl: string | null- companyId: number | null+ companyId: string | nullemail: string | nullemployeeTypeId: string | nullfirstName: string | null@@ -16705,7 +16705,7 @@ export type Database = {employeeSummary: {Row: {avatarUrl: string | null- companyId: number | null+ companyId: string | nulldepartmentName: string | nullid: string | nulllocationName: string | null@@ -16733,7 +16733,7 @@ export type Database = {}groupMembers: {Row: {- companyId: number | null+ companyId: string | nullgroupId: string | nullid: number | nullisCustomerOrgGroup: boolean | null@@ -16808,7 +16808,7 @@ export type Database = {}groups: {Row: {- companyId: number | null+ companyId: string | nullid: string | nullisCustomerOrgGroup: boolean | nullisCustomerTypeGroup: boolean | null@@ -16823,7 +16823,7 @@ export type Database = {}groups_recursive: {Row: {- companyId: number | null+ companyId: string | nullgroupId: string | nullisCustomerOrgGroup: boolean | nullisCustomerTypeGroup: boolean | null@@ -16839,7 +16839,7 @@ export type Database = {}holidayYears: {Row: {- companyId: number | null+ companyId: string | nullyear: number | null}Relationships: [@@ -16871,7 +16871,7 @@ export type Database = {abilityName: string | nullactive: boolean | nullcity: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -16980,7 +16980,7 @@ export type Database = {}partQuantities: {Row: {- companyId: number | null+ companyId: string | nulllocationId: string | nullpartId: string | nullquantityAvailable: number | null@@ -17013,7 +17013,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -17181,7 +17181,7 @@ export type Database = {Row: {assignee: string | nullbalance: number | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcurrencyCode: string | null@@ -17395,7 +17395,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number | null+ companyId: string | nullconversionFactor: number | nullcreatedAt: string | nullcreatedBy: string | null@@ -17665,7 +17665,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -17872,7 +17872,7 @@ export type Database = {}purchaseOrderSuppliers: {Row: {- companyId: number | null+ companyId: string | nullid: string | nullname: string | null}@@ -17916,7 +17916,7 @@ export type Database = {}quoteLines: {Row: {- companyId: number | null+ companyId: string | nullcreatedBy: string | nullcustomerPartId: string | nullcustomerPartRevision: string | null@@ -18063,7 +18063,7 @@ export type Database = {quotes: {Row: {assignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomerContactId: string | null@@ -18253,7 +18253,7 @@ export type Database = {receipts: {Row: {assignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -18441,7 +18441,7 @@ export type Database = {requestForQuotes: {Row: {assignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -18592,7 +18592,7 @@ export type Database = {}salesOrderCustomers: {Row: {- companyId: number | null+ companyId: string | nullid: string | nullname: string | null}@@ -18617,7 +18617,7 @@ export type Database = {Row: {accountNumber: string | nullassetId: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomerId: string | null@@ -18812,7 +18812,7 @@ export type Database = {closedBy: string | nullclosedByAvatar: string | nullclosedByFullName: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcreatedByAvatar: string | null@@ -19044,7 +19044,7 @@ export type Database = {approvedBy: string | nullassignee: string | nullblocked: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -19199,7 +19199,7 @@ export type Database = {shifts: {Row: {active: boolean | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -19324,7 +19324,7 @@ export type Database = {Row: {accountManagerId: string | nullassignee: string | null- companyId: number | null+ companyId: string | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -19486,7 +19486,7 @@ export type Database = {}userDefaults: {Row: {- companyId: number | null+ companyId: string | nulllocationId: string | nulluserId: string | null}@@ -19552,7 +19552,7 @@ export type Database = {foreign_key: stringtbl: string}- Returns: number+ Returns: string}get_my_claim: {Args: {@@ -19570,19 +19570,13 @@ export type Database = {Args: {claim: string}- Returns: unknown- }- get_permission_companies_as_text: {- Args: {- claim: string- }- Returns: unknown+ Returns: string[]}groups_for_user: {Args: {uid: string}- Returns: unknown+ Returns: string[]}groups_query: {Args: {@@ -19592,7 +19586,7 @@ export type Database = {Returns: {id: stringname: string- companyId: number+ companyId: stringparentId: stringisEmployeeTypeGroup: booleanisCustomerOrgGroup: boolean@@ -19611,7 +19605,7 @@ export type Database = {has_company_permission: {Args: {claim: string- company: number+ company: string}Returns: boolean}@@ -19632,23 +19626,17 @@ export type Database = {}Returns: {number: string- companyId: number+ companyId: stringbalance: numberbalanceAtDate: numbernetChange: number}[]}- jsonb_to_integer_array: {- Args: {- "": Json- }- Returns: unknown- }jsonb_to_text_array: {Args: {"": Json}- Returns: unknown+ Returns: string[]}users_for_groups: {Args: {@@ -19672,7 +19660,7 @@ export type Database = {Args: {_xid: unknown}- Returns: unknown+ Returns: number[]}xid_encode: {Args: {@@ -19684,7 +19672,7 @@ export type Database = {Args: {_xid: unknown}- Returns: unknown+ Returns: number[]}xid_pid: {Args: {@@ -20067,6 +20055,101 @@ export type Database = {},]}+ s3_multipart_uploads: {+ Row: {+ bucket_id: string+ created_at: string+ id: string+ in_progress_size: number+ key: string+ owner_id: string | null+ upload_signature: string+ version: string+ }+ Insert: {+ bucket_id: string+ created_at?: string+ id: string+ in_progress_size?: number+ key: string+ owner_id?: string | null+ upload_signature: string+ version: string+ }+ Update: {+ bucket_id?: string+ created_at?: string+ id?: string+ in_progress_size?: number+ key?: string+ owner_id?: string | null+ upload_signature?: string+ version?: string+ }+ Relationships: [+ {+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"+ columns: ["bucket_id"]+ isOneToOne: false+ referencedRelation: "buckets"+ referencedColumns: ["id"]+ },+ ]+ }+ s3_multipart_uploads_parts: {+ Row: {+ bucket_id: string+ created_at: string+ etag: string+ id: string+ key: string+ owner_id: string | null+ part_number: number+ size: number+ upload_id: string+ version: string+ }+ Insert: {+ bucket_id: string+ created_at?: string+ etag: string+ id?: string+ key: string+ owner_id?: string | null+ part_number: number+ size?: number+ upload_id: string+ version: string+ }+ Update: {+ bucket_id?: string+ created_at?: string+ etag?: string+ id?: string+ key?: string+ owner_id?: string | null+ part_number?: number+ size?: number+ upload_id?: string+ version?: string+ }+ Relationships: [+ {+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"+ columns: ["bucket_id"]+ isOneToOne: false+ referencedRelation: "buckets"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"+ columns: ["upload_id"]+ isOneToOne: false+ referencedRelation: "s3_multipart_uploads"+ referencedColumns: ["id"]+ },+ ]+ }}Views: {[_ in never]: never@@ -20097,7 +20180,7 @@ export type Database = {Args: {name: string}- Returns: unknown+ Returns: string[]}get_size_by_bucket: {Args: Record<PropertyKey, never>@@ -20106,6 +20189,37 @@ export type Database = {bucket_id: string}[]}+ list_multipart_uploads_with_delimiter: {+ Args: {+ bucket_id: string+ prefix_param: string+ delimiter_param: string+ max_keys?: number+ next_key_token?: string+ next_upload_token?: string+ }+ Returns: {+ key: string+ id: string+ created_at: string+ }[]+ }+ list_objects_with_delimiter: {+ Args: {+ bucket_id: string+ prefix_param: string+ delimiter_param: string+ max_keys?: number+ start_after?: string+ next_token?: string+ }+ Returns: {+ name: string+ id: string+ metadata: Json+ updated_at: string+ }[]+ }search: {Args: {prefix: string@@ -20136,9 +20250,11 @@ export type Database = {}}+type PublicSchema = Database[Extract<keyof Database, "public">]+export type Tables<PublicTableNameOrOptions extends- | keyof (Database["public"]["Tables"] & Database["public"]["Views"])+ | keyof (PublicSchema["Tables"] & PublicSchema["Views"])| { schema: keyof Database },TableName extends PublicTableNameOrOptions extends { schema: keyof Database }? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &@@ -20151,10 +20267,10 @@ export type Tables<}? R: never- : PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] &- Database["public"]["Views"])- ? (Database["public"]["Tables"] &- Database["public"]["Views"])[PublicTableNameOrOptions] extends {+ : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &+ PublicSchema["Views"])+ ? (PublicSchema["Tables"] &+ PublicSchema["Views"])[PublicTableNameOrOptions] extends {Row: infer R}? R@@ -20163,7 +20279,7 @@ export type Tables<export type TablesInsert<PublicTableNameOrOptions extends- | keyof Database["public"]["Tables"]+ | keyof PublicSchema["Tables"]| { schema: keyof Database },TableName extends PublicTableNameOrOptions extends { schema: keyof Database }? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]@@ -20174,8 +20290,8 @@ export type TablesInsert<}? I: never- : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]- ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {Insert: infer I}? I@@ -20184,7 +20300,7 @@ export type TablesInsert<export type TablesUpdate<PublicTableNameOrOptions extends- | keyof Database["public"]["Tables"]+ | keyof PublicSchema["Tables"]| { schema: keyof Database },TableName extends PublicTableNameOrOptions extends { schema: keyof Database }? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]@@ -20195,8 +20311,8 @@ export type TablesUpdate<}? U: never- : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]- ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {Update: infer U}? U@@ -20205,14 +20321,14 @@ export type TablesUpdate<export type Enums<PublicEnumNameOrOptions extends- | keyof Database["public"]["Enums"]+ | keyof PublicSchema["Enums"]| { schema: keyof Database },EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]: never = never,> = PublicEnumNameOrOptions extends { schema: keyof Database }? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]- : PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]- ? Database["public"]["Enums"][PublicEnumNameOrOptions]+ : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]+ ? PublicSchema["Enums"][PublicEnumNameOrOptions]: neverdiff --git a/packages/database/supabase/functions/seed-company/index.ts b/packages/database/supabase/functions/seed-company/index.tsindex ec25d9035c..f1742da1e9 100644--- a/packages/database/supabase/functions/seed-company/index.ts+++ b/packages/database/supabase/functions/seed-company/index.ts@@ -36,7 +36,7 @@ serve(async (req: Request) => {try {if (!id) throw new Error("Payload is missing id");if (!userId) throw new Error("Payload is missing userId");- const companyId = Number(id);+ const companyId = id as string;const supabaseClient = getSupabaseServiceRole(req.headers.get("Authorization"));@@ -55,7 +55,10 @@ serve(async (req: Request) => {...g,id: g.id.replace(groupCompanyTemplate,- companyId.toString().padStart(12, "0")+ `${companyId.substring(0, 4)}-${companyId.substring(+ 4,+ 8+ )}-${companyId.substring(8, 20)}`),companyId,}))diff --git a/packages/database/supabase/migrations/20230123004206_claims.sql b/packages/database/supabase/migrations/20230123004206_claims.sqlindex d53600f5f5..73f1e13895 100644--- a/packages/database/supabase/migrations/20230123004206_claims.sql+++ b/packages/database/supabase/migrations/20230123004206_claims.sql@@ -15,7 +15,7 @@ CREATE OR REPLACE FUNCTION is_claims_admin() RETURNS "bool"return false; -- jwt expiredEND IF;- IF has_company_permission('update_users', 0) THEN+ IF has_company_permission('update_users', '0') THENreturn true; -- user has user_update set to trueELSEreturn false; -- user does NOT have user_update set to true@@ -53,31 +53,14 @@ CREATE OR REPLACE FUNCTION get_my_claim(claim text) RETURNS "jsonb"END;$$;-CREATE OR REPLACE FUNCTION jsonb_to_integer_array(jsonb) RETURNS integer[]- LANGUAGE "sql" IMMUTABLE- AS $$- SELECT array_agg(value::int) FROM jsonb_array_elements_text($1) AS t(value);-$$;-CREATE OR REPLACE FUNCTION jsonb_to_text_array(jsonb) RETURNS text[]LANGUAGE "sql" IMMUTABLEAS $$SELECT array_agg(value::text) FROM jsonb_array_elements_text($1) AS t(value);$$;-CREATE OR REPLACE FUNCTION get_permission_companies(claim text) RETURNS integer[]- LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = public- AS $$- DECLARE retval integer[];- BEGIN-- select jsonb_to_integer_array(coalesce(permissions->claim, '[]')) from public.user into retval where id = auth.uid()::text;- return retval;-- END;-$$;-CREATE OR REPLACE FUNCTION get_permission_companies_as_text(claim text) RETURNS text[]+CREATE OR REPLACE FUNCTION get_permission_companies(claim text) RETURNS text[]LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = publicAS $$DECLARE retval text[];@@ -101,19 +84,19 @@ CREATE OR REPLACE FUNCTION has_role(role text) RETURNS "bool"END;$$;-CREATE OR REPLACE FUNCTION has_company_permission(claim text, company integer) RETURNS "bool"+CREATE OR REPLACE FUNCTION has_company_permission(claim text, company text) RETURNS "bool"LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = publicAS $$DECLARE- permission_value integer[];+ permission_value text[];BEGIN-- TODO: (current_setting('request.jwt.claims', true)::jsonb)->'app_metadata'->claim- SELECT jsonb_to_integer_array(coalesce(permissions->claim, '[]')) INTO permission_value FROM public.user WHERE id = auth.uid()::text;+ SELECT jsonb_to_text_array(coalesce(permissions->claim, '[]')) INTO permission_value FROM public.user WHERE id = auth.uid()::text;IF permission_value IS NULL THENreturn false;- ELSIF 0 = ANY(permission_value::integer[]) THEN+ ELSIF '0' = ANY(permission_value::text[]) THENreturn true;- ELSIF company = ANY(permission_value::integer[]) THEN+ ELSIF company = ANY(permission_value::text[]) THENreturn true;ELSEreturn false;@@ -125,10 +108,10 @@ CREATE OR REPLACE FUNCTION has_any_company_permission(claim text) RETURNS "bool"LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = publicAS $$DECLARE- permission_value integer[];+ permission_value text[];BEGIN- SELECT jsonb_to_integer_array(coalesce(permissions->claim, '[]')) INTO permission_value FROM public.user WHERE id = auth.uid()::text;+ SELECT jsonb_to_text_array(coalesce(permissions->claim, '[]')) INTO permission_value FROM public.user WHERE id = auth.uid()::text;IF permission_value IS NULL THENreturn false;ELSIF array_length(permission_value, 1) > 0 THEN@@ -139,11 +122,11 @@ CREATE OR REPLACE FUNCTION has_any_company_permission(claim text) RETURNS "bool"END;$$;-CREATE OR REPLACE FUNCTION get_company_id_from_foreign_key(foreign_key TEXT, tbl TEXT) RETURNS integer+CREATE OR REPLACE FUNCTION get_company_id_from_foreign_key(foreign_key TEXT, tbl TEXT) RETURNS textLANGUAGE "plpgsql" SECURITY DEFINER SET search_path = publicAS $$DECLARE- company_id integer;+ company_id text;BEGINEXECUTE 'SELECT "companyId" FROM "' || tbl || '" WHERE id = $1' INTO company_id USING foreign_key;RETURN company_id;diff --git a/packages/database/supabase/migrations/20230123004317_companies.sql b/packages/database/supabase/migrations/20230123004317_companies.sqlindex bcf4706400..8b5b857d90 100644--- a/packages/database/supabase/migrations/20230123004317_companies.sql+++ b/packages/database/supabase/migrations/20230123004317_companies.sql@@ -1,5 +1,5 @@CREATE TABLE "company" (- "id" SERIAL PRIMARY KEY,+ "id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,"taxId" TEXT,"logo" TEXT,@@ -15,6 +15,7 @@ CREATE TABLE "company" ("website" TEXT,"updatedBy" TEXT,+ CONSTRAINT "company_pkey" PRIMARY KEY ("id"),CONSTRAINT "accountDefault_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));@@ -47,7 +48,7 @@ CREATE POLICY "Employees with settings_delete can delete company" ON "company"CREATE TABLE "userToCompany" ("userId" TEXT NOT NULL REFERENCES "user" ("id") ON UPDATE CASCADE ON DELETE CASCADE,- "companyId" INTEGER NOT NULL REFERENCES "company" ("id") ON UPDATE CASCADE ON DELETE CASCADE+ "companyId" TEXT NOT NULL REFERENCES "company" ("id") ON UPDATE CASCADE ON DELETE CASCADE);ALTER TABLE "userToCompany" ENABLE ROW LEVEL SECURITY;diff --git a/packages/database/supabase/migrations/20230123004339_employee-types.sql b/packages/database/supabase/migrations/20230123004339_employee-types.sqlindex ca9428e875..aa99dcc549 100644--- a/packages/database/supabase/migrations/20230123004339_employee-types.sql+++ b/packages/database/supabase/migrations/20230123004339_employee-types.sql@@ -4,7 +4,7 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";CREATE TABLE "employeeType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"protected" BOOLEAN NOT NULL DEFAULT false,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedAt" TIMESTAMP WITH TIME ZONE,diff --git a/packages/database/supabase/migrations/20230123004409_permissions.sql b/packages/database/supabase/migrations/20230123004409_permissions.sqlindex e268e3791d..d7ded14311 100644--- a/packages/database/supabase/migrations/20230123004409_permissions.sql+++ b/packages/database/supabase/migrations/20230123004409_permissions.sql@@ -23,10 +23,10 @@ CREATE VIEW "modules" ASCREATE TABLE "employeeTypePermission" ("employeeTypeId" TEXT NOT NULL,"module" module NOT NULL,- "create" INTEGER[] NOT NULL DEFAULT '{}',- "delete" INTEGER[] NOT NULL DEFAULT '{}',- "update" INTEGER[] NOT NULL DEFAULT '{}',- "view" INTEGER[] NOT NULL DEFAULT '{}',+ "create" TEXT[] NOT NULL DEFAULT '{}',+ "delete" TEXT[] NOT NULL DEFAULT '{}',+ "update" TEXT[] NOT NULL DEFAULT '{}',+ "view" TEXT[] NOT NULL DEFAULT '{}',"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedAt" TIMESTAMP WITH TIME ZONE,diff --git a/packages/database/supabase/migrations/20230123004436_employee.sql b/packages/database/supabase/migrations/20230123004436_employee.sqlindex bfd18b038d..1b2d455056 100644--- a/packages/database/supabase/migrations/20230123004436_employee.sql+++ b/packages/database/supabase/migrations/20230123004436_employee.sql@@ -1,6 +1,6 @@CREATE TABLE "employee" ("id" TEXT NOT NULL,- "companyId" INTEGER NULL,+ "companyId" TEXT NOT NULL,"employeeTypeId" TEXT NOT NULL,CONSTRAINT "employee_pkey" PRIMARY KEY ("id", "companyId"),CONSTRAINT "employee_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,diff --git a/packages/database/supabase/migrations/20230123004514_buckets.sql b/packages/database/supabase/migrations/20230123004514_buckets.sqlindex 2c688e05bc..070f2fb201 100644--- a/packages/database/supabase/migrations/20230123004514_buckets.sql+++ b/packages/database/supabase/migrations/20230123004514_buckets.sql@@ -15,11 +15,11 @@ ON storage.objects FOR INSERT WITH CHECK (bucket_id = 'public'AND has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('settings_create')) OR(storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('settings_create')+ get_permission_companies('settings_create'))));@@ -29,11 +29,11 @@ ON storage.objects FOR UPDATE USING (bucket_id = 'public'AND has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('settings_create')) OR(storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('settings_update')+ get_permission_companies('settings_update'))));@@ -43,11 +43,11 @@ ON storage.objects FOR DELETE USING (bucket_id = 'public'AND has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('settings_create')) OR(storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('settings_delete')+ get_permission_companies('settings_delete'))));diff --git a/packages/database/supabase/migrations/20230123004536_attributes.sql b/packages/database/supabase/migrations/20230123004536_attributes.sqlindex bb2e11c0b0..cc50384f74 100644--- a/packages/database/supabase/migrations/20230123004536_attributes.sql+++ b/packages/database/supabase/migrations/20230123004536_attributes.sql@@ -4,7 +4,7 @@ CREATE TABLE "userAttributeCategory" ("name" TEXT NOT NULL,"public" BOOLEAN DEFAULT FALSE,"protected" BOOLEAN DEFAULT FALSE,- "companyId" INTEGER,+ "companyId" TEXT,"active" BOOLEAN DEFAULT TRUE,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,"createdBy" TEXT NOT NULL,@@ -194,8 +194,8 @@ CREATE POLICY "Users with resource update can view/modify user attribute values"SELECT "id" FROM "userAttributeCategory" WHERE"companyId" = ANY(coalesce(- get_permission_companies('resources_update')::integer[],- array[]::integer[]+ get_permission_companies('resources_update')::text[],+ array[]::text[])))@@ -211,8 +211,8 @@ CREATE POLICY "Users can view other users attributes if the category is public"SELECT "id" FROM "userAttribute" WHERE "userAttributeCategoryId" IN (SELECT "id" FROM "userAttributeCategory" WHERE "public" = true AND "companyId" = ANY(coalesce(- get_permission_companies('resources_view')::integer[],- array[]::integer[]+ get_permission_companies('resources_view')::text[],+ array[]::text[])))diff --git a/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql b/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sqlindex 0c3af56a75..09eb968628 100644--- a/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql+++ b/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql@@ -23,7 +23,7 @@ CREATE TABLE "contact" ("countryCode" INTEGER,"birthday" DATE,"notes" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,CONSTRAINT "contact_pkey" PRIMARY KEY ("id"),CONSTRAINT "contact_countryCode_fkey" FOREIGN KEY ("countryCode") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE,@@ -42,7 +42,7 @@ CREATE TABLE "address" ("countryCode" INTEGER,"phone" TEXT,"fax" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,CONSTRAINT "address_pkey" PRIMARY KEY ("id"),CONSTRAINT "address_countryCode_fkey" FOREIGN KEY ("countryCode") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE,@@ -54,7 +54,7 @@ CREATE INDEX "address_companyId_idx" ON "address" ("companyId");CREATE TABLE "supplierStatus" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedBy" TEXT,@@ -74,7 +74,7 @@ CREATE TABLE "supplierType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,"protected" BOOLEAN NOT NULL DEFAULT false,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedBy" TEXT,@@ -99,7 +99,7 @@ CREATE TABLE "supplier" ("accountManagerId" TEXT,"logo" TEXT,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,"createdBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -152,7 +152,7 @@ CREATE INDEX "supplierContact_supplierId_idx" ON "supplierContact"("supplierId")CREATE TABLE "supplierAccount" ("id" TEXT NOT NULL,"supplierId" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,CONSTRAINT "supplierAccount_pkey" PRIMARY KEY ("id", "companyId"),CONSTRAINT "supplierAccount_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "supplier"("id") ON DELETE CASCADE ON UPDATE CASCADE,@@ -166,7 +166,7 @@ CREATE INDEX "supplierAccount_companyId_idx" ON "supplierAccount" ("companyId");CREATE TABLE "customerStatus" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedBy" TEXT,@@ -186,7 +186,7 @@ CREATE TABLE "customerType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,"protected" BOOLEAN NOT NULL DEFAULT false,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedBy" TEXT,@@ -211,7 +211,7 @@ CREATE TABLE "customer" ("accountManagerId" TEXT,"logo" TEXT,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,"createdBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -264,7 +264,7 @@ CREATE INDEX "customerContact_customerId_idx" ON "customerContact"("customerId")CREATE TABLE "customerAccount" ("id" TEXT NOT NULL,"customerId" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,CONSTRAINT "customerAccount_pkey" PRIMARY KEY ("id", "companyId"),CONSTRAINT "customerAccount_customerId_fkey" FOREIGN KEY ("customerId") REFERENCES "customer"("id") ON DELETE CASCADE ON UPDATE CASCADE,diff --git a/packages/database/supabase/migrations/20230123004632_groups.sql b/packages/database/supabase/migrations/20230123004632_groups.sqlindex 5ef347a438..b8a760477f 100644--- a/packages/database/supabase/migrations/20230123004632_groups.sql+++ b/packages/database/supabase/migrations/20230123004632_groups.sql@@ -1,7 +1,7 @@CREATE TABLE "group" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,- "companyId" INTEGER,+ "companyId" TEXT,"isIdentityGroup" BOOLEAN NOT NULL DEFAULT false,"isEmployeeTypeGroup" BOOLEAN NOT NULL DEFAULT false,"isCustomerOrgGroup" BOOLEAN NOT NULL DEFAULT false,@@ -50,11 +50,13 @@ BEGINVALUES (new.id, new.name, TRUE, new."companyId");INSERT INTO public."membership"("groupId", "memberGroupId")- VALUES ('00000000-0000-0000-0000-' || lpad(new."companyId"::text, 12, '0'), new.id);+ VALUES ('00000000-0000-' || substring(new."companyId"::text, 1, 4) || '-' || substring(new."companyId"::text, 5, 4) || '-' || substring(new."companyId"::text, 9, 12), new.id);RETURN new;END;$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE FUNCTION public.update_employee_type_group()RETURNS TRIGGER AS $$BEGIN@@ -231,7 +233,7 @@ CREATE OR REPLACE FUNCTION groups_query(RETURNS TABLE ("id" TEXT,"name" TEXT,- "companyId" INTEGER,+ "companyId" TEXT,"parentId" TEXT,"isEmployeeTypeGroup" BOOLEAN,"isCustomerOrgGroup" BOOLEAN,@@ -306,7 +308,7 @@ BEGINVALUES (new.id, new.name, TRUE, new."companyId");INSERT INTO public."membership"("groupId", "memberGroupId")- VALUES ('11111111-1111-1111-1111-' || lpad(new."companyId"::text, 12, '0'), new.id);+ VALUES ('11111111-1111-' || substring(new."companyId"::text, 1, 4) || '-' || substring(new."companyId"::text, 5, 4) || '-' || substring(new."companyId"::text, 9, 12), new.id);RETURN new;END;$$ LANGUAGE plpgsql SECURITY DEFINER;@@ -318,7 +320,7 @@ BEGINVALUES (new.id, new.name, TRUE, new."companyId");INSERT INTO public."membership"("groupId", "memberGroupId")- VALUES ('22222222-2222-2222-2222-' || lpad(new."companyId"::text, 12, '0'), new.id);+ VALUES ('22222222-2222-' || substring(new."companyId"::text, 1, 4) || '-' || substring(new."companyId"::text, 5, 4) || '-' || substring(new."companyId"::text, 9, 12), new.id);RETURN new;END;diff --git a/packages/database/supabase/migrations/20230123212853_search.sql b/packages/database/supabase/migrations/20230123212853_search.sqlindex 88cb9f2c95..be859c5d09 100644--- a/packages/database/supabase/migrations/20230123212853_search.sql+++ b/packages/database/supabase/migrations/20230123212853_search.sql@@ -8,7 +8,7 @@ CREATE TABLE search (entity "searchEntity",uuid TEXT,link TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,CONSTRAINT search_uuid_unique UNIQUE ("uuid", "companyId"),CONSTRAINT search_companyId_fkey FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADEdiff --git a/packages/database/supabase/migrations/20230126050441_abac.sql b/packages/database/supabase/migrations/20230126050441_abac.sqlindex 4479c00ac5..dfac870bcb 100644--- a/packages/database/supabase/migrations/20230126050441_abac.sql+++ b/packages/database/supabase/migrations/20230126050441_abac.sql@@ -279,7 +279,7 @@ CREATE POLICY "Employees with sales_view can view customer contact" ON "customerUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('sales_view'))OR "customerId" IN (@@ -292,7 +292,6 @@ CREATE POLICY "Customers with sales_view can their own customer contacts" ON "cuFOR SELECTUSING (has_role('customer')- -- TODO: get_permission_companies('sales_view').length > 0AND "customerId" IN (SELECT "customerId" FROM "customerAccount" WHERE id::uuid = auth.uid())@@ -303,7 +302,7 @@ CREATE POLICY "Employees with sales_create can create customer contacts" ON "cusWITH CHECK (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('sales_create'))OR "customerId" IN (@@ -327,7 +326,7 @@ CREATE POLICY "Employees with sales_update can update customer contacts" ON "cusUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('sales_update'))OR "customerId" IN (@@ -351,7 +350,7 @@ CREATE POLICY "Employees with sales_delete can delete customer contacts" ON "cusUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('sales_delete'))OR "customerId" IN (@@ -453,7 +452,7 @@ CREATE POLICY "Employees with purchasing_view can view supplier contact" ON "supUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('purchasing_view'))OR "supplierId" IN (@@ -477,7 +476,7 @@ CREATE POLICY "Employees with purchasing_create can create supplier contacts" ONWITH CHECK (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('purchasing_create'))OR "supplierId" IN (@@ -501,7 +500,7 @@ CREATE POLICY "Employees with purchasing_update can update supplier contacts" ONUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('purchasing_update'))OR "supplierId" IN (@@ -525,7 +524,7 @@ CREATE POLICY "Employees with purchasing_delete can delete supplier contacts" ONUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('purchasing_delete'))OR "supplierId" IN (diff --git a/packages/database/supabase/migrations/20230209041302_notes.sql b/packages/database/supabase/migrations/20230209041302_notes.sqlindex ac53f9f729..381164b1c5 100644--- a/packages/database/supabase/migrations/20230209041302_notes.sql+++ b/packages/database/supabase/migrations/20230209041302_notes.sql@@ -4,7 +4,7 @@ CREATE TABLE "note" ("note" TEXT NOT NULL,"noteRichText" JSONB NOT NULL DEFAULT '{}'::jsonb,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,diff --git a/packages/database/supabase/migrations/20230215023746_abilities.sql b/packages/database/supabase/migrations/20230215023746_abilities.sqlindex 4f8e51386b..2f183932d6 100644--- a/packages/database/supabase/migrations/20230215023746_abilities.sql+++ b/packages/database/supabase/migrations/20230215023746_abilities.sql@@ -4,7 +4,7 @@ CREATE TABLE "ability" ("curve" JSONB NOT NULL DEFAULT '{"data":[{"id":0,"week":0,"value":50},{"id":1,"week":1,"value":80},{"id":2,"week":2,"value":90},{"id":3,"week":3,"value":100}]}'::jsonb,"shadowWeeks" NUMERIC NOT NULL DEFAULT 0,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -71,7 +71,7 @@ CREATE POLICY "Employees with resources_view can view employeeAbilities" ON "empUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('resources_view'))OR "employeeId" IN (@@ -85,7 +85,7 @@ CREATE POLICY "Employees with resources_create can insert employeeAbilities" ONWITH CHECK (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('resources_create'))OR "employeeId" IN (@@ -99,7 +99,7 @@ CREATE POLICY "Employees with resources_update can update employeeAbilities" ONUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('resources_update'))OR "employeeId" IN (@@ -113,7 +113,7 @@ CREATE POLICY "Employees with resources_delete can delete employeeAbilities" ONUSING (has_role('employee')AND (- 0 = ANY(+ '0' = ANY(get_permission_companies('resources_delete'))OR "employeeId" IN (diff --git a/packages/database/supabase/migrations/20230224035103_shifts.sql b/packages/database/supabase/migrations/20230224035103_shifts.sqlindex 2f51b3539d..be17bc829c 100644--- a/packages/database/supabase/migrations/20230224035103_shifts.sql+++ b/packages/database/supabase/migrations/20230224035103_shifts.sql@@ -10,7 +10,7 @@ CREATE TABLE "location" ("timezone" TEXT NOT NULL,"latitude" NUMERIC,"longitude" NUMERIC,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -72,7 +72,7 @@ CREATE TABLE "shift" ("friday" BOOLEAN NOT NULL DEFAULT false,"saturday" BOOLEAN NOT NULL DEFAULT false,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -151,7 +151,7 @@ CREATE POLICY "Employees with resources_create can insert employee shifts" ON "eWITH CHECK (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_create'))+ '0' = ANY(get_permission_companies('resources_create'))OR ("shiftId" IN (SELECT "id" FROM "shift" WHERE "companyId" = ANY(@@ -167,7 +167,7 @@ CREATE POLICY "Employees with resources_update can update employee shifts" ON "eUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_update'))+ '0' = ANY(get_permission_companies('resources_update'))OR ("shiftId" IN (SELECT "id" FROM "shift" WHERE "companyId" = ANY(@@ -183,7 +183,7 @@ CREATE POLICY "Employees with resources_delete can delete employee shifts" ON "eUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_delete'))+ '0' = ANY(get_permission_companies('resources_delete'))OR ("shiftId" IN (SELECT "id" FROM "shift" WHERE "companyId" = ANY(@@ -197,7 +197,7 @@ CREATE POLICY "Employees with resources_delete can delete employee shifts" ON "eCREATE TABLE "employeeJob" ("id" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"locationId" TEXT,"shiftId" TEXT,"managerId" TEXT,diff --git a/packages/database/supabase/migrations/20230302030217_equipment.sql b/packages/database/supabase/migrations/20230302030217_equipment.sqlindex 4e7459826a..46963dcc37 100644--- a/packages/database/supabase/migrations/20230302030217_equipment.sql+++ b/packages/database/supabase/migrations/20230302030217_equipment.sql@@ -17,7 +17,7 @@ CREATE TABLE "department" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL UNIQUE,"parentDepartmentId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -73,7 +73,7 @@ CREATE TABLE "workCellType" ("overheadRate" NUMERIC NOT NULL DEFAULT 0,"defaultStandardFactor" factor NOT NULL DEFAULT 'Total Hours',"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -130,7 +130,7 @@ CREATE TABLE "workCell" ("locationId" TEXT,"workCellTypeId" TEXT NOT NULL,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"activeDate" DATE,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),@@ -193,7 +193,7 @@ CREATE TABLE "crew" ("crewLeaderId" TEXT,"groupId" TEXT NOT NULL,"workCellId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -258,7 +258,7 @@ CREATE POLICY "Employees with resources_view can view crew abilities" ON "crewAbUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_view'))+ '0' = ANY(get_permission_companies('resources_view'))OR ("crewId" IN (SELECT "id" FROM "crew" WHERE "companyId" = ANY(@@ -274,7 +274,7 @@ CREATE POLICY "Employees with resources_create can insert crew abilities" ON "crWITH CHECK (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_create'))+ '0' = ANY(get_permission_companies('resources_create'))OR ("crewId" IN (SELECT "id" FROM "crew" WHERE "companyId" = ANY(@@ -290,7 +290,7 @@ CREATE POLICY "Employees with resources_update can update crew abilities" ON "crUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_update'))+ '0' = ANY(get_permission_companies('resources_update'))OR ("crewId" IN (SELECT "id" FROM "crew" WHERE "companyId" = ANY(@@ -306,7 +306,7 @@ CREATE POLICY "Employees with resources_delete can delete crew abilities" ON "crUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_delete'))+ '0' = ANY(get_permission_companies('resources_delete'))OR ("crewId" IN (SELECT "id" FROM "crew" WHERE "companyId" = ANY(@@ -324,7 +324,7 @@ CREATE TABLE "equipmentType" ("requiredAbility" TEXT,"setupHours" NUMERIC NOT NULL DEFAULT 0,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -383,7 +383,7 @@ CREATE TABLE "equipment" ("workCellId" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,"activeDate" DATE DEFAULT CURRENT_DATE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230315222231_holidays.sql b/packages/database/supabase/migrations/20230315222231_holidays.sqlindex 6246fada9c..4475528d94 100644--- a/packages/database/supabase/migrations/20230315222231_holidays.sql+++ b/packages/database/supabase/migrations/20230315222231_holidays.sql@@ -3,7 +3,7 @@ CREATE TABLE "holiday" ("name" TEXT NOT NULL,"date" DATE NOT NULL,"year" INTEGER GENERATED ALWAYS AS (EXTRACT(YEAR FROM "date")) STORED,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP NOT NULL DEFAULT now(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230319224154_partners.sql b/packages/database/supabase/migrations/20230319224154_partners.sqlindex 615946e1e1..ccb4e32be9 100644--- a/packages/database/supabase/migrations/20230319224154_partners.sql+++ b/packages/database/supabase/migrations/20230319224154_partners.sql@@ -3,7 +3,7 @@ CREATE TABLE "partner" ("hoursPerWeek" INTEGER NOT NULL DEFAULT 0,"abilityId" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230329021751_contractors.sql b/packages/database/supabase/migrations/20230329021751_contractors.sqlindex 258e893cb3..831076ad5a 100644--- a/packages/database/supabase/migrations/20230329021751_contractors.sql+++ b/packages/database/supabase/migrations/20230329021751_contractors.sql@@ -2,7 +2,7 @@ CREATE TABLE "contractor" ("id" TEXT NOT NULL,"hoursPerWeek" INTEGER NOT NULL DEFAULT 0,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -68,7 +68,7 @@ CREATE POLICY "Employees with resources_view can view contractor abilities" ON "USING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_view'))+ '0' = ANY(get_permission_companies('resources_view'))OR ("contractorId" IN (SELECT "id" FROM "contractor" WHERE "companyId" = ANY(@@ -84,7 +84,7 @@ CREATE POLICY "Employees with resources_create can insert contractor abilities"WITH CHECK (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_create'))+ '0' = ANY(get_permission_companies('resources_create'))OR ("contractorId" IN (SELECT "id" FROM "contractor" WHERE "companyId" = ANY(@@ -100,7 +100,7 @@ CREATE POLICY "Employees with resources_update can update contractor abilities"USING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_update'))+ '0' = ANY(get_permission_companies('resources_update'))OR ("contractorId" IN (SELECT "id" FROM "contractor" WHERE "companyId" = ANY(@@ -116,7 +116,7 @@ CREATE POLICY "Employees with resources_delete can delete contractor abilities"USING (has_role('employee')AND (- 0 = ANY(get_permission_companies('resources_delete'))+ '0' = ANY(get_permission_companies('resources_delete'))OR ("contractorId" IN (SELECT "id" FROM "contractor" WHERE "companyId" = ANY(diff --git a/packages/database/supabase/migrations/20230330024715_accounts.sql b/packages/database/supabase/migrations/20230330024715_accounts.sqlindex eba8e0d8e1..b73671ddaf 100644--- a/packages/database/supabase/migrations/20230330024715_accounts.sql+++ b/packages/database/supabase/migrations/20230330024715_accounts.sql@@ -7,7 +7,7 @@ CREATE TABLE "currency" ("decimalPlaces" INTEGER NOT NULL DEFAULT 2,"isBaseCurrency" BOOLEAN NOT NULL DEFAULT false,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -99,7 +99,7 @@ CREATE TABLE "accountCategory" ("category" TEXT NOT NULL,"class" "glAccountClass" NOT NULL,"incomeBalance" "glIncomeBalance" NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -179,7 +179,7 @@ CREATE POLICY "Employees with accounting_view can view account subcategories" ONUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('accounting_view'))+ '0' = ANY(get_permission_companies('accounting_view'))OR ("accountCategoryId" IN (SELECT "id" FROM "accountCategory" WHERE "companyId" = ANY(@@ -196,7 +196,7 @@ CREATE POLICY "Employees with accounting_create can insert account subcategoriesWITH CHECK (has_role('employee')AND (- 0 = ANY(get_permission_companies('accounting_create'))+ '0' = ANY(get_permission_companies('accounting_create'))OR ("accountCategoryId" IN (SELECT "id" FROM "accountCategory" WHERE "companyId" = ANY(@@ -212,7 +212,7 @@ CREATE POLICY "Employees with accounting_update can update account subcategoriesUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('accounting_update'))+ '0' = ANY(get_permission_companies('accounting_update'))OR ("accountCategoryId" IN (SELECT "id" FROM "accountCategory" WHERE "companyId" = ANY(@@ -228,7 +228,7 @@ CREATE POLICY "Employees with accounting_delete can delete account subcategoriesUSING (has_role('employee')AND (- 0 = ANY(get_permission_companies('accounting_delete'))+ '0' = ANY(get_permission_companies('accounting_delete'))OR ("accountCategoryId" IN (SELECT "id" FROM "accountCategory" WHERE "companyId" = ANY(@@ -251,7 +251,7 @@ CREATE TABLE "account" ("consolidatedRate" "glConsolidatedRate","directPosting" BOOLEAN NOT NULL DEFAULT false,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230330024716_parts.sql b/packages/database/supabase/migrations/20230330024716_parts.sqlindex 7042fc9caf..c173339f88 100644--- a/packages/database/supabase/migrations/20230330024716_parts.sql+++ b/packages/database/supabase/migrations/20230330024716_parts.sql@@ -3,7 +3,7 @@ CREATE TABLE "partGroup" ("name" TEXT NOT NULL,"description" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -86,7 +86,7 @@ CREATE TABLE "unitOfMeasure" ("code" TEXT NOT NULL,"name" TEXT NOT NULL,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -153,7 +153,7 @@ CREATE TABLE "part" ("fromDate" DATE,"toDate" DATE,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -279,7 +279,7 @@ CREATE TABLE "partCost" ("standardCost" NUMERIC(15,5) NOT NULL DEFAULT 0,"unitCost" NUMERIC(15,5) NOT NULL DEFAULT 0,"costIsAdjusted" BOOLEAN NOT NULL DEFAULT false,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -319,7 +319,7 @@ CREATE TABLE "partUnitSalePrice" ("salesBlocked" BOOLEAN NOT NULL DEFAULT false,"priceIncludesTax" BOOLEAN NOT NULL DEFAULT false,"allowInvoiceDiscount" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -362,7 +362,7 @@ CREATE TABLE "partSupplier" ("minimumOrderQuantity" INTEGER DEFAULT 1,"conversionFactor" NUMERIC(15,5) NOT NULL DEFAULT 1,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -448,7 +448,7 @@ CREATE TABLE "partReplenishment" ("requiresConfiguration" BOOLEAN NOT NULL DEFAULT false,"scrapPercentage" NUMERIC(15,5) NOT NULL DEFAULT 0,"lotSize" INTEGER,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -608,7 +608,7 @@ CREATE TABLE "warehouse" ("requiresReceive" BOOLEAN NOT NULL DEFAULT false,"requiresShipment" BOOLEAN NOT NULL DEFAULT false,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -629,7 +629,7 @@ CREATE TABLE "shelf" ("locationId" TEXT NOT NULL,"warehouseId" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -698,7 +698,7 @@ CREATE TABLE "partPlanning" ("minimumOrderQuantity" INTEGER NOT NULL DEFAULT 0,"maximumOrderQuantity" INTEGER NOT NULL DEFAULT 0,"orderMultiple" INTEGER NOT NULL DEFAULT 1,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -744,7 +744,7 @@ CREATE TABLE "partInventory" ("partId" TEXT NOT NULL,"locationId" TEXT NOT NULL,"defaultShelfId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230412120726_services.sql b/packages/database/supabase/migrations/20230412120726_services.sqlindex 9fdff02bcd..6c58929a93 100644--- a/packages/database/supabase/migrations/20230412120726_services.sql+++ b/packages/database/supabase/migrations/20230412120726_services.sql@@ -17,7 +17,7 @@ CREATE TABLE "service" ("toDate" DATE,"assignee" TEXT,"customFields" JSONB,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,@@ -71,7 +71,7 @@ CREATE TABLE "serviceSupplier" ("supplierId" TEXT NOT NULL,"supplierServiceId" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230423023136_documents.sql b/packages/database/supabase/migrations/20230423023136_documents.sqlindex d57b66e600..422a1450cc 100644--- a/packages/database/supabase/migrations/20230423023136_documents.sql+++ b/packages/database/supabase/migrations/20230423023136_documents.sql@@ -22,7 +22,7 @@ CREATE TABLE "document" ("readGroups" TEXT[],"writeGroups" TEXT[],"active" BOOLEAN NOT NULL DEFAULT TRUE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230510035345_purchasing.sql b/packages/database/supabase/migrations/20230510035345_purchasing.sqlindex f3212827ed..269cdbcf88 100644--- a/packages/database/supabase/migrations/20230510035345_purchasing.sql+++ b/packages/database/supabase/migrations/20230510035345_purchasing.sql@@ -12,7 +12,7 @@ CREATE TABLE "paymentTerm" ("discountPercentage" NUMERIC(10,5) NOT NULL DEFAULT 0,"calculationMethod" "paymentTermCalculationMethod" NOT NULL DEFAULT 'Net',"active" BOOLEAN NOT NULL DEFAULT TRUE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -81,7 +81,7 @@ CREATE TABLE "shippingMethod" ("carrierAccountId" TEXT,"trackingUrl" TEXT,"active" BOOLEAN NOT NULL DEFAULT TRUE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -138,7 +138,7 @@ CREATE TABLE "shippingTerm" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,"active" BOOLEAN NOT NULL DEFAULT TRUE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -217,7 +217,7 @@ CREATE TABLE "purchaseOrder" ("supplierContactId" TEXT,"supplierReference" TEXT,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"closedAt" DATE,"closedBy" TEXT,"customFields" JSONB,@@ -302,7 +302,7 @@ CREATE TABLE "purchaseOrderLine" ("receivedComplete" BOOLEAN NOT NULL DEFAULT FALSE,"invoicedComplete" BOOLEAN NOT NULL DEFAULT FALSE,"requiresInspection" BOOLEAN NOT NULL DEFAULT FALSE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -375,7 +375,7 @@ CREATE TABLE "purchaseOrderPayment" ("paymentTermId" TEXT,"paymentComplete" BOOLEAN NOT NULL DEFAULT FALSE,"currencyCode" TEXT NOT NULL DEFAULT 'USD',- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,"customFields" JSONB,@@ -405,7 +405,7 @@ CREATE TABLE "purchaseOrderDelivery" ("dropShipment" BOOLEAN NOT NULL DEFAULT FALSE,"customerId" TEXT,"customerLocationId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,"customFields" JSONB,diff --git a/packages/database/supabase/migrations/20230525025310_sequences.sql b/packages/database/supabase/migrations/20230525025310_sequences.sqlindex 9d92db27d9..e97c6a028f 100644--- a/packages/database/supabase/migrations/20230525025310_sequences.sql+++ b/packages/database/supabase/migrations/20230525025310_sequences.sql@@ -18,7 +18,7 @@ CREATE TABLE "sequence" ("next" INTEGER NOT NULL DEFAULT 1,"size" INTEGER NOT NULL DEFAULT 5,"step" INTEGER NOT NULL DEFAULT 1,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20230629113514_purchasing-files.sql b/packages/database/supabase/migrations/20230629113514_purchasing-files.sqlindex 786855bb6c..ecb4bb9e1d 100644--- a/packages/database/supabase/migrations/20230629113514_purchasing-files.sql+++ b/packages/database/supabase/migrations/20230629113514_purchasing-files.sql@@ -5,7 +5,7 @@ FOR SELECT USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_view')+ get_permission_companies('purchasing_view'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'internal'@@ -16,7 +16,7 @@ FOR INSERT WITH CHECK (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_create')+ get_permission_companies('purchasing_create'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'internal'@@ -27,7 +27,7 @@ FOR UPDATE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_update')+ get_permission_companies('purchasing_update'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'internal'@@ -38,7 +38,7 @@ FOR DELETE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_delete')+ get_permission_companies('purchasing_delete'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'internal'@@ -51,7 +51,7 @@ FOR SELECT USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_view')+ get_permission_companies('purchasing_view'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'external'@@ -62,7 +62,7 @@ FOR INSERT WITH CHECK (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_create')+ get_permission_companies('purchasing_create'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'external'@@ -73,7 +73,7 @@ FOR UPDATE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_update')+ get_permission_companies('purchasing_update'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'external'@@ -84,7 +84,7 @@ FOR DELETE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('purchasing_delete')+ get_permission_companies('purchasing_delete'))AND (storage.foldername(name))[2] = 'purchasing'AND (storage.foldername(name))[3] = 'external'diff --git a/packages/database/supabase/migrations/20230705033432_ledgers.sql b/packages/database/supabase/migrations/20230705033432_ledgers.sqlindex 048a9190e2..306d7da277 100644--- a/packages/database/supabase/migrations/20230705033432_ledgers.sql+++ b/packages/database/supabase/migrations/20230705033432_ledgers.sql@@ -14,7 +14,7 @@ CREATE TYPE "month" AS ENUM ();CREATE TABLE "fiscalYearSettings" (- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"startMonth" "month" NOT NULL DEFAULT 'January',"taxStartMonth" "month" NOT NULL DEFAULT 'January',"updatedBy" TEXT NOT NULL,@@ -35,7 +35,7 @@ CREATE TABLE "accountingPeriod" ("startDate" DATE NOT NULL,"endDate" DATE NOT NULL,"status" "accountingPeriodStatus" NOT NULL DEFAULT 'Inactive',- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"closedAt" TIMESTAMP WITH TIME ZONE,"closedBy" TEXT,"createdBy" TEXT NOT NULL,@@ -56,7 +56,7 @@ CREATE TABLE "journal" ("id" SERIAL,"description" TEXT,"accountingPeriodId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"postingDate" DATE NOT NULL DEFAULT CURRENT_DATE,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"customFields" JSONB,@@ -112,7 +112,7 @@ CREATE TABLE "journalLine" ("journalLineReference" TEXT NOT NULL,"documentLineReference" TEXT,"accrual" BOOLEAN NOT NULL DEFAULT false,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"customFields" JSONB,@@ -198,7 +198,7 @@ CREATE TABLE "costLedger" ("quantity" NUMERIC(12, 4) NOT NULL DEFAULT 0,"cost" NUMERIC(19, 4) NOT NULL DEFAULT 0,"costPostedToGL" NUMERIC(19, 4) NOT NULL DEFAULT 0,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),CONSTRAINT "costLedger_pkey" PRIMARY KEY ("id"),@@ -230,7 +230,7 @@ CREATE TABLE "partLedger" ("locationId" TEXT,"shelfId" TEXT,"quantity" NUMERIC(12, 4) NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),CONSTRAINT "partLedger_pkey" PRIMARY KEY ("id"),@@ -270,7 +270,7 @@ CREATE TABLE "supplierLedger" ("externalDocumentId" TEXT,"supplierId" TEXT NOT NULL,"amount" NUMERIC(19, 4) NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),CONSTRAINT "supplierLedger_pkey" PRIMARY KEY ("id"),@@ -297,7 +297,7 @@ CREATE OR REPLACE FUNCTION "journalLinesByAccountNumber" ()RETURNS TABLE ("number" TEXT,- "companyId" INTEGER,+ "companyId" TEXT,"balance" NUMERIC(19, 4),"balanceAtDate" NUMERIC(19, 4),"netChange" NUMERIC(19, 4)diff --git a/packages/database/supabase/migrations/20230728025201_receipts.sql b/packages/database/supabase/migrations/20230728025201_receipts.sqlindex c9d5fdb1ef..822386e000 100644--- a/packages/database/supabase/migrations/20230728025201_receipts.sql+++ b/packages/database/supabase/migrations/20230728025201_receipts.sql@@ -30,7 +30,7 @@ CREATE TABLE "receipt" ("postingDate" DATE,"invoiced" BOOLEAN DEFAULT FALSE,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -99,7 +99,7 @@ CREATE TABLE "receiptLine" ("shelfId" TEXT,"unitOfMeasure" TEXT NOT NULL,"unitPrice" NUMERIC(18, 4) NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,diff --git a/packages/database/supabase/migrations/20230820020844_posting-groups.sql b/packages/database/supabase/migrations/20230820020844_posting-groups.sqlindex 0737f3aa43..7440e7cb75 100644--- a/packages/database/supabase/migrations/20230820020844_posting-groups.sql+++ b/packages/database/supabase/migrations/20230820020844_posting-groups.sql@@ -1,5 +1,5 @@CREATE TABLE "accountDefault" (- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,-- income statement-- revenue"salesAccount" TEXT NOT NULL,@@ -142,7 +142,7 @@ CREATE TABLE "postingGroupInventory" ("inventoryAdjustmentVarianceAccount" TEXT NOT NULL,"materialVarianceAccount" TEXT NOT NULL,"capacityVarianceAccount" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedBy" TEXT,CONSTRAINT "postingGroupInventory_pkey" PRIMARY KEY ("id"),@@ -196,7 +196,7 @@ CREATE TABLE "postingGroupPurchasing" ("purchaseCreditAccount" TEXT NOT NULL,"purchasePrepaymentAccount" TEXT NOT NULL,"purchaseTaxPayableAccount" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedBy" TEXT,CONSTRAINT "postingGroupPurchasing_pkey" PRIMARY KEY ("id"),@@ -242,7 +242,7 @@ CREATE TABLE "postingGroupSales" ("salesCreditAccount" TEXT NOT NULL,"salesPrepaymentAccount" TEXT NOT NULL,"salesTaxPayableAccount" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedBy" TEXT,CONSTRAINT "postingGroupSales_pkey" PRIMARY KEY ("id"),diff --git a/packages/database/supabase/migrations/20230924004608_accounts-payable.sql b/packages/database/supabase/migrations/20230924004608_accounts-payable.sqlindex 2764618341..714762b1c8 100644--- a/packages/database/supabase/migrations/20230924004608_accounts-payable.sql+++ b/packages/database/supabase/migrations/20230924004608_accounts-payable.sql@@ -32,7 +32,7 @@ CREATE TABLE "purchaseInvoice" ("totalTax" NUMERIC(10, 2) NOT NULL DEFAULT 0,"balance" NUMERIC(10, 2) NOT NULL DEFAULT 0,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"customFields" JSONB,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),@@ -139,7 +139,7 @@ CREATE TABLE "purchaseInvoiceLine" ("exchangeRate" NUMERIC(10, 4) NOT NULL DEFAULT 1,"inventoryUnitOfMeasureCode" TEXT,"purchaseUnitOfMeasureCode" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"updatedBy" TEXT,@@ -302,7 +302,7 @@ CREATE TABLE "purchasePayment" ("currencyCode" TEXT NOT NULL,"exchangeRate" NUMERIC(10, 4) NOT NULL DEFAULT 1,"totalAmount" NUMERIC(10, 2) NOT NULL DEFAULT 0,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20231109050239_supplier-details.sql b/packages/database/supabase/migrations/20231109050239_supplier-details.sqlindex 8781e379a4..57f5ca83ab 100644--- a/packages/database/supabase/migrations/20231109050239_supplier-details.sql+++ b/packages/database/supabase/migrations/20231109050239_supplier-details.sql@@ -7,7 +7,7 @@ CREATE TABLE "supplierPayment" ("invoiceSupplierContactId" TEXT,"paymentTermId" TEXT,"currencyCode" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,"customFields" JSONB,@@ -49,7 +49,7 @@ CREATE TABLE "supplierShipping" ("shippingSupplierContactId" TEXT,"shippingTermId" TEXT,"shippingMethodId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,"customFields" JSONB,diff --git a/packages/database/supabase/migrations/20231109050252_customer-details.sql b/packages/database/supabase/migrations/20231109050252_customer-details.sqlindex a0bbe3c4ea..15a7545eda 100644--- a/packages/database/supabase/migrations/20231109050252_customer-details.sql+++ b/packages/database/supabase/migrations/20231109050252_customer-details.sql@@ -6,7 +6,7 @@ CREATE TABLE "customerPayment" ("invoiceCustomerContactId" TEXT,"paymentTermId" TEXT,"currencyCode" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,@@ -46,7 +46,7 @@ CREATE TABLE "customerShipping" ("shippingCustomerContactId" TEXT,"shippingTermId" TEXT,"shippingMethodId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20240119095150_integrations.sql b/packages/database/supabase/migrations/20240119095150_integrations.sqlindex 6f5e52ee46..8891f8c85d 100644--- a/packages/database/supabase/migrations/20240119095150_integrations.sql+++ b/packages/database/supabase/migrations/20240119095150_integrations.sql@@ -10,7 +10,7 @@ CREATE TABLE "integration" ("visible" BOOLEAN NOT NULL DEFAULT TRUE,"jsonschema" JSON NOT NULL,"metadata" JSON NOT NULL DEFAULT '{}',- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedBy" TEXT,diff --git a/packages/database/supabase/migrations/20240204025905_rfq.sql b/packages/database/supabase/migrations/20240204025905_rfq.sqlindex 3147df0b0b..6a6b0b7259 100644--- a/packages/database/supabase/migrations/20240204025905_rfq.sql+++ b/packages/database/supabase/migrations/20240204025905_rfq.sql@@ -12,7 +12,7 @@ CREATE TABLE "requestForQuote" ("locationId" TEXT,"assignee" TEXT,"customFields" JSONB,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),@@ -39,7 +39,7 @@ CREATE TABLE "requestForQuoteLine" ("unitOfMeasureCode" TEXT,"locationId" TEXT,"shelfId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),diff --git a/packages/database/supabase/migrations/20240206224405_quotes.sql b/packages/database/supabase/migrations/20240206224405_quotes.sqlindex 3c1cbc4f73..8b5d0cffe2 100644--- a/packages/database/supabase/migrations/20240206224405_quotes.sql+++ b/packages/database/supabase/migrations/20240206224405_quotes.sql@@ -28,7 +28,7 @@ CREATE TABLE "quote" ("locationId" TEXT,"assignee" TEXT,"customFields" JSONB,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -70,7 +70,7 @@ CREATE TABLE "quoteLine" ("customerPartRevision" TEXT,"replenishmentSystem" TEXT,"unitOfMeasureCode" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,@@ -96,7 +96,7 @@ CREATE TABLE "quoteAssembly" ("description" TEXT,"unitOfMeasureCode" TEXT,"quantityPerParent" NUMERIC(10, 2) NOT NULL DEFAULT 0,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -132,7 +132,7 @@ CREATE TABLE "quoteOperation" ("quotingRate" NUMERIC(10,4) NOT NULL DEFAULT 0,"laborRate" NUMERIC(10,4) NOT NULL DEFAULT 0,"overheadRate" NUMERIC(10,4) NOT NULL DEFAULT 0,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -164,7 +164,7 @@ CREATE TABLE "quoteMaterial" ("quantity" NUMERIC(10, 2) NOT NULL DEFAULT 0,"unitOfMeasureCode" TEXT,"unitCost" NUMERIC(10, 2) NOT NULL DEFAULT 0,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,diff --git a/packages/database/supabase/migrations/20240209055738_quote-files.sql b/packages/database/supabase/migrations/20240209055738_quote-files.sqlindex c1a3b89270..81e092c967 100644--- a/packages/database/supabase/migrations/20240209055738_quote-files.sql+++ b/packages/database/supabase/migrations/20240209055738_quote-files.sql@@ -5,7 +5,7 @@ FOR SELECT USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_view')+ get_permission_companies('sales_view'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'internal'@@ -16,7 +16,7 @@ FOR INSERT WITH CHECK (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_create')+ get_permission_companies('sales_create'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'internal'@@ -27,7 +27,7 @@ FOR UPDATE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_update')+ get_permission_companies('sales_update'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'internal'@@ -38,7 +38,7 @@ FOR DELETE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_delete')+ get_permission_companies('sales_delete'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'internal'@@ -51,7 +51,7 @@ FOR SELECT USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_view')+ get_permission_companies('sales_view'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'external'@@ -62,7 +62,7 @@ FOR INSERT WITH CHECK (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_create')+ get_permission_companies('sales_create'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'external'@@ -73,7 +73,7 @@ FOR UPDATE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_update')+ get_permission_companies('sales_update'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'external'@@ -84,7 +84,7 @@ FOR DELETE USING (bucket_id = 'private'AND has_role('employee')AND (storage.foldername(name))[1] = ANY(- get_permission_companies_as_text('sales_delete')+ get_permission_companies('sales_delete'))AND (storage.foldername(name))[2] = 'quote'AND (storage.foldername(name))[3] = 'external'diff --git a/packages/database/supabase/migrations/20240311021818_custom-fields.sql b/packages/database/supabase/migrations/20240311021818_custom-fields.sqlindex 3da050be7f..33b92fadeb 100644--- a/packages/database/supabase/migrations/20240311021818_custom-fields.sql+++ b/packages/database/supabase/migrations/20240311021818_custom-fields.sql@@ -4,7 +4,7 @@ CREATE TABLE "customFieldTable" ("module" module NOT NULL,"table" TEXT NOT NULL,"name" TEXT NOT NULL,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,CONSTRAINT "customFieldTable_pkey" PRIMARY KEY ("id"),CONSTRAINT "customFieldTable_module_table_name_key" UNIQUE ("module", "table", "name", "companyId"),@@ -30,7 +30,7 @@ CREATE TABLE "customField" ("dataTypeId" INTEGER NOT NULL,"listOptions" TEXT ARRAY,"active" BOOLEAN DEFAULT TRUE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,diff --git a/packages/database/supabase/migrations/20240330054035_purchasing-documents.sql b/packages/database/supabase/migrations/20240330054035_purchasing-documents.sqlindex 9e0b48ca5f..88d0d80d68 100644--- a/packages/database/supabase/migrations/20240330054035_purchasing-documents.sql+++ b/packages/database/supabase/migrations/20240330054035_purchasing-documents.sql@@ -4,7 +4,7 @@ CREATE POLICY "Users with purchasing_view can view documents that start with purFOR SELECT USING (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('purchasing_view')+ get_permission_companies('purchasing_view'))AND (storage.foldername(path))[2] = 'purchasing');@@ -13,7 +13,7 @@ CREATE POLICY "Users with purchasing_create can create documents that start withFOR INSERT WITH CHECK (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('purchasing_create')+ get_permission_companies('purchasing_create'))AND (storage.foldername(path))[2] = 'purchasing');@@ -22,7 +22,7 @@ CREATE POLICY "Users with purchasing_update can update documents that start withFOR UPDATE USING (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('purchasing_update')+ get_permission_companies('purchasing_update'))AND (storage.foldername(path))[2] = 'purchasing');@@ -31,7 +31,7 @@ CREATE POLICY "Users with purchasing_delete can delete documents that start withFOR DELETE USING (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('purchasing_delete')+ get_permission_companies('purchasing_delete'))AND (storage.foldername(path))[2] = 'purchasing');diff --git a/packages/database/supabase/migrations/20240330164855_quote-documents.sql b/packages/database/supabase/migrations/20240330164855_quote-documents.sqlindex b7ef04bad0..41a1c7a4a7 100644--- a/packages/database/supabase/migrations/20240330164855_quote-documents.sql+++ b/packages/database/supabase/migrations/20240330164855_quote-documents.sql@@ -4,7 +4,7 @@ CREATE POLICY "Users with sales_view can view documents that start with quote" OFOR SELECT USING (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('sales_view')+ get_permission_companies('sales_view'))AND (storage.foldername(path))[2] = 'quote');@@ -13,7 +13,7 @@ CREATE POLICY "Users with sales_create can create documents that start with quotFOR INSERT WITH CHECK (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('sales_create')+ get_permission_companies('sales_create'))AND (storage.foldername(path))[2] = 'quote');@@ -22,7 +22,7 @@ CREATE POLICY "Users with sales_update can update documents that start with quotFOR UPDATE USING (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('sales_update')+ get_permission_companies('sales_update'))AND (storage.foldername(path))[2] = 'quote');@@ -31,7 +31,7 @@ CREATE POLICY "Users with sales_delete can delete documents that start with quotFOR DELETE USING (has_role('employee')AND (storage.foldername(path))[1] = ANY(- get_permission_companies_as_text('sales_delete')+ get_permission_companies('sales_delete'))AND (storage.foldername(path))[2] = 'quote');diff --git a/packages/database/supabase/migrations/20240412224648_sales-orders.sql b/packages/database/supabase/migrations/20240412224648_sales-orders.sqlindex 2afe9cceec..aeb36d35d2 100644--- a/packages/database/supabase/migrations/20240412224648_sales-orders.sql+++ b/packages/database/supabase/migrations/20240412224648_sales-orders.sql@@ -22,7 +22,7 @@ CREATE TABLE "salesOrder" ("customerReference" TEXT,"quoteId" TEXT,"assignee" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"closedAt" DATE,"closedBy" TEXT,"customFields" JSONB,@@ -93,7 +93,7 @@ CREATE TABLE "salesOrderLine" ("sentComplete" BOOLEAN NOT NULL DEFAULT FALSE,"invoicedComplete" BOOLEAN NOT NULL DEFAULT FALSE,"requiresInspection" BOOLEAN NOT NULL DEFAULT FALSE,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -150,7 +150,7 @@ CREATE TABLE "salesOrderPayment" ("paymentTermId" TEXT,"paymentComplete" BOOLEAN NOT NULL DEFAULT FALSE,"currencyCode" TEXT NOT NULL DEFAULT 'USD',- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,"customFields" JSONB,@@ -185,7 +185,7 @@ CREATE TABLE "salesOrderShipment" ("customerLocationId" TEXT,"supplierId" TEXT,"supplierLocationId" TEXT,- "companyId" INTEGER NOT NULL,+ "companyId" TEXT NOT NULL,"updatedBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,"customFields" JSONB,