Build MerchantFlow onboarding CRM foundation

This commit is contained in:
Oleksandr Prokhorenko
2026-09-24 16:43:22 +03:00
commit 3aa47d825f
78 changed files with 10739 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import type { User } from '@merchantflow/contracts';
import type { Prisma } from '@merchantflow/database';
export function merchantScope(user: User): Prisma.MerchantWhereInput {
switch (user.role) {
case 'HEAD_OF_SALES':
return {};
case 'COMPLIANCE_OFFICER':
return { status: { in: ['KYB', 'COMPLIANCE_REVIEW'] } };
case 'ACCOUNT_MANAGER':
return { ownerId: user.id };
default:
return { id: '__no_access__' };
}
}