chore(workspace): eradicate all tsc errors and eslint warnings across frontend, admin, and backend
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
4659a7b1de
commit
9f11d8fb2d
98 files changed
+1272
-1009
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { DecimalInterceptor } from './decimal.interceptor';
|
||||
import { ExecutionContext, CallHandler } from '@nestjs/common';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
@@ -25,8 +26,8 @@ describe('DecimalInterceptor', () => {
|
||||
],
|
||||
};
|
||||
|
||||
const executionContext: any = {};
|
||||
const callHandler: any = {
|
||||
const executionContext = {} as ExecutionContext;
|
||||
const callHandler: CallHandler = {
|
||||
handle: () => of(mockData),
|
||||
};
|
||||
|
||||
@@ -53,11 +54,12 @@ describe('DecimalInterceptor', () => {
|
||||
createdAt: new Date('2026-01-01T00:00:00.000Z'),
|
||||
};
|
||||
|
||||
const callHandler: any = {
|
||||
const executionContext = {} as ExecutionContext;
|
||||
const callHandler: CallHandler = {
|
||||
handle: () => of(mockData),
|
||||
};
|
||||
|
||||
interceptor.intercept({} as any, callHandler).subscribe((result) => {
|
||||
interceptor.intercept(executionContext, callHandler).subscribe((result) => {
|
||||
expect(result).toEqual(mockData);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -10,11 +10,11 @@ import { Prisma } from '@prisma/client';
|
||||
|
||||
@Injectable()
|
||||
export class DecimalInterceptor implements NestInterceptor {
|
||||
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
|
||||
return next.handle().pipe(map((data) => this.transform(data)));
|
||||
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
|
||||
return next.handle().pipe(map((data: unknown) => this.transform(data)));
|
||||
}
|
||||
|
||||
private transform(data: any): any {
|
||||
private transform(data: unknown): unknown {
|
||||
if (data === null || data === undefined) {
|
||||
return data;
|
||||
}
|
||||
@@ -24,13 +24,14 @@ export class DecimalInterceptor implements NestInterceptor {
|
||||
}
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
return data.map((item) => this.transform(item));
|
||||
return data.map((item: unknown) => this.transform(item));
|
||||
}
|
||||
|
||||
if (typeof data === 'object' && !(data instanceof Date)) {
|
||||
const transformedObj: Record<string, any> = {};
|
||||
for (const key of Object.keys(data)) {
|
||||
transformedObj[key] = this.transform(data[key]);
|
||||
const obj = data as Record<string, unknown>;
|
||||
const transformedObj: Record<string, unknown> = {};
|
||||
for (const key of Object.keys(obj)) {
|
||||
transformedObj[key] = this.transform(obj[key]);
|
||||
}
|
||||
return transformedObj;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user