Build MerchantFlow onboarding CRM foundation
This commit is contained in:
@@ -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__' };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user