+
+
+
+
diff --git a/src/app/api/contact-records/route.ts b/src/app/api/contact-records/route.ts
index 735c3a6..fa7abfe 100644
--- a/src/app/api/contact-records/route.ts
+++ b/src/app/api/contact-records/route.ts
@@ -10,6 +10,7 @@ export async function GET(request: NextRequest) {
// Get query parameters
const url = new URL(request.url);
const customerId = url.searchParams.get('customerId');
+ const contactType = url.searchParams.get('contactType');
const dateFrom = url.searchParams.get('dateFrom');
const dateTo = url.searchParams.get('dateTo');
@@ -27,6 +28,11 @@ export async function GET(request: NextRequest) {
whereClause.customerId = customerId;
}
+ // Filter by contact type if provided
+ if (contactType) {
+ whereClause.contactType = contactType;
+ }
+
// Filter by date range if provided
if (dateFrom || dateTo) {
whereClause.createdAt = {};
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
new file mode 100644
index 0000000..6708ba0
--- /dev/null
+++ b/src/lib/constants.ts
@@ -0,0 +1,9 @@
+// Contact record types
+export const CONTACT_TYPES = [
+ { value: 'Email', label: 'Email' },
+ { value: 'EmailSent', label: 'Email sent' },
+ { value: 'EmailReceived', label: 'Email received' },
+ { value: 'Phone', label: 'Phone' },
+ { value: 'Meeting', label: 'Meeting' },
+ { value: 'Other', label: 'Other' }
+];