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: refactor auth to support self-signup
Brad Barbin2885ed73eab1
diff --git a/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx b/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsxindex 58802c8999..36123e2368 100644--- a/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx+++ b/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx@@ -25,6 +25,7 @@ const ProfileForm = ({ user }: ProfileFormProps) => {className="w-full"><VStack spacing={4}>+ <Input name="email" label="Email" isDisabled /><div className="grid grid-cols-1 md:grid-cols-2 gap-4 w-full"><Input name="firstName" label="First Name" /><Input name="lastName" label="Last Name" />diff --git a/apps/erp/app/modules/users/users.server.ts b/apps/erp/app/modules/users/users.server.tsindex 235f38880d..61a6106404 100644--- a/apps/erp/app/modules/users/users.server.ts+++ b/apps/erp/app/modules/users/users.server.ts@@ -943,7 +943,7 @@ async function insertUser(client: SupabaseClient<Database>,user: Omit<User, "fullName" | "createdAt">) {- return client.from("user").insert([user]).select("*");+ return client.from("user").upsert([user]).select("*");}function makePermissionsFromEmployeeType({diff --git a/apps/erp/app/routes/_public+/callback.tsx b/apps/erp/app/routes/_public+/callback.tsxindex 0ba2ce86bb..008665c53e 100644--- a/apps/erp/app/routes/_public+/callback.tsx+++ b/apps/erp/app/routes/_public+/callback.tsx@@ -131,9 +131,6 @@ export default function AuthCallback() {return (<div className="flex flex-col items-center justify-center">- <div className="flex justify-center mb-4">- <img src="/carbon-logo-mark.svg" alt="Carbon Logo" className="w-36" />- </div>{error ? (<div className="rounded-lg md:bg-card md:border md:border-border md:shadow-lg p-8 mt-8 w-[380px]"><VStack spacing={4}>@@ -152,11 +149,11 @@ export default function AuthCallback() {</VStack></div>) : (- <div className="circle-loader-container">- <div className="circle-loader">- <div className="circle" />- <div className="circle" />- <div className="circle" />+ <div className="hexagon-loader-container">+ <div className="hexagon-loader">+ <div className="hexagon" />+ <div className="hexagon" />+ <div className="hexagon" /></div></div>)}diff --git a/apps/erp/app/routes/onboarding+/_index.tsx b/apps/erp/app/routes/onboarding+/_index.tsxindex 1536c01306..8065c7de7b 100644--- a/apps/erp/app/routes/onboarding+/_index.tsx+++ b/apps/erp/app/routes/onboarding+/_index.tsx@@ -6,9 +6,9 @@ import { onboardingSequence } from "~/utils/path";const Heading = motion(_Heading);const Button = motion(_Button);-const slideUp = {- initial: { opacity: 0, y: 20 },- animate: { opacity: 1, y: 0 },+const fade = {+ initial: { opacity: 0 },+ animate: { opacity: 1 },};export default function GetStarted() {@@ -18,17 +18,17 @@ export default function GetStarted() {<AnimatePresence><VStack spacing={4} className="max-w-lg p-4 items-center text-center"><motion.img- initial={{ opacity: 0, scale: 0.6 }}+ initial={{ opacity: 0, scale: 0.4 }}animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 2.4, ease: "easeInOut" }}+ transition={{ duration: 2, ease: "easeInOut" }}src="/carbon-logo-mark.svg"alt="Carbon Logo"className="w-24 mb-3"/><Heading- {...slideUp}- transition={{ duration: 0.8, ease: "easeInOut", delay: 1.7 }}+ {...fade}+ transition={{ duration: 1.2, ease: "easeInOut", delay: 1.5 }}size="h1"className="m-0">@@ -36,16 +36,16 @@ export default function GetStarted() {</Heading><motion.p- {...slideUp}- transition={{ duration: 0.8, ease: "easeInOut", delay: 1.7 }}+ {...fade}+ transition={{ duration: 1.2, ease: "easeInOut", delay: 1.7 }}className="text-muted-foreground text-balance text-sm pb-4">The new standard for tech-enabled manufacturing</motion.p><Button- {...slideUp}- transition={{ duration: 0.8, ease: "easeInOut", delay: 2.7 }}+ {...fade}+ transition={{ duration: 1.2, ease: "easeInOut", delay: 1.9 }}size="lg"onClick={() => navigate(onboardingSequence[0])}>diff --git a/apps/erp/app/routes/onboarding+/company.tsx b/apps/erp/app/routes/onboarding+/company.tsxindex 99df9c419d..a11bdf8e1c 100644--- a/apps/erp/app/routes/onboarding+/company.tsx+++ b/apps/erp/app/routes/onboarding+/company.tsx@@ -1,4 +1,4 @@-import { assertIsPost, getCarbonServiceRole, NODE_ENV } from "@carbon/auth";+import { assertIsPost, getCarbonServiceRole } from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { setCompanyId } from "@carbon/auth/company.server";import { updateCompanySession } from "@carbon/auth/session.server";@@ -65,9 +65,6 @@ export async function action({ request }: ActionFunctionArgs) {let companyId: string | undefined;const companies = await getCompanies(client, userId);- if (companies?.data?.length === 0 && NODE_ENV !== "production") {- companyId = "000000000000000000";- }const company = companies?.data?.[0];const locations = await getLocationsList(client, company?.id ?? "");@@ -104,18 +101,6 @@ export async function action({ request }: ActionFunctionArgs) {companyId = companyInsert.data?.id;}- if (companyId === "000000000000000000") {- const companyInsert = await insertCompany(- serviceRole,- data,- "000000000000000000"- );- if (companyInsert.error) {- console.error(companyInsert.error);- throw new Error("Fatal: failed to insert company");- }- companyId = companyInsert.data?.id;- }if (!companyId) {throw new Error("Fatal: failed to get company ID");diff --git a/apps/erp/app/routes/x+/account+/_layout.tsx b/apps/erp/app/routes/x+/account+/_layout.tsxindex 5907df75fe..4faf24412c 100644--- a/apps/erp/app/routes/x+/account+/_layout.tsx+++ b/apps/erp/app/routes/x+/account+/_layout.tsx@@ -1,8 +1,6 @@import { Heading, VStack } from "@carbon/react";import { Outlet } from "@remix-run/react";import type { MetaFunction } from "@vercel/remix";-import { DetailSidebar } from "~/components/Layout/Navigation";-import useAccountSubmodules from "~/modules/account/ui/useAccountSubmodules";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -21,7 +19,7 @@ export const config = {};export default function AccountRoute() {- const { links } = useAccountSubmodules();+ // const { links } = useAccountSubmodules();return (<VStack@@ -35,8 +33,8 @@ export default function AccountRoute() {</div><div className="max-w-[60rem] w-full">- <div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-8">- <DetailSidebar links={links} />+ <div className="grid grid-cols-1 h-full w-full gap-8">+ {/* <DetailSidebar links={links} /> */}<VStack spacing={0} className="h-full"><Outlet /></VStack>diff --git a/apps/erp/app/styles/tailwind.css b/apps/erp/app/styles/tailwind.cssindex 4983e745cb..c117b07fd8 100644--- a/apps/erp/app/styles/tailwind.css+++ b/apps/erp/app/styles/tailwind.css@@ -157,11 +157,11 @@ p.is-editor-empty:first-child:before {animation-delay: 0.4s;}-.circle-loader-container {+.hexagon-loader-container {@apply relative w-full py-4;}-.circle-loader {+.hexagon-loader {position: relative;display: flex;justify-content: center;@@ -170,38 +170,73 @@ p.is-editor-empty:first-child:before {height: 40px;}-/* Three dot loading animation */-.circle {+/* Three hexagon loading animation */+.hexagon {display: inline-block;position: relative;- width: 16px;- height: 16px;+ width: 18px;+ height: 10px;background-color: #5fe4d3;- transform: rotate(45deg);- animation: dotloader 1.4s infinite ease-in-out;+ position: relative;+ animation: hexloader 1.4s infinite ease-in-out;+}++.hexagon:before,+.hexagon:after {+ content: "";+ position: absolute;+ width: 0;+ border-left: 9px solid transparent;+ border-right: 9px solid transparent;+}++.hexagon:before {+ bottom: 100%;+ border-bottom: 5px solid #5fe4d3;+}++.hexagon:after {+ top: 100%;+ border-top: 5px solid #5fe4d3;}-.circle + .circle {+.hexagon + .hexagon {margin-left: 16px;- animation: dotloader 1.4s 0.2s infinite ease-in-out;+ animation: hexloader 1.4s 0.2s infinite ease-in-out;background-color: #4faade;}-.circle + .circle + .circle {+.hexagon + .hexagon:before {+ border-bottom-color: #4faade;+}++.hexagon + .hexagon:after {+ border-top-color: #4faade;+}++.hexagon + .hexagon + .hexagon {margin-left: 16px;- animation: dotloader 1.4s 0.4s infinite ease-in-out;+ animation: hexloader 1.4s 0.4s infinite ease-in-out;background-color: #6041d0;}-@keyframes dotloader {+.hexagon + .hexagon + .hexagon:before {+ border-bottom-color: #6041d0;+}++.hexagon + .hexagon + .hexagon:after {+ border-top-color: #6041d0;+}++@keyframes hexloader {0%,80%,100% {- transform: scale(0.5) rotate(45deg);+ transform: scale(0.5);opacity: 0;}40% {- transform: scale(1) rotate(45deg);+ transform: scale(1);opacity: 1;}}diff --git a/apps/mes/app/routes/_public+/callback.tsx b/apps/mes/app/routes/_public+/callback.tsxindex 8afdfa807a..609cae4e8b 100644--- a/apps/mes/app/routes/_public+/callback.tsx+++ b/apps/mes/app/routes/_public+/callback.tsx@@ -137,9 +137,6 @@ export default function AuthCallback() {return (<div className="flex flex-col items-center justify-center">- <div className="flex justify-center mb-4">- <img src="/carbon-logo-mark.svg" alt="Carbon Logo" className="w-36" />- </div>{error ? (<div className="rounded-lg md:bg-card md:border md:border-border md:shadow-lg p-8 mt-8 w-[380px]"><VStack spacing={4}>@@ -162,11 +159,11 @@ export default function AuthCallback() {</VStack></div>) : (- <div className="circle-loader-container">- <div className="circle-loader">- <div className="circle" />- <div className="circle" />- <div className="circle" />+ <div className="hexagon-loader-container">+ <div className="hexagon-loader">+ <div className="hexagon" />+ <div className="hexagon" />+ <div className="hexagon" /></div></div>)}diff --git a/apps/mes/app/styles/tailwind.css b/apps/mes/app/styles/tailwind.cssindex 23b9d392d1..387f62ce56 100644--- a/apps/mes/app/styles/tailwind.css+++ b/apps/mes/app/styles/tailwind.css@@ -121,11 +121,11 @@ p.is-editor-empty:first-child:before {@apply ring-2 ring-primary cursor-move p-2 rounded-lg;}-.circle-loader-container {+.hexagon-loader-container {@apply relative w-full py-4;}-.circle-loader {+.hexagon-loader {position: relative;display: flex;justify-content: center;@@ -133,30 +133,66 @@ p.is-editor-empty:first-child:before {width: 100%;height: 40px;}-/* Three dot loading animation */-.circle {++/* Three hexagon loading animation */+.hexagon {display: inline-block;position: relative;- width: 16px;- height: 16px;+ width: 18px;+ height: 10px;background-color: #5fe4d3;- border-radius: 50%;- animation: dotloader 1.4s infinite ease-in-out;+ position: relative;+ animation: hexloader 1.4s infinite ease-in-out;+}++.hexagon:before,+.hexagon:after {+ content: "";+ position: absolute;+ width: 0;+ border-left: 9px solid transparent;+ border-right: 9px solid transparent;+}++.hexagon:before {+ bottom: 100%;+ border-bottom: 5px solid #5fe4d3;+}++.hexagon:after {+ top: 100%;+ border-top: 5px solid #5fe4d3;}-.circle + .circle {- margin-left: 12px;- animation: dotloader 1.4s 0.2s infinite ease-in-out;+.hexagon + .hexagon {+ margin-left: 16px;+ animation: hexloader 1.4s 0.2s infinite ease-in-out;background-color: #4faade;}-.circle + .circle + .circle {- margin-left: 12px;- animation: dotloader 1.4s 0.4s infinite ease-in-out;+.hexagon + .hexagon:before {+ border-bottom-color: #4faade;+}++.hexagon + .hexagon:after {+ border-top-color: #4faade;+}++.hexagon + .hexagon + .hexagon {+ margin-left: 16px;+ animation: hexloader 1.4s 0.4s infinite ease-in-out;background-color: #6041d0;}-@keyframes dotloader {+.hexagon + .hexagon + .hexagon:before {+ border-bottom-color: #6041d0;+}++.hexagon + .hexagon + .hexagon:after {+ border-top-color: #6041d0;+}++@keyframes hexloader {0%,80%,100% {@@ -164,7 +200,7 @@ p.is-editor-empty:first-child:before {opacity: 0;}40% {- transform: scale(1.2);+ transform: scale(1);opacity: 1;}}diff --git a/apps/starter/app/routes/_public+/callback.tsx b/apps/starter/app/routes/_public+/callback.tsxindex 8afdfa807a..94d5df0a29 100644--- a/apps/starter/app/routes/_public+/callback.tsx+++ b/apps/starter/app/routes/_public+/callback.tsx@@ -162,11 +162,11 @@ export default function AuthCallback() {</VStack></div>) : (- <div className="circle-loader-container">- <div className="circle-loader">- <div className="circle" />- <div className="circle" />- <div className="circle" />+ <div className="hexagon-loader-container">+ <div className="hexagon-loader">+ <div className="hexagon" />+ <div className="hexagon" />+ <div className="hexagon" /></div></div>)}diff --git a/apps/starter/app/styles/tailwind.css b/apps/starter/app/styles/tailwind.cssindex 22fe89ff9c..6711a1e203 100644--- a/apps/starter/app/styles/tailwind.css+++ b/apps/starter/app/styles/tailwind.css@@ -131,11 +131,11 @@ p.is-editor-empty:first-child:before {@apply ring-2 ring-primary cursor-move p-2 rounded-lg;}-.circle-loader-container {+.hexagon-loader-container {@apply relative w-full py-4;}-.circle-loader {+.hexagon-loader {position: relative;display: flex;justify-content: center;@@ -143,30 +143,66 @@ p.is-editor-empty:first-child:before {width: 100%;height: 40px;}-/* Three dot loading animation */-.circle {++/* Three hexagon loading animation */+.hexagon {display: inline-block;position: relative;- width: 16px;- height: 16px;+ width: 18px;+ height: 10px;background-color: #5fe4d3;- border-radius: 50%;- animation: dotloader 1.4s infinite ease-in-out;+ position: relative;+ animation: hexloader 1.4s infinite ease-in-out;+}++.hexagon:before,+.hexagon:after {+ content: "";+ position: absolute;+ width: 0;+ border-left: 9px solid transparent;+ border-right: 9px solid transparent;+}++.hexagon:before {+ bottom: 100%;+ border-bottom: 5px solid #5fe4d3;+}++.hexagon:after {+ top: 100%;+ border-top: 5px solid #5fe4d3;}-.circle + .circle {- margin-left: 12px;- animation: dotloader 1.4s 0.2s infinite ease-in-out;+.hexagon + .hexagon {+ margin-left: 16px;+ animation: hexloader 1.4s 0.2s infinite ease-in-out;background-color: #4faade;}-.circle + .circle + .circle {- margin-left: 12px;- animation: dotloader 1.4s 0.4s infinite ease-in-out;+.hexagon + .hexagon:before {+ border-bottom-color: #4faade;+}++.hexagon + .hexagon:after {+ border-top-color: #4faade;+}++.hexagon + .hexagon + .hexagon {+ margin-left: 16px;+ animation: hexloader 1.4s 0.4s infinite ease-in-out;background-color: #6041d0;}-@keyframes dotloader {+.hexagon + .hexagon + .hexagon:before {+ border-bottom-color: #6041d0;+}++.hexagon + .hexagon + .hexagon:after {+ border-top-color: #6041d0;+}++@keyframes hexloader {0%,80%,100% {@@ -174,7 +210,7 @@ p.is-editor-empty:first-child:before {opacity: 0;}40% {- transform: scale(1.2);+ transform: scale(1);opacity: 1;}}diff --git a/apps/university/app/routes/_auth+/callback.tsx b/apps/university/app/routes/_auth+/callback.tsxindex 05c7275678..46c3412cda 100644--- a/apps/university/app/routes/_auth+/callback.tsx+++ b/apps/university/app/routes/_auth+/callback.tsx@@ -162,11 +162,11 @@ export default function AuthCallback() {</VStack></div>) : (- <div className="circle-loader-container">- <div className="circle-loader">- <div className="circle" />- <div className="circle" />- <div className="circle" />+ <div className="hexagon-loader-container">+ <div className="hexagon-loader">+ <div className="hexagon" />+ <div className="hexagon" />+ <div className="hexagon" /></div></div>)}diff --git a/apps/university/app/styles/tailwind.css b/apps/university/app/styles/tailwind.cssindex e972f3ebb5..5a7db76a08 100644--- a/apps/university/app/styles/tailwind.css+++ b/apps/university/app/styles/tailwind.css@@ -137,11 +137,11 @@ a.active {font-weight: 600;}-.circle-loader-container {+.hexagon-loader-container {@apply relative w-full py-4;}-.circle-loader {+.hexagon-loader {position: relative;display: flex;justify-content: center;@@ -149,30 +149,66 @@ a.active {width: 100%;height: 40px;}-/* Three dot loading animation */-.circle {++/* Three hexagon loading animation */+.hexagon {display: inline-block;position: relative;- width: 16px;- height: 16px;+ width: 18px;+ height: 10px;background-color: #5fe4d3;- border-radius: 50%;- animation: dotloader 1.4s infinite ease-in-out;+ position: relative;+ animation: hexloader 1.4s infinite ease-in-out;+}++.hexagon:before,+.hexagon:after {+ content: "";+ position: absolute;+ width: 0;+ border-left: 9px solid transparent;+ border-right: 9px solid transparent;+}++.hexagon:before {+ bottom: 100%;+ border-bottom: 5px solid #5fe4d3;+}++.hexagon:after {+ top: 100%;+ border-top: 5px solid #5fe4d3;}-.circle + .circle {- margin-left: 12px;- animation: dotloader 1.4s 0.2s infinite ease-in-out;+.hexagon + .hexagon {+ margin-left: 16px;+ animation: hexloader 1.4s 0.2s infinite ease-in-out;background-color: #4faade;}-.circle + .circle + .circle {- margin-left: 12px;- animation: dotloader 1.4s 0.4s infinite ease-in-out;+.hexagon + .hexagon:before {+ border-bottom-color: #4faade;+}++.hexagon + .hexagon:after {+ border-top-color: #4faade;+}++.hexagon + .hexagon + .hexagon {+ margin-left: 16px;+ animation: hexloader 1.4s 0.4s infinite ease-in-out;background-color: #6041d0;}-@keyframes dotloader {+.hexagon + .hexagon + .hexagon:before {+ border-bottom-color: #6041d0;+}++.hexagon + .hexagon + .hexagon:after {+ border-top-color: #6041d0;+}++@keyframes hexloader {0%,80%,100% {@@ -180,7 +216,7 @@ a.active {opacity: 0;}40% {- transform: scale(1.2);+ transform: scale(1);opacity: 1;}}diff --git a/packages/database/src/seed.ts b/packages/database/src/seed.tsindex 52ddbe7641..33608ceecc 100644--- a/packages/database/src/seed.ts+++ b/packages/database/src/seed.ts@@ -17,35 +17,7 @@ const supabaseAdmin = createClient<Database>(});-// const getUserId = async (): Promise<string> => {-// const existingUserId = await supabaseAdmin.auth.admin-// .listUsers()-// .then(-// ({ data }) =>-// data.users.find((user: User) => user?.email! === admin.email)?.id-// );--// if (existingUserId) return existingUserId;--// const newUserId = await supabaseAdmin.auth.admin-// .createUser({-// email: admin.email,-// password: admin.password,-// email_confirm: true,-// })-// .then(({ data }) => data.user?.id)-// .catch((e) => {-// throw e;-// });--// if (newUserId) return newUserId;--// throw new Error("Could not create or get user");-// };-async function seed() {- // const id = await getUserId();-const upsertConfig = await supabaseAdmin.from("config").upsert([{id: true,@@ -68,29 +40,6 @@ async function seed() {if (upsertPlans.error) throw upsertPlans.error;- // const upsertAdmin = await supabaseAdmin.from("user").upsert([- // {- // id,- // email: admin.email,- // firstName: admin.firstName,- // lastName: admin.lastName,- // },- // ]);- // if (upsertAdmin.error) throw upsertAdmin.error;-- // const upsertPermissions = await supabaseAdmin.from("userPermission").upsert([- // {- // id: id,- // permissions,- // },- // ]);- // if (upsertPermissions.error) throw upsertPermissions.error;-- // // give the admin user all the claims- // await supabaseAdmin.auth.admin.updateUserById(id, {- // app_metadata: claims,- // });-console.log(`Database has been seeded. 🌱\n`);console.log(`Admin user is 👇 \n📧: ${admin.email}\n🔑: ${admin.password}`);}diff --git a/packages/database/src/seed/admin.ts b/packages/database/src/seed/admin.tsindex 7ae540b407..a466991d63 100644--- a/packages/database/src/seed/admin.ts+++ b/packages/database/src/seed/admin.ts@@ -8,15 +8,10 @@ const admin = {lastName: "Admin",};-const ALL_TEAMS_ID = "0";-const claims: Record<string, string> = {role: "employee",};-const permissions: Record<string, string[]> = {- settings_update: [ALL_TEAMS_ID],- users_update: [ALL_TEAMS_ID],-};+const permissions: Record<string, string[]> = {};export { admin, claims, permissions };diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.tsindex 7418948010..b4448c312e 100644--- a/packages/database/src/swagger-docs-schema.ts+++ b/packages/database/src/swagger-docs-schema.ts@@ -41307,6 +41307,9 @@ export default {{$ref: "#/parameters/rowFilter.company.slackChannel",},+ {+ $ref: "#/parameters/rowFilter.company.ownerId",+ },{$ref: "#/parameters/select",},@@ -41426,6 +41429,9 @@ export default {{$ref: "#/parameters/rowFilter.company.slackChannel",},+ {+ $ref: "#/parameters/rowFilter.company.ownerId",+ },{$ref: "#/parameters/preferReturn",},@@ -41499,6 +41505,9 @@ export default {{$ref: "#/parameters/rowFilter.company.slackChannel",},+ {+ $ref: "#/parameters/rowFilter.company.ownerId",+ },{$ref: "#/parameters/body.company",},@@ -76899,6 +76908,10 @@ export default {format: "text",type: "string",},+ ownerId: {+ format: "text",+ type: "string",+ },},type: "object",},@@ -76993,10 +77006,12 @@ export default {type: "string",},firstName: {+ default: "",format: "text",type: "string",},lastName: {+ default: "",format: "text",type: "string",},@@ -104207,6 +104222,12 @@ export default {in: "query",type: "string",},+ "rowFilter.company.ownerId": {+ name: "ownerId",+ required: false,+ in: "query",+ type: "string",+ },"body.salesOrderLocations": {name: "salesOrderLocations",description: "salesOrderLocations",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 5028740fb7..88ad2957d0 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -1982,6 +1982,7 @@ export type Database = {logoLight: string | nulllogoLightIcon: string | nullname: string+ ownerId: string | nullphone: string | nullpostalCode: string | nullslackChannel: string | null@@ -2004,6 +2005,7 @@ export type Database = {logoLight?: string | nulllogoLightIcon?: string | nullname: string+ ownerId?: string | nullphone?: string | nullpostalCode?: string | nullslackChannel?: string | null@@ -2026,6 +2028,7 @@ export type Database = {logoLight?: string | nulllogoLightIcon?: string | nullname?: string+ ownerId?: string | nullphone?: string | nullpostalCode?: string | nullslackChannel?: string | null@@ -33379,10 +33382,10 @@ export type Database = {createdAt?: stringdeveloper?: boolean | nullemail: string- firstName: string+ firstName?: stringfullName?: string | nullid: string- lastName: string+ lastName?: stringupdatedAt?: string | null}Update: {diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 5028740fb7..88ad2957d0 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -1982,6 +1982,7 @@ export type Database = {logoLight: string | nulllogoLightIcon: string | nullname: string+ ownerId: string | nullphone: string | nullpostalCode: string | nullslackChannel: string | null@@ -2004,6 +2005,7 @@ export type Database = {logoLight?: string | nulllogoLightIcon?: string | nullname: string+ ownerId?: string | nullphone?: string | nullpostalCode?: string | nullslackChannel?: string | null@@ -2026,6 +2028,7 @@ export type Database = {logoLight?: string | nulllogoLightIcon?: string | nullname?: string+ ownerId?: string | nullphone?: string | nullpostalCode?: string | nullslackChannel?: string | null@@ -33379,10 +33382,10 @@ export type Database = {createdAt?: stringdeveloper?: boolean | nullemail: string- firstName: string+ firstName?: stringfullName?: string | nullid: string- lastName: string+ lastName?: stringupdatedAt?: string | null}Update: {diff --git a/packages/database/supabase/migrations/20250619100940_billing.sql b/packages/database/supabase/migrations/20250619100940_billing.sqlindex 9cb9f950c0..da040f0b30 100644--- a/packages/database/supabase/migrations/20250619100940_billing.sql+++ b/packages/database/supabase/migrations/20250619100940_billing.sql@@ -1,3 +1,61 @@+ALTER TABLE "company" ADD COLUMN "ownerId" TEXT;+ALTER TABLE "user" ALTER COLUMN "firstName" SET DEFAULT '';+ALTER TABLE "user" ALTER COLUMN "lastName" SET DEFAULT '';++ALTER POLICY "Users can view other users from their same company" ON "user" USING (+ id = auth.uid()::text OR+ "id" IN (+ SELECT "userId" FROM "userToCompany" WHERE "companyId" IN (+ SELECT "companyId" FROM "userToCompany" WHERE "userId" = auth.uid()::text+ )+ )+);+++CREATE OR REPLACE FUNCTION public.create_public_user()+RETURNS TRIGGER AS $$+DECLARE+ full_name TEXT;+ name_parts TEXT[];+BEGIN+ -- Get the full name from raw_user_metadata if it exists+ full_name := NEW.raw_user_meta_data->>'name';++ -- Split name into parts if we have a full name+ IF full_name IS NOT NULL THEN+ name_parts := regexp_split_to_array(full_name, '\s+');+ INSERT INTO public."user" ("id", "email", "active", "firstName", "lastName", "about")+ VALUES (+ NEW.id,+ NEW.email,+ true,+ COALESCE(name_parts[1], ''),+ COALESCE(array_to_string(name_parts[2:], ' '), ''),+ ''+ );+ ELSE+ -- Use firstName/lastName from user_metadata if available, otherwise empty strings+ INSERT INTO public."user" ("id", "email", "active", "firstName", "lastName", "about")+ VALUES (+ NEW.id,+ NEW.email,+ true,+ '',+ '',+ ''+ );+ END IF;++ INSERT INTO public."userPermission" (id) VALUES (NEW.id);+ RETURN NEW;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER on_auth_user_created+ AFTER INSERT ON auth.users+ FOR EACH ROW EXECUTE PROCEDURE public.create_public_user();++CREATE TABLE "plan" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,diff --git a/packages/database/supabase/seed.sql b/packages/database/supabase/seed.sqlindex 98bedff39a..b33ce06d1f 100644--- a/packages/database/supabase/seed.sql+++ b/packages/database/supabase/seed.sql@@ -46,7 +46,7 @@ WITH new_auth_user AS (false) RETURNING id),-auth_identities AS (+new_user_identity AS (INSERT INTO auth.identities (user_id,provider_id,@@ -65,36 +65,6 @@ auth_identities AS (CURRENT_TIMESTAMP,CURRENT_TIMESTAMPFROM new_auth_user- ON CONFLICT (provider_id, provider) DO NOTHING-),-new_user AS (- INSERT INTO public."user" (- id, email, "firstName", "lastName", about, "avatarUrl",- active, "createdAt", "updatedAt", developer, admin- )- SELECT- id,- '[email protected]',- 'Brad',- 'Barbin',- '',- NULL,- true,- '2025-03-14 19:25:59.271544+00',- NULL,- false,- false- FROM new_auth_user- RETURNING id+ RETURNING user_id)--- Insert admin user permissions-INSERT INTO public."userPermission" (- id, permissions-)-SELECT- id,- '{- "users_update": [],- "settings_update": []- }'-FROM new_user;\ No newline at end of file+SELECT user_id FROM new_user_identity;\ No newline at end of filediff --git a/packages/react/src/Toast.tsx b/packages/react/src/Toast.tsxindex 26a4e79990..b115958640 100644--- a/packages/react/src/Toast.tsx+++ b/packages/react/src/Toast.tsx@@ -18,7 +18,7 @@ const Toaster = ({ ...props }: ToasterProps) => {cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",success:- "group-[.toaster]:bg-emerald-600 group-[.toaster]:text-emerald-100 dark:group-[.toaster]:bg-emerald-900 group-[.toaster]:border-emerald-600 dark:group-[.toaster]:text-emerald-400 group-[.toaster]:text-white",+ "group-[.toaster]:bg-blue-600 group-[.toaster]:text-blue-100 dark:group-[.toaster]:bg-blue-900 group-[.toaster]:border-blue-600 dark:group-[.toaster]:text-blue-400 group-[.toaster]:text-white",error:"group-[.toaster]:bg-red-600 group-[.toaster]:text-red-100 dark:group-[.toaster]:bg-red-900 group-[.toaster]:border-red-600 dark:group-[.toaster]:text-red-400 group-[.toaster]:text-white",},diff --git a/scripts/migrations/part-revision-merges.ts b/scripts/migrations/part-revision-merges.tsindex 19ad5c0343..27dee5a964 100644--- a/scripts/migrations/part-revision-merges.ts+++ b/scripts/migrations/part-revision-merges.ts@@ -10,7 +10,7 @@ const COMPANY_ID = "cs868u84gfk07v78v9e0";const PROD: boolean = true;const READ_ONLY: boolean = false;-const sourceFile = resolve(homedir(), "Desktop/black-cat-renames-2.csv");+const sourceFile = resolve(homedir(), "Downloads/black-cat-july-3.csv");const columns = ["ID", "OLD", "NEW", "REVISION"];const parser = parse({@@ -62,7 +62,7 @@ const client = createClient(supabaseUrl, supabaseServiceRoleKey);client.from("item").select("*")- .eq("readableId", row.OLD.trim())+ .eq("id", row.ID.trim()).eq("companyId", COMPANY_ID).single(),client