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
feat: add rls policy for updating customerPartToItem
Brad Barbin81893e8b1e46
diff --git a/apps/carbon/app/modules/items/ui/Item/CustomerParts/CustomerParts.tsx b/apps/carbon/app/modules/items/ui/Item/CustomerParts/CustomerParts.tsxindex 174b687724..03578d800c 100644--- a/apps/carbon/app/modules/items/ui/Item/CustomerParts/CustomerParts.tsx+++ b/apps/carbon/app/modules/items/ui/Item/CustomerParts/CustomerParts.tsx@@ -9,7 +9,7 @@ import {import { Outlet, useNavigate } from "@remix-run/react";import type { ColumnDef } from "@tanstack/react-table";import { useMemo } from "react";-import { New } from "~/components";+import { CustomerAvatar, New } from "~/components";import { EditableText } from "~/components/Editable";import Grid from "~/components/Grid";import type { CustomerPart } from "~/modules/items";@@ -30,8 +30,7 @@ const CustomerParts = ({ customerParts }: CustomerPartsProps) => {header: "Customer",cell: ({ row }) => (<HStack className="justify-between">- {/* @ts-ignore */}- <span>{row.original.customer.name}</span>+ <CustomerAvatar customerId={row.original.customerId} /></HStack>),},diff --git a/packages/database/supabase/migrations/20240815185942_add-id-col-customerPartToItem.sql b/packages/database/supabase/migrations/20240815185942_add-id-col-customerPartToItem.sqlindex 7eb4c3288e..2f45817de6 100644--- a/packages/database/supabase/migrations/20240815185942_add-id-col-customerPartToItem.sql+++ b/packages/database/supabase/migrations/20240815185942_add-id-col-customerPartToItem.sql@@ -19,4 +19,15 @@ DROP POLICY IF EXISTS "Employees with sales_create can insert customer part to iCREATE POLICY "Employees with sales_create can insert customer part to item" ON "customerPartToItem" FOR INSERT WITH CHECK (has_company_permission('sales_create', "companyId") ANDhas_role('employee', "companyId")+);++DROP POLICY "Employees with sales_delete can delete customer part to item" ON "customerPartToItem";+CREATE POLICY "Employees with sales_delete can delete customer part to item" ON "customerPartToItem" FOR DELETE USING (+ has_company_permission('sales_delete', "companyId") AND+ has_role('employee', "companyId")+);++CREATE POLICY "Employees with sales_update can update customer part to item" ON "customerPartToItem" FOR UPDATE USING (+ has_company_permission('sales_update', "companyId") AND+ has_role('employee', "companyId"));\ No newline at end of file