Skip to content

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.

Remove prisma (#8)

Brad Barbinf3e81da72a6d
diff --git a/README.md b/README.md
index e2a903c130..d36ff73a40 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,6 @@ The monorepo follows the Turborepo covention of grouping packages into one of tw
- [Postgres](https://postgresql.org/)
- [Redis](https://redis.io)
- [BullMQ](https://docs.bullmq.io)
-- [Prisma](https://prisma.io/)
- [Turborepo](https://turbo.build)
## Local Development
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx
similarity index 93%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx
index 66c748a352..cfe2289068 100644
--- a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx
+++ b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx
@@ -59,7 +59,7 @@ const AttributeCategoriesTable = memo(
<Button
onClick={() => {
navigate(
- `/app/users/attributes/list/${
+ `/app/people/attributes/list/${
row.original.id
}?${params.toString()}`
);
@@ -75,7 +75,7 @@ const AttributeCategoriesTable = memo(
icon={<BsPlus />}
onClick={() => {
navigate(
- `/app/users/attributes/list/${
+ `/app/people/attributes/list/${
row.original.id
}/new?${params.toString()}`
);
@@ -111,7 +111,7 @@ const AttributeCategoriesTable = memo(
icon={<BiAddToQueue />}
onClick={() => {
navigate(
- `/app/users/attributes/list/${
+ `/app/people/attributes/list/${
row.original.id
}/new?${params.toString()}`
);
@@ -123,7 +123,7 @@ const AttributeCategoriesTable = memo(
icon={<BsListUl />}
onClick={() => {
navigate(
- `/app/users/attributes/list/${
+ `/app/people/attributes/list/${
row.original.id
}?${params.toString()}`
);
@@ -134,7 +134,7 @@ const AttributeCategoriesTable = memo(
<MenuItem
icon={<BsPencilSquare />}
onClick={() => {
- navigate(`/app/users/attributes/${row.original.id}`);
+ navigate(`/app/people/attributes/${row.original.id}`);
}}
>
Edit Attribute Category
@@ -166,7 +166,7 @@ const AttributeCategoriesTable = memo(
/>
<ConfirmDelete
- action={`/app/users/attributes/delete/${selectedCategory?.id}`}
+ action={`/app/people/attributes/delete/${selectedCategory?.id}`}
name={selectedCategory?.name ?? ""}
text={`Are you sure you want to deactivate the ${selectedCategory?.name} attribute category?`}
isOpen={deleteModal.isOpen}
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTable/index.ts b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTable/index.ts
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTable/index.ts
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTable/index.ts
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsx b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsx
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsx
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsx
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTableFilters/index.ts b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTableFilters/index.ts
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoriesTableFilters/index.ts
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoriesTableFilters/index.ts
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
similarity index 98%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
index 7af2014148..3f13e13e10 100644
--- a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
+++ b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
@@ -202,7 +202,7 @@ const AttributeCategoryDetail = ({
</Drawer>
<ConfirmDelete
isOpen={deleteModal.isOpen}
- action={`/app/users/attribute/delete/${selectedAttribute?.id}`}
+ action={`/app/people/attribute/delete/${selectedAttribute?.id}`}
name={selectedAttribute?.name ?? ""}
text={`Are you sure you want to deactivate the ${selectedAttribute?.name} attribute?`}
onCancel={onDeleteCancel}
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryDetail/index.ts b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoryDetail/index.ts
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryDetail/index.ts
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoryDetail/index.ts
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx
similarity index 91%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx
index 87d3e697d5..e3ef3e3210 100644
--- a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx
+++ b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx
@@ -12,7 +12,7 @@ import {
} from "@chakra-ui/react";
import { ValidatedForm } from "remix-validated-form";
import { Boolean, Input, Hidden, Submit } from "~/components/Form";
-import { attributeCategoryValidator } from "~/services/users";
+import { attributeCategoryValidator } from "~/services/people";
type AttributeCategoryFormProps = {
initialValues: {
@@ -36,8 +36,8 @@ const AttributeCategoryForm = ({
method="post"
action={
isEditing
- ? `/app/users/attributes/${initialValues.id}`
- : "/app/users/attributes/new"
+ ? `/app/people/attributes/${initialValues.id}`
+ : "/app/people/attributes/new"
}
defaultValues={initialValues}
>
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryForm/index.ts b/apps/carbon/app/interfaces/People/Attributes/AttributeCategoryForm/index.ts
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeCategoryForm/index.ts
rename to apps/carbon/app/interfaces/People/Attributes/AttributeCategoryForm/index.ts
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeForm/AttributeForm.tsx b/apps/carbon/app/interfaces/People/Attributes/AttributeForm/AttributeForm.tsx
similarity index 95%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeForm/AttributeForm.tsx
rename to apps/carbon/app/interfaces/People/Attributes/AttributeForm/AttributeForm.tsx
index 05d19546de..d2bc491b3e 100644
--- a/apps/carbon/app/interfaces/Users/Attributes/AttributeForm/AttributeForm.tsx
+++ b/apps/carbon/app/interfaces/People/Attributes/AttributeForm/AttributeForm.tsx
@@ -21,7 +21,7 @@ import {
Select,
} from "~/components/Form";
import { DataType } from "~/interfaces/Users/types";
-import { attributeValidator } from "~/services/users";
+import { attributeValidator } from "~/services/people";
import { mapRowsToOptions } from "~/utils/form";
type AttributeFormProps = {
@@ -74,8 +74,8 @@ const AttributeForm = ({
method="post"
action={
isEditing
- ? `/app/users/attribute/${initialValues.id}`
- : "/app/users/attribute/new"
+ ? `/app/people/attribute/${initialValues.id}`
+ : "/app/people/attribute/new"
}
defaultValues={initialValues}
>
diff --git a/apps/carbon/app/interfaces/Users/Attributes/AttributeForm/index.ts b/apps/carbon/app/interfaces/People/Attributes/AttributeForm/index.ts
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/AttributeForm/index.ts
rename to apps/carbon/app/interfaces/People/Attributes/AttributeForm/index.ts
diff --git a/apps/carbon/app/interfaces/Users/Attributes/index.ts b/apps/carbon/app/interfaces/People/Attributes/index.ts
similarity index 100%
rename from apps/carbon/app/interfaces/Users/Attributes/index.ts
rename to apps/carbon/app/interfaces/People/Attributes/index.ts
diff --git a/apps/carbon/app/interfaces/People/index.ts b/apps/carbon/app/interfaces/People/index.ts
new file mode 100644
index 0000000000..c8764b99c6
--- /dev/null
+++ b/apps/carbon/app/interfaces/People/index.ts
@@ -0,0 +1,3 @@
+import usePeopleSidebar from "./usePeopleSidebar";
+
+export { usePeopleSidebar };
diff --git a/apps/carbon/app/interfaces/People/types.ts b/apps/carbon/app/interfaces/People/types.ts
new file mode 100644
index 0000000000..aab308bba4
--- /dev/null
+++ b/apps/carbon/app/interfaces/People/types.ts
@@ -0,0 +1,27 @@
+import type {
+ getAttribute,
+ getAttributeCategories,
+ getAttributeCategory,
+} from "~/services/people";
+
+export type Attribute = NonNullable<
+ Awaited<ReturnType<typeof getAttribute>>["data"]
+>;
+
+export type AttributeCategory = NonNullable<
+ Awaited<ReturnType<typeof getAttributeCategories>>["data"]
+>[number];
+
+export type AttributeCategoryDetail = NonNullable<
+ Awaited<ReturnType<typeof getAttributeCategory>>["data"]
+>;
+
+export type AttributeDataType = {
+ id: number;
+ label: string;
+ isBoolean: boolean;
+ isDate: boolean;
+ isList: boolean;
+ isNumeric: boolean;
+ isText: boolean;
+};
diff --git a/apps/carbon/app/interfaces/People/usePeopleSidebar.tsx b/apps/carbon/app/interfaces/People/usePeopleSidebar.tsx
new file mode 100644
index 0000000000..131db9df90
--- /dev/null
+++ b/apps/carbon/app/interfaces/People/usePeopleSidebar.tsx
@@ -0,0 +1,20 @@
+import type { Route } from "~/types";
+
+const usersRoutes: Record<string, Route[]>[] = [
+ {
+ Configuration: [
+ {
+ name: "Attributes",
+ to: "/app/people/attributes",
+ },
+ {
+ name: "Skills",
+ to: "/app/people/skills",
+ },
+ ],
+ },
+];
+
+export default function usePeopleSidebar() {
+ return { links: usersRoutes };
+}
diff --git a/apps/carbon/app/interfaces/Users/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx b/apps/carbon/app/interfaces/Users/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx
index d370d60c18..bef52d3efa 100644
--- a/apps/carbon/app/interfaces/Users/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx
+++ b/apps/carbon/app/interfaces/Users/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx
@@ -3,8 +3,8 @@ import {
Flex,
HStack,
MenuItem,
- useDisclosure,
VisuallyHidden,
+ useDisclosure,
} from "@chakra-ui/react";
import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
diff --git a/apps/carbon/app/interfaces/Users/types.ts b/apps/carbon/app/interfaces/Users/types.ts
index 5d6de43f61..2d01a059d2 100644
--- a/apps/carbon/app/interfaces/Users/types.ts
+++ b/apps/carbon/app/interfaces/Users/types.ts
@@ -1,8 +1,5 @@
import type { Database } from "@carbon/database";
import type {
- getAttribute,
- getAttributeCategories,
- getAttributeCategory,
getCustomers,
getEmployees,
getEmployeeTypes,
@@ -12,28 +9,6 @@ import type {
getUsers,
} from "~/services/users";
-export type Attribute = NonNullable<
- Awaited<ReturnType<typeof getAttribute>>["data"]
->;
-
-export type AttributeCategory = NonNullable<
- Awaited<ReturnType<typeof getAttributeCategories>>["data"]
->[number];
-
-export type AttributeCategoryDetail = NonNullable<
- Awaited<ReturnType<typeof getAttributeCategory>>["data"]
->;
-
-export type AttributeDataType = {
- id: number;
- label: string;
- isBoolean: boolean;
- isDate: boolean;
- isList: boolean;
- isNumeric: boolean;
- isText: boolean;
-};
-
export type Customer = NonNullable<
Awaited<ReturnType<typeof getCustomers>>["data"]
>[number];
diff --git a/apps/carbon/app/interfaces/Users/useUsersSidebar.tsx b/apps/carbon/app/interfaces/Users/useUsersSidebar.tsx
index 1af8d963ea..fd20993b6f 100644
--- a/apps/carbon/app/interfaces/Users/useUsersSidebar.tsx
+++ b/apps/carbon/app/interfaces/Users/useUsersSidebar.tsx
@@ -23,10 +23,6 @@ const usersRoutes: Record<string, Route[]>[] = [
},
{
Configuration: [
- {
- name: "Attributes",
- to: "/app/users/attributes",
- },
{
name: "Employee Types",
to: "/app/users/employee-types",
diff --git a/apps/carbon/app/routes/app.account.$userId.attribute.tsx b/apps/carbon/app/routes/app.account.$userId.attribute.tsx
index b3b429803d..dfbef1d5d3 100644
--- a/apps/carbon/app/routes/app.account.$userId.attribute.tsx
+++ b/apps/carbon/app/routes/app.account.$userId.attribute.tsx
@@ -10,9 +10,10 @@ import {
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session";
import { upsertUserAttributeValue } from "~/services/account";
+import { getAttribute } from "~/services/people";
+import { getPermissions } from "~/services/users";
import { assertIsPost } from "~/utils/http";
import { error, success } from "~/utils/result";
-import { getAttribute, getPermissions } from "~/services/users";
export async function action({ request, params }: ActionArgs) {
assertIsPost(request);
diff --git a/apps/carbon/app/routes/app.account.$userId.delete.attribute.tsx b/apps/carbon/app/routes/app.account.$userId.delete.attribute.tsx
index 135c07d1d1..d23539db89 100644
--- a/apps/carbon/app/routes/app.account.$userId.delete.attribute.tsx
+++ b/apps/carbon/app/routes/app.account.$userId.delete.attribute.tsx
@@ -3,9 +3,10 @@ import { json } from "@remix-run/node";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session";
import { deleteUserAttributeValue } from "~/services/account";
+import { getAttribute } from "~/services/people";
+import { getPermissions } from "~/services/users";
import { assertIsPost } from "~/utils/http";
import { error, success } from "~/utils/result";
-import { getAttribute, getPermissions } from "~/services/users";
export async function action({ request, params }: ActionArgs) {
assertIsPost(request);
diff --git a/apps/carbon/app/routes/app.users.attribute.$attributeId.tsx b/apps/carbon/app/routes/app.people.attribute.$attributeId.tsx
similarity index 91%
rename from apps/carbon/app/routes/app.users.attribute.$attributeId.tsx
rename to apps/carbon/app/routes/app.people.attribute.$attributeId.tsx
index 3cbccb5a1b..9a3298219b 100644
--- a/apps/carbon/app/routes/app.users.attribute.$attributeId.tsx
+++ b/apps/carbon/app/routes/app.people.attribute.$attributeId.tsx
@@ -2,15 +2,15 @@ import type { ActionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { validationError } from "remix-validated-form";
import { requirePermissions } from "~/services/auth";
+import { attributeValidator, updateAttribute } from "~/services/people";
import { flash } from "~/services/session";
-import { attributeValidator, updateAttribute } from "~/services/users";
import { assertIsPost } from "~/utils/http";
import { error, success } from "~/utils/result";
export async function action({ request, params }: ActionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- update: "users",
+ update: "people",
});
const validation = await attributeValidator.validate(
@@ -27,12 +27,12 @@ export async function action({ request, params }: ActionArgs) {
});
if (update.error)
redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, error(update.error, "Failed to update attribute"))
);
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, success("Successfully updated attribtue"))
);
}
diff --git a/apps/carbon/app/routes/app.users.attribute.delete.$attributeId.tsx b/apps/carbon/app/routes/app.people.attribute.delete.$attributeId.tsx
similarity index 84%
rename from apps/carbon/app/routes/app.users.attribute.delete.$attributeId.tsx
rename to apps/carbon/app/routes/app.people.attribute.delete.$attributeId.tsx
index 21c1459e41..5a3812ce5b 100644
--- a/apps/carbon/app/routes/app.users.attribute.delete.$attributeId.tsx
+++ b/apps/carbon/app/routes/app.people.attribute.delete.$attributeId.tsx
@@ -1,19 +1,19 @@
import type { LoaderArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { requirePermissions } from "~/services/auth";
-import { deleteAttribute } from "~/services/users";
+import { deleteAttribute } from "~/services/people";
import { flash } from "~/services/session";
import { error, success } from "~/utils/result";
export async function action({ request, params }: LoaderArgs) {
const { client } = await requirePermissions(request, {
- update: "users",
+ update: "people",
});
const { attributeId } = params;
if (!attributeId) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, error(params, "Failed to get an attribute id"))
);
}
@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderArgs) {
const deactivateAttribute = await deleteAttribute(client, attributeId);
if (deactivateAttribute.error) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(
request,
error(deactivateAttribute.error, "Failed to deactivate attribute")
@@ -30,7 +30,7 @@ export async function action({ request, params }: LoaderArgs) {
}
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, success("Successfully deactivated attribute"))
);
}
diff --git a/apps/carbon/app/routes/app.users.attribute.new.tsx b/apps/carbon/app/routes/app.people.attribute.new.tsx
similarity index 95%
rename from apps/carbon/app/routes/app.users.attribute.new.tsx
rename to apps/carbon/app/routes/app.people.attribute.new.tsx
index e0b1ff3651..ba2a086d8a 100644
--- a/apps/carbon/app/routes/app.users.attribute.new.tsx
+++ b/apps/carbon/app/routes/app.people.attribute.new.tsx
@@ -4,14 +4,14 @@ import { redirect } from "@remix-run/node";
import { validationError } from "remix-validated-form";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session";
-import { attributeValidator, insertAttribute } from "~/services/users";
+import { attributeValidator, insertAttribute } from "~/services/people";
import { assertIsPost } from "~/utils/http";
import { error, success } from "~/utils/result";
export async function action({ request }: ActionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- create: "users",
+ create: "people",
});
const validation = await attributeValidator.validate(
@@ -49,7 +49,7 @@ export async function action({ request }: ActionArgs) {
}
return redirect(
- `/app/users/attributes`,
+ `/app/people/attributes`,
await flash(request, success("Created attribute"))
);
}
diff --git a/apps/carbon/app/routes/app.users.attributes.$categoryId.tsx b/apps/carbon/app/routes/app.people.attributes.$categoryId.tsx
similarity index 88%
rename from apps/carbon/app/routes/app.users.attributes.$categoryId.tsx
rename to apps/carbon/app/routes/app.people.attributes.$categoryId.tsx
index 33036c78df..aff9cb234a 100644
--- a/apps/carbon/app/routes/app.users.attributes.$categoryId.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.$categoryId.tsx
@@ -2,20 +2,20 @@ import type { ActionArgs, LoaderArgs } from "@remix-run/node";
import { redirect, json } from "@remix-run/node";
import { useLoaderData, useNavigate } from "@remix-run/react";
import { validationError } from "remix-validated-form";
-import { AttributeCategoryForm } from "~/interfaces/Users/Attributes";
+import { AttributeCategoryForm } from "~/interfaces/People/Attributes";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session";
import {
attributeCategoryValidator,
getAttributeCategory,
updateAttributeCategory,
-} from "~/services/users";
+} from "~/services/people";
import { assertIsPost, notFound } from "~/utils/http";
import { error, success } from "~/utils/result";
export async function loader({ request, params }: LoaderArgs) {
const { client } = await requirePermissions(request, {
- view: "users",
+ view: "people",
});
const { categoryId } = params;
@@ -28,7 +28,7 @@ export async function loader({ request, params }: LoaderArgs) {
);
if (attributeCategory.error) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(
request,
error(attributeCategory.error, "Failed to fetch attribute category")
@@ -42,7 +42,7 @@ export async function loader({ request, params }: LoaderArgs) {
export async function action({ request }: ActionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- update: "users",
+ update: "people",
});
const validation = await attributeCategoryValidator.validate(
@@ -64,7 +64,7 @@ export async function action({ request }: ActionArgs) {
});
if (updateCategory.error) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(
request,
error(updateCategory.error, "Failed to update attribute category")
@@ -73,7 +73,7 @@ export async function action({ request }: ActionArgs) {
}
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, success("Updated attribute category "))
);
}
@@ -81,7 +81,7 @@ export async function action({ request }: ActionArgs) {
export default function EditAttributeCategoryRoute() {
const { attributeCategory } = useLoaderData<typeof loader>();
const navigate = useNavigate();
- const onClose = () => navigate("/app/users/attributes/");
+ const onClose = () => navigate("/app/people/attributes/");
const initialValues = {
id: attributeCategory?.id,
diff --git a/apps/carbon/app/routes/app.users.attributes.delete.$categoryId.tsx b/apps/carbon/app/routes/app.people.attributes.delete.$categoryId.tsx
similarity index 84%
rename from apps/carbon/app/routes/app.users.attributes.delete.$categoryId.tsx
rename to apps/carbon/app/routes/app.people.attributes.delete.$categoryId.tsx
index 9a1772c88b..a1950058ec 100644
--- a/apps/carbon/app/routes/app.users.attributes.delete.$categoryId.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.delete.$categoryId.tsx
@@ -1,19 +1,19 @@
import type { LoaderArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { requirePermissions } from "~/services/auth";
-import { deleteAttributeCategory } from "~/services/users";
+import { deleteAttributeCategory } from "~/services/people";
import { flash } from "~/services/session";
import { error, success } from "~/utils/result";
export async function action({ request, params }: LoaderArgs) {
const { client } = await requirePermissions(request, {
- update: "users",
+ update: "people",
});
const { categoryId } = params;
if (!categoryId) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, error(params, "Failed to get a category id"))
);
}
@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderArgs) {
const deactivateAttribute = await deleteAttributeCategory(client, categoryId);
if (deactivateAttribute.error) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(
request,
error(
@@ -33,7 +33,7 @@ export async function action({ request, params }: LoaderArgs) {
}
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, success("Successfully deactivated attribute category"))
);
}
diff --git a/apps/carbon/app/routes/app.users.attributes.list.$categoryId.$attributeId.tsx b/apps/carbon/app/routes/app.people.attributes.list.$categoryId.$attributeId.tsx
similarity index 83%
rename from apps/carbon/app/routes/app.users.attributes.list.$categoryId.$attributeId.tsx
rename to apps/carbon/app/routes/app.people.attributes.list.$categoryId.$attributeId.tsx
index 711ba070e2..9b01966021 100644
--- a/apps/carbon/app/routes/app.users.attributes.list.$categoryId.$attributeId.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.list.$categoryId.$attributeId.tsx
@@ -3,17 +3,17 @@ import { redirect } from "@remix-run/node";
import { json } from "@remix-run/node";
import { useLoaderData, useNavigate, useParams } from "@remix-run/react";
import { useRouteData } from "~/hooks";
-import { AttributeForm } from "~/interfaces/Users/Attributes";
-import type { AttributeDataType } from "~/interfaces/Users/types";
+import { AttributeForm } from "~/interfaces/People/Attributes";
+import type { AttributeDataType } from "~/interfaces/People/types";
import { requirePermissions } from "~/services/auth";
+import { getAttribute } from "~/services/people";
import { flash } from "~/services/session";
-import { getAttribute } from "~/services/users";
import { notFound } from "~/utils/http";
import { error } from "~/utils/result";
export async function loader({ request, params }: LoaderArgs) {
const { client } = await requirePermissions(request, {
- view: "users",
+ view: "people",
});
const { categoryId, attributeId } = params;
@@ -23,7 +23,7 @@ export async function loader({ request, params }: LoaderArgs) {
const attribute = await getAttribute(client, Number(attributeId));
if (attribute.error) {
return redirect(
- `/app/users/attributes/list/${categoryId}`,
+ `/app/people/attributes/list/${categoryId}`,
await flash(request, error(attribute.error, "Failed to fetch attribute"))
);
}
@@ -39,12 +39,12 @@ export default function EditAttributeRoute() {
if (Number.isNaN(categoryId)) throw new Error("categoryId is not a number");
const navigate = useNavigate();
- const onClose = () => navigate(`/app/users/attributes/list/${categoryId}`);
+ const onClose = () => navigate(`/app/people/attributes/list/${categoryId}`);
const attributesRouteData = useRouteData<{
dataTypes: {
data: AttributeDataType[] | null;
};
- }>("/app/users/attributes");
+ }>("/app/people/attributes");
return (
<AttributeForm
diff --git a/apps/carbon/app/routes/app.users.attributes.list.$categoryId.new.tsx b/apps/carbon/app/routes/app.people.attributes.list.$categoryId.new.tsx
similarity index 81%
rename from apps/carbon/app/routes/app.users.attributes.list.$categoryId.new.tsx
rename to apps/carbon/app/routes/app.people.attributes.list.$categoryId.new.tsx
index 6e2f26b1fd..b8ac345f51 100644
--- a/apps/carbon/app/routes/app.users.attributes.list.$categoryId.new.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.list.$categoryId.new.tsx
@@ -1,7 +1,7 @@
import { useNavigate, useParams } from "@remix-run/react";
import { useRouteData } from "~/hooks";
-import { AttributeForm } from "~/interfaces/Users/Attributes";
-import type { AttributeDataType } from "~/interfaces/Users/types";
+import { AttributeForm } from "~/interfaces/People/Attributes";
+import type { AttributeDataType } from "~/interfaces/People/types";
export default function NewAttributeRoute() {
const { categoryId } = useParams();
@@ -13,7 +13,7 @@ export default function NewAttributeRoute() {
dataTypes: {
data: AttributeDataType[] | null;
};
- }>("/app/users/attributes");
+ }>("/app/people/attributes");
return (
<AttributeForm
diff --git a/apps/carbon/app/routes/app.users.attributes.list.$categoryId.tsx b/apps/carbon/app/routes/app.people.attributes.list.$categoryId.tsx
similarity index 89%
rename from apps/carbon/app/routes/app.users.attributes.list.$categoryId.tsx
rename to apps/carbon/app/routes/app.people.attributes.list.$categoryId.tsx
index 6ff6ff4b1e..0075ddd556 100644
--- a/apps/carbon/app/routes/app.users.attributes.list.$categoryId.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.list.$categoryId.tsx
@@ -2,19 +2,19 @@ import type { ActionArgs, LoaderArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Outlet, useLoaderData, useNavigate } from "@remix-run/react";
import { useUrlParams } from "~/hooks";
-import { AttributeCategoryDetail } from "~/interfaces/Users/Attributes";
+import { AttributeCategoryDetail } from "~/interfaces/People/Attributes";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session";
import {
getAttributeCategory,
updateAttributeSortOrder,
-} from "~/services/users";
+} from "~/services/people";
import { assertIsPost, notFound } from "~/utils/http";
import { error } from "~/utils/result";
export async function loader({ request, params }: LoaderArgs) {
const { client } = await requirePermissions(request, {
- view: "users",
+ view: "people",
});
const { categoryId } = params;
@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderArgs) {
);
if (attributeCategory.error) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(
request,
error(attributeCategory.error, "Failed to fetch attribute category")
@@ -41,7 +41,7 @@ export async function loader({ request, params }: LoaderArgs) {
export async function action({ request }: ActionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- update: "users",
+ update: "people",
});
const updateMap = (await request.formData()).get("updates") as string;
@@ -77,7 +77,7 @@ export default function AttributeCategoryListRoute() {
const { attributeCategory } = useLoaderData<typeof loader>();
const [params] = useUrlParams();
const navigate = useNavigate();
- const onClose = () => navigate(`/app/users/attributes?${params.toString()}`);
+ const onClose = () => navigate(`/app/people/attributes?${params.toString()}`);
return (
<>
diff --git a/apps/carbon/app/routes/app.users.attributes.new.tsx b/apps/carbon/app/routes/app.people.attributes.new.tsx
similarity index 86%
rename from apps/carbon/app/routes/app.users.attributes.new.tsx
rename to apps/carbon/app/routes/app.people.attributes.new.tsx
index 97b9f748d9..1944e9fc06 100644
--- a/apps/carbon/app/routes/app.users.attributes.new.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.new.tsx
@@ -2,20 +2,20 @@ import type { ActionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { useNavigate } from "@remix-run/react";
import { validationError } from "remix-validated-form";
-import { AttributeCategoryForm } from "~/interfaces/Users/Attributes";
+import { AttributeCategoryForm } from "~/interfaces/People/Attributes";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session";
import {
attributeCategoryValidator,
insertAttributeCategory,
-} from "~/services/users";
+} from "~/services/people";
import { assertIsPost } from "~/utils/http";
import { error, success } from "~/utils/result";
export async function action({ request }: ActionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- update: "users",
+ update: "people",
});
const validation = await attributeCategoryValidator.validate(
@@ -35,7 +35,7 @@ export async function action({ request }: ActionArgs) {
});
if (createAttributeCategory.error) {
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(
request,
error(
@@ -47,14 +47,14 @@ export async function action({ request }: ActionArgs) {
}
return redirect(
- "/app/users/attributes",
+ "/app/people/attributes",
await flash(request, success("Created attribute category "))
);
}
export default function NewAttributeCategoryRoute() {
const navigate = useNavigate();
- const onClose = () => navigate("/app/users/attributes");
+ const onClose = () => navigate("/app/people/attributes");
const initialValues = {
name: "",
diff --git a/apps/carbon/app/routes/app.users.attributes.tsx b/apps/carbon/app/routes/app.people.attributes.tsx
similarity index 93%
rename from apps/carbon/app/routes/app.users.attributes.tsx
rename to apps/carbon/app/routes/app.people.attributes.tsx
index ce92075a2a..612a38a51d 100644
--- a/apps/carbon/app/routes/app.users.attributes.tsx
+++ b/apps/carbon/app/routes/app.people.attributes.tsx
@@ -5,17 +5,17 @@ import { Outlet, useLoaderData } from "@remix-run/react";
import {
AttributeCategoriesTable,
AttributeCategoriesTableFilters,
-} from "~/interfaces/Users/Attributes";
+} from "~/interfaces/People/Attributes";
import { requirePermissions } from "~/services/auth";
import {
getAttributeCategories,
getAttributeDataTypes,
-} from "~/services/users";
+} from "~/services/people";
import { getGenericQueryFilters } from "~/utils/query";
export async function loader({ request }: LoaderArgs) {
const { client } = await requirePermissions(request, {
- view: "users",
+ view: "people",
});
const url = new URL(request.url);
diff --git a/apps/carbon/app/routes/app.people.tsx b/apps/carbon/app/routes/app.people.tsx
new file mode 100644
index 0000000000..7f883d7844
--- /dev/null
+++ b/apps/carbon/app/routes/app.people.tsx
@@ -0,0 +1,22 @@
+import { Grid, VStack } from "@chakra-ui/react";
+import type { MetaFunction } from "@remix-run/node";
+import { Outlet } from "@remix-run/react";
+import { GroupedContentSidebar } from "~/components/Layout/Sidebar";
+import { usePeopleSidebar } from "~/interfaces/People";
+
+export const meta: MetaFunction = () => ({
+ title: "Carbon | People",
+});
+
+export default function PeopleRoute() {
+ const { links } = usePeopleSidebar();
+
+ return (
+ <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">
+ <GroupedContentSidebar links={links} />
+ <VStack w="full" h="full" spacing={0}>
+ <Outlet />
+ </VStack>
+ </Grid>
+ );
+}
diff --git a/apps/carbon/app/services/people/index.ts b/apps/carbon/app/services/people/index.ts
new file mode 100644
index 0000000000..7a9a8c51fc
--- /dev/null
+++ b/apps/carbon/app/services/people/index.ts
@@ -0,0 +1,2 @@
+export * from "./people.form";
+export * from "./people.server";
diff --git a/apps/carbon/app/services/people/people.form.ts b/apps/carbon/app/services/people/people.form.ts
new file mode 100644
index 0000000000..2f32caabc5
--- /dev/null
+++ b/apps/carbon/app/services/people/people.form.ts
@@ -0,0 +1,36 @@
+import { withZod } from "@remix-validated-form/with-zod";
+import { z } from "zod";
+import { zfd } from "zod-form-data";
+import { DataType } from "~/interfaces/Users/types";
+
+export const attributeValidator = withZod(
+ z
+ .object({
+ id: zfd.numeric(z.number().optional()),
+ name: z.string().min(1, { message: "Name is required" }),
+ userAttributeCategoryId: zfd.numeric(),
+ attributeDataTypeId: zfd.numeric(),
+ listOptions: z.string().min(1).array().optional(),
+ canSelfManage: zfd.checkbox(),
+ })
+ .refine((input) => {
+ // allows bar to be optional only when foo is 'foo'
+ if (
+ input.attributeDataTypeId === DataType.List &&
+ (input.listOptions === undefined ||
+ input.listOptions.length === 0 ||
+ input.listOptions.some((option) => option.length === 0))
+ )
+ return false;
+
+ return true;
+ })
+);
+
+export const attributeCategoryValidator = withZod(
+ z.object({
+ id: zfd.numeric(z.number().optional()),
+ name: z.string().min(1, { message: "Name is required" }),
+ isPublic: zfd.checkbox(),
+ })
+);
diff --git a/apps/carbon/app/services/people/people.server.ts b/apps/carbon/app/services/people/people.server.ts
new file mode 100644
index 0000000000..459a58a572
--- /dev/null
+++ b/apps/carbon/app/services/people/people.server.ts
@@ -0,0 +1,178 @@
+import type { Database } from "@carbon/database";
+import type { SupabaseClient } from "@supabase/supabase-js";
+import type { GenericQueryFilters } from "~/utils/query";
+import { setGenericQueryFilters } from "~/utils/query";
+
+export async function deleteAttribute(
+ client: SupabaseClient<Database>,
+ attributeId: string
+) {
+ return client
+ .from("userAttribute")
+ .update({ active: false })
+ .eq("id", attributeId);
+}
+
+export async function deleteAttributeCategory(
+ client: SupabaseClient<Database>,
+ attributeCategoryId: string
+) {
+ return client
+ .from("userAttributeCategory")
+ .update({ active: false })
+ .eq("id", attributeCategoryId);
+}
+
+export async function getAttribute(
+ client: SupabaseClient<Database>,
+ attributeId: number
+) {
+ return client
+ .from("userAttribute")
+ .select(
+ "id, name, sortOrder, listOptions, attributeDataTypeId, userAttributeCategoryId, canSelfManage, userAttributeCategory(name)"
+ )
+ .eq("id", attributeId)
+ .eq("active", true)
+ .single();
+}
+
+export async function getAttributeCategories(
+ client: SupabaseClient<Database>,
+ args: { name: string | null } & GenericQueryFilters
+) {
+ let query = client
+ .from("userAttributeCategory")
+ .select("id, name, public, protected, userAttribute(id, name)", {
+ count: "exact",
+ })
+ .eq("active", true)
+ .eq("userAttribute.active", true);
+
+ if (args?.name) {
+ query = query.ilike("name", `%${args.name}%`);
+ }
+
+ if (args) {
+ query = setGenericQueryFilters(query, args, "name");
+ }
+
+ return query;
+}
+
+export async function getAttributeCategory(
+ client: SupabaseClient<Database>,
+ id: number
+) {
+ return client
+ .from("userAttributeCategory")
+ .select(
+ `id, name, public, protected,
+ userAttribute(
+ id, name, sortOrder,
+ attributeDataType(id, label, isBoolean, isDate, isList, isNumeric, isText, isUser ))
+ `,
+ {
+ count: "exact",
+ }
+ )
+ .eq("id", id)
+ .eq("active", true)
+ .eq("userAttribute.active", true)
+ .single();
+}
+
+export async function getAttributeDataTypes(client: SupabaseClient<Database>) {
+ return client.from("attributeDataType").select("*");
+}
+
+export async function insertAttribute(
+ client: SupabaseClient<Database>,
+ attribute: {
+ name: string;
+ attributeDataTypeId: number;
+ userAttributeCategoryId: number;
+ listOptions?: string[];
+ canSelfManage: boolean;
+ createdBy: string;
+ }
+) {
+ // TODO: there's got to be a better way to get the max
+ const sortOrders = await client
+ .from("userAttribute")
+ .select("sortOrder")
+ .eq("userAttributeCategoryId", attribute.userAttributeCategoryId);
+
+ if (sortOrders.error) return sortOrders;
+ const maxSortOrder = sortOrders.data.reduce((max, item) => {
+ return Math.max(max, item.sortOrder);
+ }, 0);
+
+ return client
+ .from("userAttribute")
+ .upsert([{ ...attribute, sortOrder: maxSortOrder + 1 }])
+ .select("id");
+}
+
+export async function insertAttributeCategory(
+ client: SupabaseClient<Database>,
+ attributeCategory: {
+ name: string;
+ public: boolean;
+ createdBy: string;
+ }
+) {
+ return client
+ .from("userAttributeCategory")
+ .upsert([attributeCategory])
+ .select("id");
+}
+
+export async function updateAttribute(
+ client: SupabaseClient<Database>,
+ attribute: {
+ id?: number;
+ name: string;
+ listOptions?: string[];
+ canSelfManage: boolean;
+ updatedBy: string;
+ }
+) {
+ if (!attribute.id) throw new Error("id is required");
+ return client
+ .from("userAttribute")
+ .update({
+ name: attribute.name,
+ listOptions: attribute.listOptions,
+ canSelfManage: attribute.canSelfManage,
+ updatedBy: attribute.updatedBy,
+ })
+ .eq("id", attribute.id);
+}
+
+export async function updateAttributeCategory(
+ client: SupabaseClient<Database>,
+ attributeCategory: {
+ id: number;
+ name: string;
+ public: boolean;
+ updatedBy: string;
+ }
+) {
+ const { id, ...update } = attributeCategory;
+ return client.from("userAttributeCategory").update(update).eq("id", id);
+}
+
+export async function updateAttributeSortOrder(
+ client: SupabaseClient<Database>,
+ updates: {
+ id: number;
+ sortOrder: number;
+ updatedBy: string;
+ }[]
+) {
+ const updatePromises = updates.map(({ id, sortOrder, updatedBy }) =>
+ client.from("userAttribute").update({ sortOrder, updatedBy }).eq("id", id)
+ );
+ return Promise.all(updatePromises);
+}
diff --git a/apps/carbon/app/services/users/users.form.ts b/apps/carbon/app/services/users/users.form.ts
index ecf8401364..8574757faf 100644
--- a/apps/carbon/app/services/users/users.form.ts
+++ b/apps/carbon/app/services/users/users.form.ts
@@ -1,39 +1,5 @@
import { withZod } from "@remix-validated-form/with-zod";
import { z } from "zod";
-import { zfd } from "zod-form-data";
-import { DataType } from "~/interfaces/Users/types";
-
-export const attributeValidator = withZod(
- z
- .object({
- id: zfd.numeric(z.number().optional()),
- name: z.string().min(1, { message: "Name is required" }),
- userAttributeCategoryId: zfd.numeric(),
- attributeDataTypeId: zfd.numeric(),
- listOptions: z.string().min(1).array().optional(),
- canSelfManage: zfd.checkbox(),
- })
- .refine((input) => {
- // allows bar to be optional only when foo is 'foo'
- if (
- input.attributeDataTypeId === DataType.List &&
- (input.listOptions === undefined ||
- input.listOptions.length === 0 ||
- input.listOptions.some((option) => option.length === 0))
- )
- return false;
-
- return true;
- })
-);
-
-export const attributeCategoryValidator = withZod(
- z.object({
- id: zfd.numeric(z.number().optional()),
- name: z.string().min(1, { message: "Name is required" }),
- isPublic: zfd.checkbox(),
- })
-);
export const bulkPermissionsValidator = withZod(
z.object({
diff --git a/apps/carbon/app/services/users/users.server.ts b/apps/carbon/app/services/users/users.server.ts
index ea2d610177..8924966062 100644
--- a/apps/carbon/app/services/users/users.server.ts
+++ b/apps/carbon/app/services/users/users.server.ts
@@ -268,26 +268,6 @@ export async function deactivateUser(
return success("Sucessfully deactivated user");
}
-export async function deleteAttribute(
- client: SupabaseClient<Database>,
- attributeId: string
-) {
- return client
- .from("userAttribute")
- .update({ active: false })
- .eq("id", attributeId);
-}
-
-export async function deleteAttributeCategory(
- client: SupabaseClient<Database>,
- attributeCategoryId: string
-) {
- return client
- .from("userAttributeCategory")
- .update({ active: false })
- .eq("id", attributeCategoryId);
-}
-
export async function deleteEmployeeType(
client: SupabaseClient<Database>,
employeeTypeId: string
@@ -302,85 +282,28 @@ export async function deleteGroup(
return client.from("group").delete().eq("id", groupId);
}
-export async function getAttribute(
- client: SupabaseClient<Database>,
- attributeId: number
-) {
- return client
- .from("userAttribute")
- .select(
- "id, name, sortOrder, listOptions, attributeDataTypeId, userAttributeCategoryId, canSelfManage, userAttributeCategory(name)"
- )
- .eq("id", attributeId)
- .eq("active", true)
- .single();
+export async function getClaims(client: SupabaseClient<Database>, uid: string) {
+ return client.rpc("get_claims", { uid });
}
-export async function getAttributeCategories(
- client: SupabaseClient<Database>,
- args: { name: string | null } & GenericQueryFilters
+export async function getCurrentUser(
+ request: Request,
+ client: SupabaseClient<Database>
) {
- let query = client
- .from("userAttributeCategory")
- .select("id, name, public, protected, userAttribute(id, name)", {
- count: "exact",
- })
- .eq("active", true)
- .eq("userAttribute.active", true);
-
- if (args?.name) {
- query = query.ilike("name", `%${args.name}%`);
- }
+ const { userId } = await requireAuthSession(request);
- if (args) {
- query = setGenericQueryFilters(query, args, "name");
+ const user = await getUserById(client, userId);
+ if (user?.error || user?.data === null) {
+ throw redirect(
+ "/app",
+ await flash(request, error(user.error, "Failed to get user"))
+ );
}
- return query;
-}
-
-export async function getAttributeCategory(
- client: SupabaseClient<Database>,
- id: number
-) {
- return client
- .from("userAttributeCategory")
- .select(
- `id, name, public, protected,
- userAttribute(
- id, name, sortOrder,
- attributeDataType(id, label, isBoolean, isDate, isList, isNumeric, isText, isUser ))
- `,
- {
- count: "exact",
- }
- )
- .eq("id", id)
- .eq("active", true)
- .eq("userAttribute.active", true)
- .single();
-}
-
-export async function getAttributeDataTypes(client: SupabaseClient<Database>) {
- return client.from("attributeDataType").select("*");
-}
-
-export async function getClaims(client: SupabaseClient<Database>, uid: string) {
- return client.rpc("get_claims", { uid });
-}
-
-export async function getEmployee(
- client: SupabaseClient<Database>,
- id: string
-) {
- return client
- .from("employee")
- .select("id, user(id, firstName, lastName, email), employeeType(id)")
- .eq("id", id)
- .single();
+ return user.data;
}
-export async function getSuppliers(
+export async function getCustomers(
client: SupabaseClient<Database>,
args: GenericQueryFilters & {
name: string | null;
@@ -388,9 +311,9 @@ export async function getSuppliers(
active: boolean | null;
}
) {
- let query = client.from("supplierAccount").select(
+ let query = client.from("customerAccount").select(
`user!inner(id, fullName, firstName, lastName, email, avatarUrl, active),
- supplier!inner(name, supplierType!left(name))`,
+ customer!inner(name, customerType!left(name))`,
{ count: "exact" }
);
@@ -399,7 +322,7 @@ export async function getSuppliers(
}
if (args.type) {
- query = query.eq("supplier.supplierTypeId", args.type);
+ query = query.eq("customer.customerTypeId", args.type);
}
if (args.active !== null) {
@@ -410,6 +333,17 @@ export async function getSuppliers(
return query;
}
+export async function getEmployee(
+ client: SupabaseClient<Database>,
+ id: string
+) {
+ return client
+ .from("employee")
+ .select("id, user(id, firstName, lastName, email), employeeType(id)")
+ .eq("id", id)
+ .single();
+}
+
export async function getEmployees(
client: SupabaseClient<Database>,
args: GenericQueryFilters & {
@@ -441,36 +375,6 @@ export async function getEmployees(
return query;
}
-export async function getCustomers(
- client: SupabaseClient<Database>,
- args: GenericQueryFilters & {
- name: string | null;
- type: string | null;
- active: boolean | null;
- }
-) {
- let query = client.from("customerAccount").select(
- `user!inner(id, fullName, firstName, lastName, email, avatarUrl, active),
- customer!inner(name, customerType!left(name))`,
- { count: "exact" }
- );
-
- if (args.name) {
- query = query.ilike("user.fullName", `%${args.name}%`);
- }
-
- if (args.type) {
- query = query.eq("customer.customerTypeId", args.type);
- }
-
- if (args.active !== null) {
- query = query.eq("user.active", args.active);
- }
-
- query = setGenericQueryFilters(query, args, "user(lastName)");
- return query;
-}
-
export async function getEmployeeType(
client: SupabaseClient<Database>,
employeeTypeId: string
@@ -596,21 +500,34 @@ export async function getPermissions(
}
}
-export async function getCurrentUser(
- request: Request,
- client: SupabaseClient<Database>
+export async function getSuppliers(
+ client: SupabaseClient<Database>,
+ args: GenericQueryFilters & {
+ name: string | null;
+ type: string | null;
+ active: boolean | null;
+ }
) {
- const { userId } = await requireAuthSession(request);
+ let query = client.from("supplierAccount").select(
+ `user!inner(id, fullName, firstName, lastName, email, avatarUrl, active),
+ supplier!inner(name, supplierType!left(name))`,
+ { count: "exact" }
+ );
- const user = await getUserById(client, userId);
- if (user?.error || user?.data === null) {
- throw redirect(
- "/app",
- await flash(request, error(user.error, "Failed to get user"))
- );
+ if (args.name) {
+ query = query.ilike("user.fullName", `%${args.name}%`);
}
- return user.data;
+ if (args.type) {
+ query = query.eq("supplier.supplierTypeId", args.type);
+ }
+
+ if (args.active !== null) {
+ query = query.eq("user.active", args.active);
+ }
+
+ query = setGenericQueryFilters(query, args, "user(lastName)");
+ return query;
}
export async function getUserById(
@@ -641,48 +558,6 @@ export async function getUsers(client: SupabaseClient<Database>) {
.order("lastName");
}
-export async function insertAttribute(
- client: SupabaseClient<Database>,
- attribute: {
- name: string;
- attributeDataTypeId: number;
- userAttributeCategoryId: number;
- listOptions?: string[];
- canSelfManage: boolean;
- createdBy: string;
- }
-) {
- // TODO: there's got to be a better way to get the max
- const sortOrders = await client
- .from("userAttribute")
- .select("sortOrder")
- .eq("userAttributeCategoryId", attribute.userAttributeCategoryId);
-
- if (sortOrders.error) return sortOrders;
- const maxSortOrder = sortOrders.data.reduce((max, item) => {
- return Math.max(max, item.sortOrder);
- }, 0);
-
- return client
- .from("userAttribute")
- .upsert([{ ...attribute, sortOrder: maxSortOrder + 1 }])
- .select("id");
-}
-
-export async function insertAttributeCategory(
- client: SupabaseClient<Database>,
- attributeCategory: {
- name: string;
- public: boolean;
- createdBy: string;
- }
-) {
- return client
- .from("userAttributeCategory")
- .upsert([attributeCategory])
- .select("id");
-}
-
async function insertCustomerAccount(
client: SupabaseClient<Database>,
customerAccount: {
@@ -983,55 +858,6 @@ export async function updatePermissions(
}
}
-export async function updateAttribute(
- client: SupabaseClient<Database>,
- attribute: {
- id?: number;
- name: string;
- listOptions?: string[];
- canSelfManage: boolean;
- updatedBy: string;
- }
-) {
- if (!attribute.id) throw new Error("id is required");
- return client
- .from("userAttribute")
- .update({
- name: attribute.name,
- listOptions: attribute.listOptions,
- canSelfManage: attribute.canSelfManage,
- updatedBy: attribute.updatedBy,
- })
- .eq("id", attribute.id);
-}
-
-export async function updateAttributeCategory(
- client: SupabaseClient<Database>,
- attributeCategory: {
- id: number;
- name: string;
- public: boolean;
- updatedBy: string;
- }
-) {
- const { id, ...update } = attributeCategory;
- return client.from("userAttributeCategory").update(update).eq("id", id);
-}
-
-export async function updateAttributeSortOrder(
- client: SupabaseClient<Database>,
- updates: {
- id: number;
- sortOrder: number;
- updatedBy: string;
- }[]
-) {
- const updatePromises = updates.map(({ id, sortOrder, updatedBy }) =>
- client.from("userAttribute").update({ sortOrder, updatedBy }).eq("id", id)
- );
- return Promise.all(updatePromises);
-}
-
export async function upsertEmployeeType(
client: SupabaseClient<Database>,
employeeType: { id?: string; name: string; color: string | null }
diff --git a/package.json b/package.json
index a546a94e38..20d54abd9c 100755
--- a/package.json
+++ b/package.json
@@ -5,10 +5,6 @@
"docs/*",
"packages/*"
],
- "prisma": {
- "schema": "packages/carbon-database/prisma/schema.prisma",
- "seed": "tsx packages/carbon-database/src/seed.ts"
- },
"scripts": {
"build": "turbo run build",
"build:packages": "turbo run build --filter=./packages/*",
@@ -33,7 +29,6 @@
"dev:docs": "turbo run dev --no-cache --parallel --continue --filter=./docs/*",
"dev:packages": "turbo run dev --no-cache --parallel --continue --filter=./packages/*",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
- "generate": "turbo run generate",
"initialize": "run-s db:init db:start",
"lint": "turbo run lint",
"setup": "turbo run setup",
diff --git a/packages/carbon-database/package.json b/packages/carbon-database/package.json
index 1f0058d90c..dadd55e4f9 100644
--- a/packages/carbon-database/package.json
+++ b/packages/carbon-database/package.json
@@ -17,20 +17,12 @@
"db:start": "supabase start",
"db:kill": "supabase stop",
"db:types": "supabase gen types typescript --local > src/types.ts",
- "db:migrate": "prisma migrate deploy",
- "db:push": "prisma db push",
- "db:pull": "prisma db pull",
+ "db:migrate": "supabase db reset",
"db:seed": "tsx src/seed.ts",
- "db:migrate:force": "prisma migrate reset --force",
+ "db:setup": "supabase db reset",
"dev": "tsup --watch",
- "format": "prisma format",
- "generate": "prisma generate",
"lint": "TIMING=1 eslint \"src/**/*.ts*\"",
- "setup": "run-s setup:db db:seed",
- "setup:db": "prisma generate && prisma migrate deploy"
- },
- "dependencies": {
- "@prisma/client": "^4.6.0"
+ "setup": "run-s db:setup db:seed"
},
"devDependencies": {
"@carbon/tsconfig": "*",
@@ -41,7 +33,6 @@
"eslint": "^8.4.1",
"eslint-config-carbon": "*",
"npm-run-all": "^4.1.5",
- "prisma": "^4.6.0",
"rimraf": "^3.0.2",
"supabase": "^1.27.1",
"tsup": "^6.5.0",
diff --git a/packages/carbon-database/prisma/migrations/migration_lock.toml b/packages/carbon-database/prisma/migrations/migration_lock.toml
deleted file mode 100644
index fbffa92c2b..0000000000
--- a/packages/carbon-database/prisma/migrations/migration_lock.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Please do not edit this file manually
-# It should be added in your version-control system (i.e. Git)
-provider = "postgresql"
\ No newline at end of file
diff --git a/packages/carbon-database/prisma/schema.prisma b/packages/carbon-database/prisma/schema.prisma
deleted file mode 100644
index 3364d50069..0000000000
--- a/packages/carbon-database/prisma/schema.prisma
+++ /dev/null
@@ -1,255 +0,0 @@
-generator client {
- provider = "prisma-client-js"
-}
-
-datasource db {
- provider = "postgresql"
- url = env("DB_URL")
-}
-
-model employee {
- id String @id
- employeeTypeId String
- employeeType employeeType @relation(fields: [employeeTypeId], references: [id], onDelete: NoAction, onUpdate: NoAction)
- user user @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: NoAction)
-}
-
-model employeeType {
- id String @id @default(dbgenerated("uuid_generate_v4()"))
- name String
- color String? @default("#000000")
- protected Boolean @default(false)
- createdAt DateTime @default(now())
- updatedAt DateTime?
- employee employee[]
- employeeTypePermission employeeTypePermission[]
-}
-
-model employeeTypePermission {
- employeeTypeId String
- featureId String
- create Boolean @default(false)
- delete Boolean @default(false)
- update Boolean @default(false)
- view Boolean @default(false)
- createdAt DateTime @default(now())
- updatedAt DateTime?
- employeeType employeeType @relation(fields: [employeeTypeId], references: [id], onDelete: Cascade)
- feature feature @relation(fields: [featureId], references: [id], onDelete: Cascade)
-
- @@id([employeeTypeId, featureId])
-}
-
-model feature {
- id String @id @default(dbgenerated("uuid_generate_v4()"))
- name String
- createdAt DateTime @default(now())
- updatedAt DateTime?
- employeeTypePermission employeeTypePermission[]
-}
-
-model user {
- id String @id
- email String @unique
- firstName String
- lastName String
- fullName String? @default(dbgenerated("((\"firstName\" || ' '::text) || \"lastName\")"))
- about String @default("")
- avatarUrl String?
- active Boolean? @default(true)
- emailVerified DateTime?
- createdAt DateTime @default(now())
- updatedAt DateTime?
- employee employee?
- membership membership[]
- supplier supplier[]
- userAttribute_userTouserAttribute_createdBy userAttribute[] @relation("userTouserAttribute_createdBy")
- userAttribute_userTouserAttribute_updatedBy userAttribute[] @relation("userTouserAttribute_updatedBy")
- userAttributeCategory_userTouserAttributeCategory_createdBy userAttributeCategory[] @relation("userTouserAttributeCategory_createdBy")
- userAttributeCategory_userTouserAttributeCategory_updatedBy userAttributeCategory[] @relation("userTouserAttributeCategory_updatedBy")
- userAttributeValue_userTouserAttributeValue_createdBy userAttributeValue[] @relation("userTouserAttributeValue_createdBy")
- userAttributeValue_userTouserAttributeValue_updatedBy userAttributeValue[] @relation("userTouserAttributeValue_updatedBy")
- userAttributeValue_userTouserAttributeValue_userId userAttributeValue[] @relation("userTouserAttributeValue_userId")
- userAttributeValue_userTouserAttributeValue_valueUser userAttributeValue[] @relation("userTouserAttributeValue_valueUser")
-
- @@index([fullName], map: "user_fullName_key")
-}
-
-model group {
- id String @id @default(dbgenerated("uuid_generate_v4()"))
- name String
- isIdentityGroup Boolean @default(false)
- isEmployeeTypeGroup Boolean @default(false)
- createdAt DateTime @default(now())
- updatedAt DateTime?
- membership_groupTomembership_groupId membership[] @relation("groupTomembership_groupId")
- membership_groupTomembership_memberGroupId membership[] @relation("groupTomembership_memberGroupId")
-}
-
-model membership {
- id Int @id @default(autoincrement())
- groupId String
- memberGroupId String?
- memberUserId String?
- group_groupTomembership_groupId group @relation("groupTomembership_groupId", fields: [groupId], references: [id], onDelete: Cascade)
- group_groupTomembership_memberGroupId group? @relation("groupTomembership_memberGroupId", fields: [memberGroupId], references: [id], onDelete: Cascade)
- user user? @relation(fields: [memberUserId], references: [id], onDelete: Cascade)
-
- @@unique([groupId, memberGroupId, memberUserId], map: "uq_membership")
- @@index([groupId], map: "index_membership_groupid")
- @@index([memberGroupId], map: "index_membership_membergroupid")
- @@index([memberUserId], map: "index_membership_memberuserid")
-}
-
-model attributeDataType {
- id Int @id @default(autoincrement())
- label String
- isBoolean Boolean @default(false)
- isDate Boolean @default(false)
- isList Boolean @default(false)
- isNumeric Boolean @default(false)
- isText Boolean @default(false)
- isUser Boolean @default(false)
- userAttribute userAttribute[]
-}
-
-model userAttribute {
- id Int @id @default(autoincrement())
- name String
- sortOrder Int @default(1)
- userAttributeCategoryId Int
- attributeDataTypeId Int
- listOptions String[]
- canSelfManage Boolean? @default(false)
- active Boolean? @default(true)
- createdAt DateTime @default(now())
- createdBy String
- updatedAt DateTime?
- updatedBy String?
- attributeDataType attributeDataType @relation(fields: [attributeDataTypeId], references: [id], onDelete: Cascade)
- user_userTouserAttribute_createdBy user @relation("userTouserAttribute_createdBy", fields: [createdBy], references: [id], onDelete: NoAction, onUpdate: NoAction)
- user_userTouserAttribute_updatedBy user? @relation("userTouserAttribute_updatedBy", fields: [updatedBy], references: [id], onDelete: NoAction, onUpdate: NoAction)
- userAttributeCategory userAttributeCategory @relation(fields: [userAttributeCategoryId], references: [id], onDelete: Cascade)
- userAttributeValue userAttributeValue[]
-}
-
-model userAttributeCategory {
- id Int @id @default(autoincrement())
- name String
- public Boolean? @default(false)
- protected Boolean? @default(false)
- active Boolean? @default(true)
- createdAt DateTime @default(now())
- createdBy String
- updatedAt DateTime?
- updatedBy String?
- user_userTouserAttributeCategory_createdBy user @relation("userTouserAttributeCategory_createdBy", fields: [createdBy], references: [id], onDelete: NoAction, onUpdate: NoAction)
- user_userTouserAttributeCategory_updatedBy user? @relation("userTouserAttributeCategory_updatedBy", fields: [updatedBy], references: [id], onDelete: NoAction, onUpdate: NoAction)
- userAttribute userAttribute[]
-}
-
-model userAttributeValue {
- id Int @id @default(autoincrement())
- userAttributeId Int
- userId String
- valueBoolean Boolean?
- valueDate DateTime? @db.Date
- valueNumeric Decimal? @db.Decimal
- valueText String?
- valueUser String?
- createdAt DateTime @default(now())
- createdBy String
- updatedAt DateTime?
- updatedBy String?
- user_userTouserAttributeValue_createdBy user @relation("userTouserAttributeValue_createdBy", fields: [createdBy], references: [id], onDelete: NoAction, onUpdate: NoAction)
- user_userTouserAttributeValue_updatedBy user? @relation("userTouserAttributeValue_updatedBy", fields: [updatedBy], references: [id], onDelete: NoAction, onUpdate: NoAction)
- userAttribute userAttribute @relation(fields: [userAttributeId], references: [id], onDelete: Cascade, onUpdate: NoAction)
- user_userTouserAttributeValue_userId user @relation("userTouserAttributeValue_userId", fields: [userId], references: [id], onDelete: Cascade, onUpdate: NoAction)
- user_userTouserAttributeValue_valueUser user? @relation("userTouserAttributeValue_valueUser", fields: [valueUser], references: [id], onDelete: Cascade, onUpdate: NoAction)
-
- @@unique([userAttributeId, userId], map: "uq_userattributeid_userid")
-}
-
-model address {
- id Int @id @default(autoincrement())
- addressLine1 String?
- addressLine2 String?
- city String?
- stateId Int?
- countryId Int?
- phone String?
- fax String?
- country country? @relation(fields: [countryId], references: [id])
- state state? @relation(fields: [stateId], references: [id])
- supplierLocation supplierLocation[]
-}
-
-model country {
- id Int @id @default(autoincrement())
- name String
- code String
- address address[]
- state state[]
-}
-
-model state {
- id Int @id @default(autoincrement())
- name String
- countryId Int?
- country country? @relation(fields: [countryId], references: [id])
- address address[]
-}
-
-model supplier {
- id String @id @default(dbgenerated("uuid_generate_v4()"))
- name String @unique(map: "supplier_name_unique")
- description String?
- supplierTypeId Int?
- supplierStatusId Int?
- taxId String? @unique(map: "supplier_taxId_unique")
- taxable Boolean? @default(true)
- established DateTime? @db.Date
- accountManagerId String?
- logo String?
- website String?
- twitter String?
- facebook String?
- instagram String?
- linkedin String?
- github String?
- youtube String?
- twitch String?
- discord String?
- createdAt DateTime @default(now())
- updatedAt DateTime?
- user user? @relation(fields: [accountManagerId], references: [id])
- supplierStatus supplierStatus? @relation(fields: [supplierStatusId], references: [id])
- supplierType supplierType? @relation(fields: [supplierTypeId], references: [id])
- supplierLocation supplierLocation[]
-}
-
-model supplierLocation {
- id Int @id @default(autoincrement())
- supplierId String
- addressId Int
- address address @relation(fields: [addressId], references: [id], onDelete: Cascade)
- supplier supplier @relation(fields: [supplierId], references: [id], onDelete: Cascade)
-}
-
-model supplierStatus {
- id Int @id @default(autoincrement())
- name String
- createdAt DateTime @default(now())
- updatedAt DateTime?
- supplier supplier[]
-}
-
-model supplierType {
- id Int @id @default(autoincrement())
- name String
- color String? @default("#000000")
- protected Boolean @default(false)
- createdAt DateTime @default(now())
- updatedAt DateTime?
- supplier supplier[]
-}
diff --git a/packages/carbon-database/src/client.ts b/packages/carbon-database/src/client.ts
deleted file mode 100644
index 0d419925df..0000000000
--- a/packages/carbon-database/src/client.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { PrismaClient } from "@prisma/client";
-
-let db: PrismaClient;
-
-declare global {
- // eslint-disable-next-line no-var
- var __db__: PrismaClient;
-}
-
-// this is needed because in development we don't want to restart
-// the server with every change, but we want to make sure we don't
-// create a new connection to the DB with every change either.
-// in production, we'll have a single connection to the DB.
-if (process.env.NODE_ENV === "production") {
- db = new PrismaClient();
-} else {
- if (!global.__db__) {
- global.__db__ = new PrismaClient();
- }
- db = global.__db__;
- db.$connect();
-}
-
-export { db };
-export type { PrismaClient };
diff --git a/packages/carbon-database/src/index.ts b/packages/carbon-database/src/index.ts
index 7b95843f4a..eea524d655 100644
--- a/packages/carbon-database/src/index.ts
+++ b/packages/carbon-database/src/index.ts
@@ -1,3 +1 @@
-export * from "./client";
export * from "./types";
-export type { PrismaClient } from "./client";
diff --git a/packages/carbon-database/src/types.ts b/packages/carbon-database/src/types.ts
index ca189b6195..31d9f86b94 100644
--- a/packages/carbon-database/src/types.ts
+++ b/packages/carbon-database/src/types.ts
@@ -9,40 +9,9 @@ export type Json =
export interface Database {
public: {
Tables: {
- _prisma_migrations: {
- Row: {
- id: string
- checksum: string
- finished_at: string | null
- migration_name: string
- logs: string | null
- rolled_back_at: string | null
- started_at: string
- applied_steps_count: number
- }
- Insert: {
- id: string
- checksum: string
- finished_at?: string | null
- migration_name: string
- logs?: string | null
- rolled_back_at?: string | null
- started_at?: string
- applied_steps_count?: number
- }
- Update: {
- id?: string
- checksum?: string
- finished_at?: string | null
- migration_name?: string
- logs?: string | null
- rolled_back_at?: string | null
- started_at?: string
- applied_steps_count?: number
- }
- }
address: {
Row: {
+ id: number
addressLine1: string | null
addressLine2: string | null
city: string | null
@@ -51,9 +20,9 @@ export interface Database {
countryId: number | null
phone: string | null
fax: string | null
- id: number
}
Insert: {
+ id?: number
addressLine1?: string | null
addressLine2?: string | null
city?: string | null
@@ -62,9 +31,9 @@ export interface Database {
countryId?: number | null
phone?: string | null
fax?: string | null
- id?: number
}
Update: {
+ id?: number
addressLine1?: string | null
addressLine2?: string | null
city?: string | null
@@ -73,13 +42,12 @@ export interface Database {
countryId?: number | null
phone?: string | null
fax?: string | null
- id?: number
}
}
attributeDataType: {
Row: {
- label: string
id: number
+ label: string
isBoolean: boolean
isDate: boolean
isList: boolean
@@ -88,8 +56,8 @@ export interface Database {
isUser: boolean
}
Insert: {
- label: string
id?: number
+ label: string
isBoolean?: boolean
isDate?: boolean
isList?: boolean
@@ -98,8 +66,8 @@ export interface Database {
isUser?: boolean
}
Update: {
- label?: string
id?: number
+ label?: string
isBoolean?: boolean
isDate?: boolean
isList?: boolean
@@ -110,6 +78,7 @@ export interface Database {
}
contact: {
Row: {
+ id: string
firstName: string
lastName: string
email: string
@@ -126,9 +95,9 @@ export interface Database {
countryId: number | null
birthday: string | null
notes: string | null
- id: string
}
Insert: {
+ id?: string
firstName: string
lastName: string
email: string
@@ -145,9 +114,9 @@ export interface Database {
countryId?: number | null
birthday?: string | null
notes?: string | null
- id?: string
}
Update: {
+ id?: string
firstName?: string
lastName?: string
email?: string
@@ -164,28 +133,28 @@ export interface Database {
countryId?: number | null
birthday?: string | null
notes?: string | null
- id?: string
}
}
country: {
Row: {
+ id: number
name: string
code: string
- id: number
}
Insert: {
+ id?: number
name: string
code: string
- id?: number
}
Update: {
+ id?: number
name?: string
code?: string
- id?: number
}
}
customer: {
Row: {
+ id: string
name: string
description: string | null
customerTypeId: string | null
@@ -193,13 +162,13 @@ export interface Database {
taxId: string | null
accountManagerId: string | null
logo: string | null
+ createdAt: string
createdBy: string | null
updatedAt: string | null
updatedBy: string | null
- id: string
- createdAt: string
}
Insert: {
+ id?: string
name: string
description?: string | null
customerTypeId?: string | null
@@ -207,13 +176,13 @@ export interface Database {
taxId?: string | null
accountManagerId?: string | null
logo?: string | null
+ createdAt?: string
createdBy?: string | null
updatedAt?: string | null
updatedBy?: string | null
- id?: string
- createdAt?: string
}
Update: {
+ id?: string
name?: string
description?: string | null
customerTypeId?: string | null
@@ -221,11 +190,10 @@ export interface Database {
taxId?: string | null
accountManagerId?: string | null
logo?: string | null
+ createdAt?: string
createdBy?: string | null
updatedAt?: string | null
updatedBy?: string | null
- id?: string
- createdAt?: string
}
}
customerAccount: {
@@ -244,88 +212,88 @@ export interface Database {
}
customerContact: {
Row: {
+ id: string
customerId: string
contactId: string
customerLocationId: number | null
userId: string | null
- id: string
}
Insert: {
+ id?: string
customerId: string
contactId: string
customerLocationId?: number | null
userId?: string | null
- id?: string
}
Update: {
+ id?: string
customerId?: string
contactId?: string
customerLocationId?: number | null
userId?: string | null
- id?: string
}
}
customerLocation: {
Row: {
+ id: number
customerId: string
addressId: number
- id: number
}
Insert: {
+ id?: number
customerId: string
addressId: number
- id?: number
}
Update: {
+ id?: number
customerId?: string
addressId?: number
- id?: number
}
}
customerStatus: {
Row: {
- name: string
- updatedAt: string | null
id: number
+ name: string
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: number
+ name: string
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: number
+ name?: string
createdAt?: string
+ updatedAt?: string | null
}
}
customerType: {
Row: {
- name: string
- updatedAt: string | null
id: string
+ name: string
color: string | null
protected: boolean
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: string
+ name: string
color?: string | null
protected?: boolean
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: string
+ name?: string
color?: string | null
protected?: boolean
createdAt?: string
+ updatedAt?: string | null
}
}
employee: {
@@ -344,87 +312,86 @@ export interface Database {
}
employeeType: {
Row: {
- name: string
- updatedAt: string | null
id: string
+ name: string
color: string | null
protected: boolean
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: string
+ name: string
color?: string | null
protected?: boolean
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: string
+ name?: string
color?: string | null
protected?: boolean
createdAt?: string
+ updatedAt?: string | null
}
}
employeeTypePermission: {
Row: {
employeeTypeId: string
featureId: string
- updatedAt: string | null
create: boolean
delete: boolean
update: boolean
view: boolean
createdAt: string
+ updatedAt: string | null
}
Insert: {
employeeTypeId: string
featureId: string
- updatedAt?: string | null
create?: boolean
delete?: boolean
update?: boolean
view?: boolean
createdAt?: string
+ updatedAt?: string | null
}
Update: {
employeeTypeId?: string
featureId?: string
- updatedAt?: string | null
create?: boolean
delete?: boolean
update?: boolean
view?: boolean
createdAt?: string
+ updatedAt?: string | null
}
}
feature: {
Row: {
- name: string
- updatedAt: string | null
id: string
+ name: string
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: string
+ name: string
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: string
+ name?: string
createdAt?: string
+ updatedAt?: string | null
}
}
group: {
Row: {
- name: string
- updatedAt: string | null
id: string
+ name: string
isIdentityGroup: boolean
isEmployeeTypeGroup: boolean
isCustomerOrgGroup: boolean
@@ -432,11 +399,11 @@ export interface Database {
isSupplierTypeGroup: boolean
isSupplierOrgGroup: boolean
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: string
+ name: string
isIdentityGroup?: boolean
isEmployeeTypeGroup?: boolean
isCustomerOrgGroup?: boolean
@@ -444,11 +411,11 @@ export interface Database {
isSupplierTypeGroup?: boolean
isSupplierOrgGroup?: boolean
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: string
+ name?: string
isIdentityGroup?: boolean
isEmployeeTypeGroup?: boolean
isCustomerOrgGroup?: boolean
@@ -456,30 +423,32 @@ export interface Database {
isSupplierTypeGroup?: boolean
isSupplierOrgGroup?: boolean
createdAt?: string
+ updatedAt?: string | null
}
}
membership: {
Row: {
+ id: number
groupId: string
memberGroupId: string | null
memberUserId: string | null
- id: number
}
Insert: {
+ id?: number
groupId: string
memberGroupId?: string | null
memberUserId?: string | null
- id?: number
}
Update: {
+ id?: number
groupId?: string
memberGroupId?: string | null
memberUserId?: string | null
- id?: number
}
}
supplier: {
Row: {
+ id: string
name: string
description: string | null
supplierTypeId: string | null
@@ -487,13 +456,13 @@ export interface Database {
taxId: string | null
accountManagerId: string | null
logo: string | null
+ createdAt: string
createdBy: string | null
updatedAt: string | null
updatedBy: string | null
- id: string
- createdAt: string
}
Insert: {
+ id?: string
name: string
description?: string | null
supplierTypeId?: string | null
@@ -501,13 +470,13 @@ export interface Database {
taxId?: string | null
accountManagerId?: string | null
logo?: string | null
+ createdAt?: string
createdBy?: string | null
updatedAt?: string | null
updatedBy?: string | null
- id?: string
- createdAt?: string
}
Update: {
+ id?: string
name?: string
description?: string | null
supplierTypeId?: string | null
@@ -515,11 +484,10 @@ export interface Database {
taxId?: string | null
accountManagerId?: string | null
logo?: string | null
+ createdAt?: string
createdBy?: string | null
updatedAt?: string | null
updatedBy?: string | null
- id?: string
- createdAt?: string
}
}
supplierAccount: {
@@ -538,88 +506,88 @@ export interface Database {
}
supplierContact: {
Row: {
+ id: string
supplierId: string
contactId: string
supplierLocationId: number | null
userId: string | null
- id: string
}
Insert: {
+ id?: string
supplierId: string
contactId: string
supplierLocationId?: number | null
userId?: string | null
- id?: string
}
Update: {
+ id?: string
supplierId?: string
contactId?: string
supplierLocationId?: number | null
userId?: string | null
- id?: string
}
}
supplierLocation: {
Row: {
+ id: number
supplierId: string
addressId: number
- id: number
}
Insert: {
+ id?: number
supplierId: string
addressId: number
- id?: number
}
Update: {
+ id?: number
supplierId?: string
addressId?: number
- id?: number
}
}
supplierStatus: {
Row: {
- name: string
- updatedAt: string | null
id: number
+ name: string
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: number
+ name: string
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: number
+ name?: string
createdAt?: string
+ updatedAt?: string | null
}
}
supplierType: {
Row: {
- name: string
- updatedAt: string | null
id: string
+ name: string
color: string | null
protected: boolean
createdAt: string
+ updatedAt: string | null
}
Insert: {
- name: string
- updatedAt?: string | null
id?: string
+ name: string
color?: string | null
protected?: boolean
createdAt?: string
+ updatedAt?: string | null
}
Update: {
- name?: string
- updatedAt?: string | null
id?: string
+ name?: string
color?: string | null
protected?: boolean
createdAt?: string
+ updatedAt?: string | null
}
}
user: {
@@ -628,122 +596,123 @@ export interface Database {
email: string
firstName: string
lastName: string
- avatarUrl: string | null
- emailVerified: string | null
- updatedAt: string | null
fullName: string | null
about: string
+ avatarUrl: string | null
active: boolean | null
+ emailVerified: string | null
createdAt: string
+ updatedAt: string | null
}
Insert: {
id: string
email: string
firstName: string
lastName: string
- avatarUrl?: string | null
- emailVerified?: string | null
- updatedAt?: string | null
fullName?: string | null
about?: string
+ avatarUrl?: string | null
active?: boolean | null
+ emailVerified?: string | null
createdAt?: string
+ updatedAt?: string | null
}
Update: {
id?: string
email?: string
firstName?: string
lastName?: string
- avatarUrl?: string | null
- emailVerified?: string | null
- updatedAt?: string | null
fullName?: string | null
about?: string
+ avatarUrl?: string | null
active?: boolean | null
+ emailVerified?: string | null
createdAt?: string
+ updatedAt?: string | null
}
}
userAttribute: {
Row: {
+ id: number
name: string
+ sortOrder: number
userAttributeCategoryId: number
attributeDataTypeId: number
listOptions: string[] | null
- createdBy: string
- updatedAt: string | null
- updatedBy: string | null
- id: number
- sortOrder: number
canSelfManage: boolean | null
active: boolean | null
createdAt: string
+ createdBy: string
+ updatedAt: string | null
+ updatedBy: string | null
}
Insert: {
+ id?: number
name: string
+ sortOrder?: number
userAttributeCategoryId: number
attributeDataTypeId: number
listOptions?: string[] | null
- createdBy: string
- updatedAt?: string | null
- updatedBy?: string | null
- id?: number
- sortOrder?: number
canSelfManage?: boolean | null
active?: boolean | null
createdAt?: string
+ createdBy: string
+ updatedAt?: string | null
+ updatedBy?: string | null
}
Update: {
+ id?: number
name?: string
+ sortOrder?: number
userAttributeCategoryId?: number
attributeDataTypeId?: number
listOptions?: string[] | null
- createdBy?: string
- updatedAt?: string | null
- updatedBy?: string | null
- id?: number
- sortOrder?: number
canSelfManage?: boolean | null
active?: boolean | null
createdAt?: string
+ createdBy?: string
+ updatedAt?: string | null
+ updatedBy?: string | null
}
}
userAttributeCategory: {
Row: {
- name: string
- createdBy: string
- updatedAt: string | null
- updatedBy: string | null
id: number
+ name: string
public: boolean | null
protected: boolean | null
active: boolean | null
createdAt: string
+ createdBy: string
+ updatedAt: string | null
+ updatedBy: string | null
}
Insert: {
- name: string
- createdBy: string
- updatedAt?: string | null
- updatedBy?: string | null
id?: number
+ name: string
public?: boolean | null
protected?: boolean | null
active?: boolean | null
createdAt?: string
- }
- Update: {
- name?: string
- createdBy?: string
+ createdBy: string
updatedAt?: string | null
updatedBy?: string | null
+ }
+ Update: {
id?: number
+ name?: string
public?: boolean | null
protected?: boolean | null
active?: boolean | null
createdAt?: string
+ createdBy?: string
+ updatedAt?: string | null
+ updatedBy?: string | null
}
}
userAttributeValue: {
Row: {
+ id: number
userAttributeId: number
userId: string
valueBoolean: boolean | null
@@ -751,13 +720,13 @@ export interface Database {
valueNumeric: number | null
valueText: string | null
valueUser: string | null
+ createdAt: string
createdBy: string
updatedAt: string | null
updatedBy: string | null
- id: number
- createdAt: string
}
Insert: {
+ id?: number
userAttributeId: number
userId: string
valueBoolean?: boolean | null
@@ -765,13 +734,13 @@ export interface Database {
valueNumeric?: number | null
valueText?: string | null
valueUser?: string | null
+ createdAt?: string
createdBy: string
updatedAt?: string | null
updatedBy?: string | null
- id?: number
- createdAt?: string
}
Update: {
+ id?: number
userAttributeId?: number
userId?: string
valueBoolean?: boolean | null
@@ -779,11 +748,10 @@ export interface Database {
valueNumeric?: number | null
valueText?: string | null
valueUser?: string | null
+ createdAt?: string
createdBy?: string
updatedAt?: string | null
updatedBy?: string | null
- id?: number
- createdAt?: string
}
}
}
@@ -833,6 +801,10 @@ export interface Database {
}
}
Functions: {
+ _xid_machine_id: {
+ Args: Record<PropertyKey, never>
+ Returns: number
+ }
delete_claim: {
Args: { uid: string; claim: string }
Returns: string
@@ -883,6 +855,34 @@ export interface Database {
Args: { groups: string[] }
Returns: Json
}
+ xid: {
+ Args: { _at: string }
+ Returns: unknown
+ }
+ xid_counter: {
+ Args: { _xid: unknown }
+ Returns: number
+ }
+ xid_decode: {
+ Args: { _xid: unknown }
+ Returns: number[]
+ }
+ xid_encode: {
+ Args: { _id: number[] }
+ Returns: unknown
+ }
+ xid_machine: {
+ Args: { _xid: unknown }
+ Returns: number[]
+ }
+ xid_pid: {
+ Args: { _xid: unknown }
+ Returns: number
+ }
+ xid_time: {
+ Args: { _xid: unknown }
+ Returns: string
+ }
}
Enums: {
[_ in never]: never
diff --git a/packages/carbon-database/supabase/migrations/20230123003711_xid.sql b/packages/carbon-database/supabase/migrations/20230123003711_xid.sql
new file mode 100644
index 0000000000..f30b1870f8
--- /dev/null
+++ b/packages/carbon-database/supabase/migrations/20230123003711_xid.sql
@@ -0,0 +1,152 @@
+CREATE DOMAIN public.xid AS CHAR(20) CHECK (VALUE ~ '^[a-v0-9]{20}$');
+
+CREATE SEQUENCE IF NOT EXISTS public.xid_serial MINVALUE 0 MAXVALUE 16777215 CYCLE; -- ((255<<16) + (255<<8) + 255))
+
+SELECT setval('xid_serial', (random() * 16777215)::INT); -- ((255<<16) + (255<<8) + 255))
+
+CREATE OR REPLACE FUNCTION public._xid_machine_id()
+ RETURNS INT
+ LANGUAGE plpgsql
+ IMMUTABLE
+AS
+$$
+DECLARE
+BEGIN
+ RETURN (SELECT system_identifier & 16777215 FROM pg_control_system());
+END
+$$;
+
+CREATE OR REPLACE FUNCTION public.xid_encode(_id int[])
+ RETURNS public.xid
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _encoding CHAR(1)[] = '{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v}';
+BEGIN
+ RETURN _encoding[1 + (_id[1] >> 3)]
+ || _encoding[1 + ((_id[2] >> 6) & 31 | (_id[1] << 2) & 31)]
+ || _encoding[1 + ((_id[2] >> 1) & 31)]
+ || _encoding[1 + ((_id[3] >> 4) & 31 | (_id[2] << 4) & 31)]
+ || _encoding[1 + (_id[4] >> 7 | (_id[3] << 1) & 31)]
+ || _encoding[1 + ((_id[4] >> 2) & 31)]
+ || _encoding[1 + (_id[5] >> 5 | (_id[4] << 3) & 31)]
+ || _encoding[1 + (_id[5] & 31)]
+ || _encoding[1 + (_id[6] >> 3)]
+ || _encoding[1 + ((_id[7] >> 6) & 31 | (_id[6] << 2) & 31)]
+ || _encoding[1 + ((_id[7] >> 1) & 31)]
+ || _encoding[1 + ((_id[8] >> 4) & 31 | (_id[7] << 4) & 31)]
+ || _encoding[1 + (_id[9] >> 7 | (_id[8] << 1) & 31)]
+ || _encoding[1 + ((_id[9] >> 2) & 31)]
+ || _encoding[1 + ((_id[10] >> 5) | (_id[9] << 3) & 31)]
+ || _encoding[1 + (_id[10] & 31)]
+ || _encoding[1 + (_id[11] >> 3)]
+ || _encoding[1 + ((_id[12] >> 6) & 31 | (_id[11] << 2) & 31)]
+ || _encoding[1 + ((_id[12] >> 1) & 31)]
+ || _encoding[1 + ((_id[12] << 4) & 31)];
+END;
+$$;
+
+CREATE OR REPLACE FUNCTION public.xid_decode(_xid public.xid)
+ RETURNS int[]
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _dec int[] = '{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}';
+ _b bytea;
+BEGIN
+ _b := _xid::BYTEA;
+ return ARRAY [
+ ((_dec[get_byte(_b, 0)] << 3) | (_dec[get_byte(_b, 1)] >> 2)) & 255,
+ ((_dec[get_byte(_b, 1)] << 6) | (_dec[get_byte(_b, 2)] << 1) | (_dec[get_byte(_b, 3)] >> 4)) & 255,
+ ((_dec[get_byte(_b, 3)] << 4) | (_dec[get_byte(_b, 4)] >> 1)) & 255,
+ ((_dec[get_byte(_b, 4)] << 7) | (_dec[get_byte(_b, 5)] << 2) | (_dec[get_byte(_b, 6)] >> 3)) & 255,
+ ((_dec[get_byte(_b, 6)] << 5) | (_dec[get_byte(_b, 7)])) & 255,
+ ((_dec[get_byte(_b, 8)] << 3) | (_dec[get_byte(_b, 9)] >> 2)) & 255,
+ ((_dec[get_byte(_b, 9)] << 6) | (_dec[get_byte(_b, 10)] << 1) | (_dec[get_byte(_b, 11)] >> 4)) & 255,
+ ((_dec[get_byte(_b, 11)] << 4) | (_dec[get_byte(_b, 12)] >> 1)) & 255,
+ ((_dec[get_byte(_b, 12)] << 7) | (_dec[get_byte(_b, 13)] << 2) | (_dec[get_byte(_b, 14)] >> 3)) & 255,
+ ((_dec[get_byte(_b, 14)] << 5) | (_dec[get_byte(_b, 15)])) & 255,
+ ((_dec[get_byte(_b, 16)] << 3) | (_dec[get_byte(_b, 17)] >> 2)) & 255,
+ ((_dec[get_byte(_b, 17)] << 6) | (_dec[get_byte(_b, 18)] << 1) | (_dec[get_byte(_b, 19)] >> 4)) & 255
+ ];
+END;
+$$;
+
+CREATE OR REPLACE FUNCTION xid(_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP)
+ RETURNS public.xid
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _t INT;
+ _m INT;
+ _p INT;
+ _c INT;
+BEGIN
+ _t := floor(EXTRACT(epoch FROM _at));
+ _m := _xid_machine_id();
+ _p := pg_backend_pid();
+ _c := nextval('xid_serial')::INT;
+
+ return public.xid_encode(ARRAY [
+ (_t >> 24) & 255, (_t >> 16) & 255, (_t >> 8) & 255 , _t & 255,
+ (_m >> 16) & 255, (_m >> 8) & 255 , _m & 255,
+ (_p >> 8) & 255, _p & 255,
+ (_c >> 16) & 255, (_c >> 8) & 255 , _c & 255
+ ]);
+END;
+$$;
+
+CREATE OR REPLACE FUNCTION public.xid_time(_xid public.xid)
+ RETURNS TIMESTAMPTZ
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _id int[];
+BEGIN
+ _id := public.xid_decode(_xid);
+ return to_timestamp((_id[1] << 24)::BIGINT + (_id[2] << 16) + (_id[3] << 8) + (_id[4]));
+END;
+$$;
+
+CREATE OR REPLACE FUNCTION public.xid_machine(_xid public.xid)
+ RETURNS INT[]
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _id int[];
+BEGIN
+ _id := public.xid_decode(_xid);
+ return ARRAY [_id[5], _id[6], _id[7]];
+END;
+$$;
+
+CREATE OR REPLACE FUNCTION public.xid_pid(_xid public.xid)
+ RETURNS INT
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _id int[];
+BEGIN
+ _id := public.xid_decode(_xid);
+ return (_id[8] << 8) + (_id[9]);
+END;
+$$;
+
+CREATE OR REPLACE FUNCTION public.xid_counter(_xid public.xid)
+ RETURNS INT
+ LANGUAGE plpgsql
+AS
+$$
+DECLARE
+ _id int[];
+BEGIN
+ _id := public.xid_decode(_xid);
+ return (_id[10] << 16) + (_id[11] << 8) + (_id[12]);
+END;
+$$;
\ No newline at end of file
diff --git a/packages/carbon-database/prisma/migrations/20221121000000_claims/migration.sql b/packages/carbon-database/supabase/migrations/20230123004206_claims.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221121000000_claims/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004206_claims.sql
diff --git a/packages/carbon-database/prisma/migrations/20221122000000_user/migration.sql b/packages/carbon-database/supabase/migrations/20230123004316_users.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221122000000_user/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004316_users.sql
diff --git a/packages/carbon-database/prisma/migrations/20221126000000_employee_type/migration.sql b/packages/carbon-database/supabase/migrations/20230123004339_employee-types.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221126000000_employee_type/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004339_employee-types.sql
diff --git a/packages/carbon-database/prisma/migrations/20221126000000_permissions/migration.sql b/packages/carbon-database/supabase/migrations/20230123004409_permissions.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221126000000_permissions/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004409_permissions.sql
diff --git a/packages/carbon-database/prisma/migrations/20221202000000_employee/migration.sql b/packages/carbon-database/supabase/migrations/20230123004436_employee.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221202000000_employee/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004436_employee.sql
diff --git a/packages/carbon-database/prisma/migrations/20221223000000_buckets/migration.sql b/packages/carbon-database/supabase/migrations/20230123004514_buckets.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221223000000_buckets/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004514_buckets.sql
diff --git a/packages/carbon-database/prisma/migrations/20221227000000_attributes/migration.sql b/packages/carbon-database/supabase/migrations/20230123004536_attributes.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20221227000000_attributes/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004536_attributes.sql
diff --git a/packages/carbon-database/prisma/migrations/20230109000000_organizations/migration.sql b/packages/carbon-database/supabase/migrations/20230123004612_suppliers-and-customers.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20230109000000_organizations/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004612_suppliers-and-customers.sql
diff --git a/packages/carbon-database/prisma/migrations/20230110000000_groups/migration.sql b/packages/carbon-database/supabase/migrations/20230123004632_groups.sql
similarity index 100%
rename from packages/carbon-database/prisma/migrations/20230110000000_groups/migration.sql
rename to packages/carbon-database/supabase/migrations/20230123004632_groups.sql
diff --git a/yarn.lock b/yarn.lock
index b88f25dfb2..2d1c41913c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2672,23 +2672,6 @@
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45"
integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==
-"@prisma/client@^4.6.0":
- version "4.6.1"
- resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.6.1.tgz#e8e1d347ecbff44158d21b6591bb99650c8503a8"
- integrity sha512-M1+NNrMzqaOIxT7PBGcTs3IZo7d1EW/+gVQd4C4gUgWBDGgD9AcIeZnUSidgWClmpMSgVUdnVORjsWWGUameYA==
- dependencies:
- "@prisma/engines-version" "4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32"
-
-"@prisma/[email protected]":
- version "4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32"
- resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32.tgz#90a71bbdfd5172fc674009346a6ad6b84410cc0a"
- integrity sha512-HUCmkXAU2jqp2O1RvNtbE+seLGLyJGEABZS/R38rZjSAafAy0WzBuHq+tbZMnD+b5OSCsTVtIPVcuvx1ySxcWQ==
-
-"@prisma/[email protected]":
- version "4.6.1"
- resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-4.6.1.tgz#ae31309cc0f600f2da22708697b3be4eb1e46f9e"
- integrity sha512-3u2/XxvxB+Q7cMXHnKU0CpBiUK1QWqpgiBv28YDo1zOIJE3FCF8DI2vrp6vuwjGt5h0JGXDSvmSf4D4maVjJdw==
-
"@reach/observe-rect@^1.1.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@reach/observe-rect/-/observe-rect-1.2.0.tgz#d7a6013b8aafcc64c778a0ccb83355a11204d3b2"
@@ -10183,13 +10166,6 @@ [email protected], pretty-ms@^7.0.1:
dependencies:
parse-ms "^2.1.0"
-prisma@^4.6.0:
- version "4.6.1"
- resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.6.1.tgz#6c85fb667abed006a6b849c9c1ddd81d3f071b87"
- integrity sha512-BR4itMCuzrDV4tn3e2TF+nh1zIX/RVU0isKtKoN28ADeoJ9nYaMhiuRRkFd2TZN8+l/XfYzoRKyHzUFXLQhmBQ==
- dependencies:
- "@prisma/engines" "4.6.1"
-
process-nextick-args@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"