Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/admin/dto/admin.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Type } from 'class-transformer';
import {
ArrayMinSize,
Expand Down
41 changes: 23 additions & 18 deletions src/admin/interceptors/admin-access-logging.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
// @ts-nocheck

import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';

import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';

import { AuditService } from '../../audit/audit.service';
import { PrismaService } from '../../database/prisma.service';

@Injectable()
export class AdminAccessLoggingInterceptor implements NestInterceptor {
constructor(private readonly auditService: AuditService) {}
constructor(private readonly prisma: PrismaService) {}

intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
const request = context.switchToHttp().getRequest();

const response = context.switchToHttp().getResponse();

return next.handle().pipe(
tap(async () => {
tap(() => {
const user = request.user;

await this.auditService.log({
action: 'ADMIN_DASHBOARD_ACCESS',
userId: user?.id,
resourceType: 'dashboard',
resourceId: null,
metadata: {
path: request.originalUrl,
method: request.method,
statusCode: response.statusCode,
timestamp: new Date().toISOString(),
},
});
if (!user?.id) return;

this.prisma.activityLog
.create({
data: {
userId: user.id,
action: 'ADMIN_DASHBOARD_ACCESS',
entityType: 'dashboard',
description: 'Admin dashboard access',
metadata: {
path: request.originalUrl,
method: request.method,
statusCode: response.statusCode,
timestamp: new Date().toISOString(),
},
},
})
.catch(() => {
// Non-blocking: audit log failure should not affect the response
});
}),
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/admin/queue/queue.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Controller, Get, Post, Delete, Param, UseGuards } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
2 changes: 0 additions & 2 deletions src/admin/queue/queue.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bullmq';
import { QueueController } from './queue.controller';
Expand Down
16 changes: 9 additions & 7 deletions src/admin/queue/queue.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Injectable, Logger, NotFoundException } from '@nestjs/common';
import { InjectQueue } from '@nestjs/bullmq';
import { Queue } from 'bullmq';
Expand All @@ -17,7 +15,7 @@ export class QueueMonitoringService {

for (const queueName of KNOWN_QUEUES) {
try {
const queue = this.getQueueByName(queueName);
const queue = await this.getQueueByName(queueName);
if (!queue) continue;

const [waiting, active, completed, failed, delayed, paused] = await Promise.all([
Expand All @@ -26,19 +24,21 @@ export class QueueMonitoringService {
queue.getCompletedCount(),
queue.getFailedCount(),
queue.getDelayedCount(),
queue.getPausedCount(),
queue.getJobCounts('paused').then((c) => c.paused ?? 0),
]);

queues.push({
name: queueName,
counts: { waiting, active, completed, failed, delayed, paused },
});
} catch (error) {
this.logger.error(`Failed to get stats for queue ${queueName}: ${error.message}`);
this.logger.error(
`Failed to get stats for queue ${queueName}: ${error instanceof Error ? error.message : String(error)}`,
);
queues.push({
name: queueName,
counts: { waiting: 0, active: 0, completed: 0, failed: 0, delayed: 0, paused: 0 },
error: error.message,
error: error instanceof Error ? error.message : String(error),
});
}
}
Expand Down Expand Up @@ -148,7 +148,9 @@ export class QueueMonitoringService {
delayed,
});
} catch (error) {
this.logger.error(`Failed to get metrics for queue ${queueName}: ${error.message}`);
this.logger.error(
`Failed to get metrics for queue ${queueName}: ${error instanceof Error ? error.message : String(error)}`,
);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/config/api-decorators-example.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

/**
* Example Usage of API Documentation Decorators
* Shows how to use the custom API documentation decorators
Expand Down
2 changes: 0 additions & 2 deletions src/config/api-decorators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

/**
* API Documentation Decorators
* Decorators for enriching OpenAPI documentation
Expand Down
2 changes: 0 additions & 2 deletions src/config/api-docs.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

/**
* API Documentation Controller
* Provides access to OpenAPI spec and API information
Expand Down
2 changes: 0 additions & 2 deletions src/config/api-documentation.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

/**
* API Documentation Module
* Provides Swagger/OpenAPI documentation and related endpoints
Expand Down
2 changes: 0 additions & 2 deletions src/config/changelog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

/**
* API Changelog
* Tracks all changes, features, and improvements across versions
Expand Down
8 changes: 2 additions & 6 deletions src/config/swagger.config.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
// @ts-nocheck

/**
* Swagger/OpenAPI Configuration
* Sets up comprehensive API documentation with Swagger UI
*/

import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { DocumentBuilder, SwaggerModule, OpenAPIObject } from '@nestjs/swagger';
import { INestApplication, Logger } from '@nestjs/common';

const logger = new Logger('SwaggerConfig');

interface AppWithOpenApiDoc {
openAPIDocument?: Record<string, unknown>;
openAPIDocument?: OpenAPIObject;
}

export function setupSwagger(app: INestApplication): void {
const config = new DocumentBuilder()
.setTitle('PropChain API')
.setDescription('Blockchain-Powered Real Estate Platform API Documentation')
.setVersion('2.0.0')
.setOpenAPI('3.1.0')
.addBearerAuth(
{
type: 'http',
Expand Down Expand Up @@ -137,7 +134,6 @@ export function setupOpenAPIEndpoint(app: INestApplication): void {
.setTitle('PropChain API')
.setDescription('Blockchain-Powered Real Estate Platform API')
.setVersion('2.0.0')
.setOpenAPI('3.1.0')
.addBearerAuth(
{
type: 'http',
Expand Down
2 changes: 0 additions & 2 deletions src/email-digest/digest.scheduler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Injectable, Logger } from '@nestjs/common';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Cron, CronExpression } from '@nestjs/schedule';
Expand Down
2 changes: 0 additions & 2 deletions src/email-digest/dto/update-digest-preference.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { IsEnum, IsBoolean, IsOptional } from 'class-validator';
import { DigestFrequency } from '@prisma/client';

Expand Down
2 changes: 0 additions & 2 deletions src/email-digest/email-digest.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Body, Controller, Get, Param, Patch, Query, Res, UseGuards } from '@nestjs/common';
import { Response } from 'express';
Expand Down
2 changes: 0 additions & 2 deletions src/email-digest/email-digest.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Module } from '@nestjs/common';
import { EmailDigestService } from './email-digest.service';
import { EmailDigestController } from './email-digest.controller';
Expand Down
6 changes: 3 additions & 3 deletions src/email-digest/email-digest.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Injectable, Logger } from '@nestjs/common';
import { PrismaService } from '../database/prisma.service';
import { EmailService } from '../email/email.service';
Expand Down Expand Up @@ -74,7 +72,9 @@ export class EmailDigestService {
data: { lastSentAt: new Date() },
});
} catch (err) {
this.logger.error(`Failed to send digest to ${pref.user.email}: ${err.message}`);
this.logger.error(
`Failed to send digest to ${pref.user.email}: ${err instanceof Error ? err.message : String(err)}`,
);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/trust-score/dto/trust-score.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

export class ScoreFactor {
score: number;
maxScore: number;
Expand Down
2 changes: 0 additions & 2 deletions src/trust-score/trust-score.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import {
Controller,
Get,
Expand Down
2 changes: 0 additions & 2 deletions src/trust-score/trust-score.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Module } from '@nestjs/common';
import { PrismaModule } from '../database/prisma.module';
import { TrustScoreService } from './trust-score.service';
Expand Down
2 changes: 0 additions & 2 deletions src/trust-score/trust-score.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { Injectable, Logger } from '@nestjs/common';
import { PrismaService } from '../database/prisma.service';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
2 changes: 0 additions & 2 deletions src/trust-score/types/authenticated-request.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

export interface AuthenticatedRequest {
authUser: {
id: string;
Expand Down
2 changes: 0 additions & 2 deletions src/trust-score/types/user-data.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

export interface UserData {
id: string;
email: string;
Expand Down
Loading