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

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