refactor(quick-260921-m34): Aufgabe 1 - Mandantenbindung entzaubert, 105 unnoetige any-Zusicherungen entfernt
- prisma-tenant.extension.ts: (prisma as any) und die Handannotation an
$allOperations in forTenant()/forSystem() entfernt; Kopfkommentar
unveraendert. .then((results: any[]) => ...) auf unknown[] umgestellt.
- 105 Aufrufstellen `const X = forTenant(...) as any` / `forSystem(...) as
any` von der Zusicherung befreit, Zuweisungsform woertlich erhalten
(rls-access-inventory.spec.ts bleibt scharf, 30/30 gruen einzeln
geprueft).
- withTenantTransaction(): Prisma.TransactionClient fuer tx probiert,
gemessen verworfen - bricht das Testdoppel in
prisma-tenant.extension.spec.ts (TS2322 auf einem absichtlich
unvollstaendigen Fake-Objekt). tx bleibt any, mit Begruendung am Typ.
- Gefolge des jetzt getypten Klienten entfernt: any[]-Annotationen und
.map((x: any) => ...) in groups.service.ts, module-grants.service.ts,
dkv.service.ts, ldap-config.service.ts, tenders.controller.ts:270.
- Befund (D-03): tender-matching.service.ts:159 trug eine Handannotation
(match: { tender: unknown }), die den Wert nur deshalb auf unknown
verengte, um TS7006 unter dem alten any-Klienten zu vermeiden - mit dem
getypten Klienten war das falsch. Annotation geloescht, kein Ersatz
durch Zusicherung.
- Zwei any bleiben gezielt in groups.service.ts (u/a in
ensureDefaultGroup(), gefolge von tx: any) - Begruendung am Code.
noExplicitAny apps/api/src: 288 -> 149 (Schranke 155). type-check 4/4,
lint 5/5 (0 error). apps/api 72/1143 gruen, apps/web 73/531 gruen,
rls-access-inventory.spec.ts 30/30 gruen.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TPPB4ApQxzSU1rwV2Ffj9J
This commit is contained in:
@@ -54,7 +54,7 @@ export class ModuleAccessService {
|
||||
// bestehen: der Schalter ist weiterhin aus (#18), die Datenbankregel
|
||||
// wirkt heute nicht, und die Anwendungspruefung ist bis zum
|
||||
// Scharfschalten der einzige tatsaechliche Schutz.
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId) as any;
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId);
|
||||
|
||||
if (role === 'ADMIN' || role === 'SUPER_ADMIN') {
|
||||
const activations = await tenantPrisma.tenantModuleActivation.findMany({
|
||||
@@ -142,7 +142,7 @@ export class ModuleAccessService {
|
||||
// erzeugt ihren EIGENEN Klienten (dieselbe Konvention wie
|
||||
// `module-grants.service.ts`: gebundene Klienten werden nicht zwischen
|
||||
// Methoden weitergereicht). Beide laufen wie bisher nebenlaeufig.
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId) as any;
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId);
|
||||
const [activations, accessibleIds] = await Promise.all([
|
||||
tenantPrisma.tenantModuleActivation.findMany({
|
||||
where: { tenantId, isActive: true },
|
||||
|
||||
@@ -47,7 +47,7 @@ export class ModuleRegistryService {
|
||||
* Returns all active modules for a given tenant.
|
||||
*/
|
||||
async findActiveForTenant(tenantId: string) {
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId) as any;
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId);
|
||||
const activations = await tenantPrisma.tenantModuleActivation.findMany({
|
||||
where: {
|
||||
tenantId,
|
||||
@@ -77,7 +77,7 @@ export class ModuleRegistryService {
|
||||
throw new NotFoundException(`Module with id '${moduleId}' not found`);
|
||||
}
|
||||
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId) as any;
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId);
|
||||
return tenantPrisma.tenantModuleActivation.upsert({
|
||||
where: {
|
||||
tenantId_moduleId: {
|
||||
@@ -117,7 +117,7 @@ export class ModuleRegistryService {
|
||||
// EIN gebundener Klient fuer beide Aktivierungszugriffe dieser Methode
|
||||
// (Lesen, Schreiben) — nicht ein Klient je Zugriff (260910-exd,
|
||||
// Aufgabe 3, dieselbe Konvention wie `module-access.service.ts`).
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId) as any;
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId);
|
||||
|
||||
// Check if activation record exists
|
||||
const activation = await tenantPrisma.tenantModuleActivation.findUnique({
|
||||
@@ -172,7 +172,7 @@ export class ModuleRegistryService {
|
||||
return false;
|
||||
}
|
||||
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId) as any;
|
||||
const tenantPrisma = forTenant(this.prisma, tenantId);
|
||||
const activation = await tenantPrisma.tenantModuleActivation.findUnique({
|
||||
where: {
|
||||
tenantId_moduleId: {
|
||||
|
||||
Reference in New Issue
Block a user