hotfix-add subgroup customer

This commit is contained in:
phaichayon
2026-06-18 08:58:01 +07:00
parent 04a886ea26
commit 0650cf6297
38 changed files with 8674 additions and 687 deletions

View File

@@ -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 });
}