mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-24 22:36:38 +02:00
fix: VisibilityLevel Enum-Referenzen durch String-Literale ersetzen
Prisma Enums existieren als Runtime-Objekt nur nach prisma generate,
aber TypeScript im watch-mode erwartet importierbare Werte. Verwende
stattdessen direkte String-Vergleiche ('ALL', 'TEAM', 'OWN').
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b484f4380f
commit
3adca2de65
4 changed files with 15 additions and 15 deletions
|
|
@ -11,7 +11,7 @@ import { VisibilityService } from '../visibility/visibility.service';
|
|||
import { TeamResolverService } from '../visibility/team-resolver.service';
|
||||
import { JwtPayload } from '../common/decorators/current-user.decorator';
|
||||
import { Prisma } from '.prisma/crm-client';
|
||||
import { VisibilityLevel } from '../common/utils/build-visibility-filter';
|
||||
// VisibilityLevel type re-exported from build-visibility-filter
|
||||
|
||||
@Injectable()
|
||||
export class ActivitiesService {
|
||||
|
|
@ -91,15 +91,15 @@ export class ActivitiesService {
|
|||
user.role === 'TENANT_ADMIN' ||
|
||||
user.tenantRole === 'ADMIN';
|
||||
|
||||
if (!isAdmin && level !== VisibilityLevel.ALL) {
|
||||
if (!isAdmin && level !== 'ALL') {
|
||||
let effectiveLevel = level;
|
||||
if (user.tenantRole === 'TEAM_LEAD' && level === VisibilityLevel.OWN) {
|
||||
effectiveLevel = VisibilityLevel.TEAM;
|
||||
if (user.tenantRole === 'TEAM_LEAD' && level === 'OWN') {
|
||||
effectiveLevel = 'TEAM';
|
||||
}
|
||||
|
||||
if (effectiveLevel === VisibilityLevel.OWN) {
|
||||
if (effectiveLevel === 'OWN') {
|
||||
where.createdBy = user.sub;
|
||||
} else if (effectiveLevel === VisibilityLevel.TEAM) {
|
||||
} else if (effectiveLevel === 'TEAM') {
|
||||
let teamIds = [user.sub];
|
||||
if (bearerToken) {
|
||||
teamIds = await this.teamResolver.getTeamMemberIds(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { TeamResolverService } from '../visibility/team-resolver.service';
|
|||
import { buildVisibilityFilter } from '../common/utils/build-visibility-filter';
|
||||
import { JwtPayload } from '../common/decorators/current-user.decorator';
|
||||
import { Prisma } from '.prisma/crm-client';
|
||||
import { VisibilityLevel } from '../common/utils/build-visibility-filter';
|
||||
// VisibilityLevel type re-exported from build-visibility-filter
|
||||
import { EntityStatus } from '../common/dto/contact-info.dto';
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -128,9 +128,9 @@ export class CompaniesService {
|
|||
let baseWhere: Record<string, unknown> = { tenantId };
|
||||
if (user) {
|
||||
const level = await this.visibilityService.getLevel(tenantId, 'COMPANY');
|
||||
if (level !== VisibilityLevel.ALL) {
|
||||
if (level !== 'ALL') {
|
||||
let teamMemberIds: string[] | undefined;
|
||||
if (level === VisibilityLevel.TEAM && bearerToken) {
|
||||
if (level === 'TEAM' && bearerToken) {
|
||||
teamMemberIds = await this.teamResolver.getTeamMemberIds(
|
||||
user.sub,
|
||||
user.department,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { TeamResolverService } from '../visibility/team-resolver.service';
|
|||
import { buildVisibilityFilter } from '../common/utils/build-visibility-filter';
|
||||
import { JwtPayload } from '../common/decorators/current-user.decorator';
|
||||
import { Prisma } from '.prisma/crm-client';
|
||||
import { VisibilityLevel } from '../common/utils/build-visibility-filter';
|
||||
// VisibilityLevel type re-exported from build-visibility-filter
|
||||
import { EntityStatus } from '../common/dto/contact-info.dto';
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -136,9 +136,9 @@ export class ContactsService {
|
|||
let baseWhere: Record<string, unknown> = { tenantId };
|
||||
if (user) {
|
||||
const level = await this.visibilityService.getLevel(tenantId, 'CONTACT');
|
||||
if (level !== VisibilityLevel.ALL) {
|
||||
if (level !== 'ALL') {
|
||||
let teamMemberIds: string[] | undefined;
|
||||
if (level === VisibilityLevel.TEAM && bearerToken) {
|
||||
if (level === 'TEAM' && bearerToken) {
|
||||
teamMemberIds = await this.teamResolver.getTeamMemberIds(
|
||||
user.sub,
|
||||
user.department,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { TeamResolverService } from '../visibility/team-resolver.service';
|
|||
import { buildVisibilityFilter } from '../common/utils/build-visibility-filter';
|
||||
import { JwtPayload } from '../common/decorators/current-user.decorator';
|
||||
import { Prisma } from '.prisma/crm-client';
|
||||
import { VisibilityLevel } from '../common/utils/build-visibility-filter';
|
||||
// VisibilityLevel type re-exported from build-visibility-filter
|
||||
|
||||
@Injectable()
|
||||
export class DealsService {
|
||||
|
|
@ -145,9 +145,9 @@ export class DealsService {
|
|||
let baseWhere: Record<string, unknown> = { tenantId };
|
||||
if (user) {
|
||||
const level = await this.visibilityService.getLevel(tenantId, 'DEAL');
|
||||
if (level !== VisibilityLevel.ALL) {
|
||||
if (level !== 'ALL') {
|
||||
let teamMemberIds: string[] | undefined;
|
||||
if (level === VisibilityLevel.TEAM && bearerToken) {
|
||||
if (level === 'TEAM' && bearerToken) {
|
||||
teamMemberIds = await this.teamResolver.getTeamMemberIds(
|
||||
user.sub,
|
||||
user.department,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue