hotfix-add subgroup customer
This commit is contained in:
@@ -18,7 +18,8 @@ type Params = {
|
||||
const customerRequestSchema = customerSchema.extend({
|
||||
branchId: z.string().nullable().optional(),
|
||||
leadChannel: z.string().nullable().optional(),
|
||||
customerGroup: z.string().nullable().optional()
|
||||
customerGroup: z.string().nullable().optional(),
|
||||
customerSubGroup: z.string().nullable().optional()
|
||||
});
|
||||
|
||||
export async function GET(_request: NextRequest, { params }: Params) {
|
||||
@@ -44,9 +45,7 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
return NextResponse.json({ message: error.message }, { status: error.status });
|
||||
}
|
||||
|
||||
if (error instanceof Error) {
|
||||
return NextResponse.json({ message: error.message }, { status: 400 });
|
||||
}
|
||||
console.error('GET /api/crm/customers/[id] failed', error);
|
||||
|
||||
return NextResponse.json({ message: 'Unable to load customer' }, { status: 500 });
|
||||
}
|
||||
@@ -89,9 +88,7 @@ export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
);
|
||||
}
|
||||
|
||||
if (error instanceof Error) {
|
||||
return NextResponse.json({ message: error.message }, { status: 400 });
|
||||
}
|
||||
console.error('PATCH /api/crm/customers/[id] failed', error);
|
||||
|
||||
return NextResponse.json({ message: 'Unable to update customer' }, { status: 500 });
|
||||
}
|
||||
@@ -125,9 +122,7 @@ export async function DELETE(_request: NextRequest, { params }: Params) {
|
||||
return NextResponse.json({ message: error.message }, { status: error.status });
|
||||
}
|
||||
|
||||
if (error instanceof Error) {
|
||||
return NextResponse.json({ message: error.message }, { status: 400 });
|
||||
}
|
||||
console.error('DELETE /api/crm/customers/[id] failed', error);
|
||||
|
||||
return NextResponse.json({ message: 'Unable to delete customer' }, { status: 500 });
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import { AuthError, requireOrganizationAccess } from '@/lib/auth/session';
|
||||
const customerRequestSchema = customerSchema.extend({
|
||||
branchId: z.string().nullable().optional(),
|
||||
leadChannel: z.string().nullable().optional(),
|
||||
customerGroup: z.string().nullable().optional()
|
||||
customerGroup: z.string().nullable().optional(),
|
||||
customerSubGroup: z.string().nullable().optional()
|
||||
});
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
@@ -50,9 +51,7 @@ export async function GET(request: NextRequest) {
|
||||
return NextResponse.json({ message: error.message }, { status: error.status });
|
||||
}
|
||||
|
||||
if (error instanceof Error) {
|
||||
return NextResponse.json({ message: error.message }, { status: 400 });
|
||||
}
|
||||
console.error('GET /api/crm/customers failed', error);
|
||||
|
||||
return NextResponse.json({ message: 'Unable to load customers' }, { status: 500 });
|
||||
}
|
||||
@@ -95,9 +94,7 @@ export async function POST(request: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
if (error instanceof Error) {
|
||||
return NextResponse.json({ message: error.message }, { status: 400 });
|
||||
}
|
||||
console.error('POST /api/crm/customers failed', error);
|
||||
|
||||
return NextResponse.json({ message: 'Unable to create customer' }, { status: 500 });
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ export async function GET(request: NextRequest) {
|
||||
return NextResponse.json({ message: error.message }, { status: error.status });
|
||||
}
|
||||
|
||||
console.error('GET /api/crm/dashboard failed', error);
|
||||
|
||||
return NextResponse.json({ message: 'Unable to load CRM dashboard' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user