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.

feat: remove address fields from Customer Contact and Supplier Contact

Rob Carrington9be7bb58aebb
diff --git a/apps/carbon/app/components/Contact.tsx b/apps/carbon/app/components/Contact.tsx
index 9384adbb92..547ca0f485 100644
--- a/apps/carbon/app/components/Contact.tsx
+++ b/apps/carbon/app/components/Contact.tsx
@@ -58,7 +58,7 @@ const Contact = ({ contact, url, user, actions }: ContactProps) => {
)}
{userStatus === UserStatus.Inactive && (
<span
- title="Inctive"
+ title="Inactive"
className="inline-block red-400 rounded-full w-3 h-3 ml-1.5"
/>
)}
diff --git a/apps/carbon/app/modules/purchasing/purchasing.service.ts b/apps/carbon/app/modules/purchasing/purchasing.service.ts
index bf4456a40f..5ade1af080 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.service.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.service.ts
@@ -235,7 +235,7 @@ export async function getSupplierContact(
return client
.from("supplierContact")
.select(
- "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, addressLine1, addressLine2, city, state, postalCode, country(id, name), birthday, notes)"
+ "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes)"
)
.eq("id", supplierContactId)
.single();
@@ -248,7 +248,7 @@ export async function getSupplierContacts(
return client
.from("supplierContact")
.select(
- "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, addressLine1, addressLine2, city, state, postalCode, country(id, name), birthday, notes), user(id, active)"
+ "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes), user(id, active)"
)
.eq("supplierId", supplierId);
}
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx
index 735238720b..8c49a360ac 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx
@@ -17,7 +17,6 @@ import { useEffect } from "react";
import type { z } from "zod";
import {
CustomFormFields,
- DatePicker,
Hidden,
Input,
PhoneInput,
@@ -100,13 +99,6 @@ const SupplierContactForm = ({
<PhoneInput name="homePhone" label="Home Phone" />
<PhoneInput name="workPhone" label="Work Phone" />
<PhoneInput name="fax" label="Fax" />
- <Input name="addressLine1" label="Address Line 1" />
- <Input name="addressLine2" label="Address Line 2" />
- <Input name="city" label="City" />
- <Input name="state" label="State" />
- <Input name="postalCode" label="Zip Code" />
- {/* Country dropdown */}
- <DatePicker name="birthday" label="Birthday" />
<TextArea name="notes" label="Notes" />
<CustomFormFields table="supplierContact" />
</VStack>
diff --git a/apps/carbon/app/modules/sales/sales.service.ts b/apps/carbon/app/modules/sales/sales.service.ts
index ca86c12662..8696e684d0 100644
--- a/apps/carbon/app/modules/sales/sales.service.ts
+++ b/apps/carbon/app/modules/sales/sales.service.ts
@@ -206,7 +206,7 @@ export async function getCustomerContact(
return client
.from("customerContact")
.select(
- "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, addressLine1, addressLine2, city, state, postalCode, country(id, name), birthday, notes)"
+ "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes)"
)
.eq("id", customerContactId)
.single();
@@ -219,7 +219,7 @@ export async function getCustomerContacts(
return client
.from("customerContact")
.select(
- "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, addressLine1, addressLine2, city, state, postalCode, country(id, name), birthday, notes), user(id, active)"
+ "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes), user(id, active)"
)
.eq("customerId", customerId);
}
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx
index d8b900d4fa..90290d9b31 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx
@@ -14,7 +14,6 @@ import { useFetcher } from "@remix-run/react";
import type { z } from "zod";
import {
CustomFormFields,
- DatePicker,
Hidden,
Input,
PhoneInput,
@@ -89,13 +88,6 @@ const CustomerContactForm = ({
<PhoneInput name="homePhone" label="Home Phone" />
<PhoneInput name="workPhone" label="Work Phone" />
<PhoneInput name="fax" label="Fax" />
- <Input name="addressLine1" label="Address Line 1" />
- <Input name="addressLine2" label="Address Line 2" />
- <Input name="city" label="City" />
- <Input name="state" label="State" />
- <Input name="postalCode" label="Zip Code" />
- {/* Country dropdown */}
- <DatePicker name="birthday" label="Birthday" />
<TextArea name="notes" label="Notes" />
<CustomFormFields table="customerContact" />
</VStack>
diff --git a/apps/carbon/app/types/validators.ts b/apps/carbon/app/types/validators.ts
index 2450d6eda1..7eee8b4c06 100644
--- a/apps/carbon/app/types/validators.ts
+++ b/apps/carbon/app/types/validators.ts
@@ -34,8 +34,6 @@ export const contact = {
mobilePhone: zfd.text(z.string().optional()),
homePhone: zfd.text(z.string().optional()),
workPhone: zfd.text(z.string().optional()),
- birthday: zfd.text(z.string().optional()),
- ...address,
};
export const favoriteSchema = z.object({
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index c575b13158..05a495755b 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -2173,12 +2173,7 @@ export type Database = {
}
contact: {
Row: {
- addressLine1: string | null
- addressLine2: string | null
- birthday: string | null
- city: string | null
companyId: string
- countryCode: number | null
email: string
fax: string | null
firstName: string
@@ -2188,18 +2183,11 @@ export type Database = {
lastName: string
mobilePhone: string | null
notes: string | null
- postalCode: string | null
- state: string | null
title: string | null
workPhone: string | null
}
Insert: {
- addressLine1?: string | null
- addressLine2?: string | null
- birthday?: string | null
- city?: string | null
companyId: string
- countryCode?: number | null
email: string
fax?: string | null
firstName: string
@@ -2209,18 +2197,11 @@ export type Database = {
lastName: string
mobilePhone?: string | null
notes?: string | null
- postalCode?: string | null
- state?: string | null
title?: string | null
workPhone?: string | null
}
Update: {
- addressLine1?: string | null
- addressLine2?: string | null
- birthday?: string | null
- city?: string | null
companyId?: string
- countryCode?: number | null
email?: string
fax?: string | null
firstName?: string
@@ -2230,8 +2211,6 @@ export type Database = {
lastName?: string
mobilePhone?: string | null
notes?: string | null
- postalCode?: string | null
- state?: string | null
title?: string | null
workPhone?: string | null
}
@@ -2264,13 +2243,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "contact_countryCode_fkey"
- columns: ["countryCode"]
- isOneToOne: false
- referencedRelation: "country"
- referencedColumns: ["id"]
- },
]
}
contractor: {
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index c575b13158..05a495755b 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -2173,12 +2173,7 @@ export type Database = {
}
contact: {
Row: {
- addressLine1: string | null
- addressLine2: string | null
- birthday: string | null
- city: string | null
companyId: string
- countryCode: number | null
email: string
fax: string | null
firstName: string
@@ -2188,18 +2183,11 @@ export type Database = {
lastName: string
mobilePhone: string | null
notes: string | null
- postalCode: string | null
- state: string | null
title: string | null
workPhone: string | null
}
Insert: {
- addressLine1?: string | null
- addressLine2?: string | null
- birthday?: string | null
- city?: string | null
companyId: string
- countryCode?: number | null
email: string
fax?: string | null
firstName: string
@@ -2209,18 +2197,11 @@ export type Database = {
lastName: string
mobilePhone?: string | null
notes?: string | null
- postalCode?: string | null
- state?: string | null
title?: string | null
workPhone?: string | null
}
Update: {
- addressLine1?: string | null
- addressLine2?: string | null
- birthday?: string | null
- city?: string | null
companyId?: string
- countryCode?: number | null
email?: string
fax?: string | null
firstName?: string
@@ -2230,8 +2211,6 @@ export type Database = {
lastName?: string
mobilePhone?: string | null
notes?: string | null
- postalCode?: string | null
- state?: string | null
title?: string | null
workPhone?: string | null
}
@@ -2264,13 +2243,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "contact_countryCode_fkey"
- columns: ["countryCode"]
- isOneToOne: false
- referencedRelation: "country"
- referencedColumns: ["id"]
- },
]
}
contractor: {
diff --git a/packages/database/supabase/migrations/20240813152858_remove-contact-address-fields.sql b/packages/database/supabase/migrations/20240813152858_remove-contact-address-fields.sql
new file mode 100644
index 0000000000..8cd584e24a
--- /dev/null
+++ b/packages/database/supabase/migrations/20240813152858_remove-contact-address-fields.sql
@@ -0,0 +1,8 @@
+ALTER TABLE "contact"
+ DROP COLUMN "addressLine1",
+ DROP COLUMN "addressLine2",
+ DROP COLUMN "city",
+ DROP COLUMN "state",
+ DROP COLUMN "postalCode",
+ DROP COLUMN "countryCode",
+ DROP COLUMN "birthday";
\ No newline at end of file