refactor(nestjs): wip import module

This commit is contained in:
Ahmed Bouhuolia
2025-05-28 17:01:46 +02:00
parent b7a3c42074
commit c51347d3ec
16 changed files with 119 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
import { Inject, Injectable } from '@nestjs/common';
import path from 'path';
import * as path from 'path';
import { promises as fs } from 'fs';
import { PageProperties, PdfFormat } from '@/libs/Chromiumly/_types';
import { UrlConverter } from '@/libs/Chromiumly/UrlConvert';
@@ -40,7 +40,7 @@ export class ChromiumlyHtmlConvert {
const cleanup = async () => {
await fs.unlink(filePath);
await Document.query().where('key', filename).delete();
await this.documentModel().query().where('key', filename).delete();
};
return [filename, cleanup];
}

View File

@@ -1,4 +1,4 @@
import path from 'path';
import * as path from 'path';
export const PDF_FILE_SUB_DIR = '/pdf';
export const PDF_FILE_EXPIRE_IN = 40; // ms
@@ -9,6 +9,5 @@ export const getPdfFilesStorageDir = (filename: string) => {
export const getPdfFilePath = (filename: string) => {
const storageDir = getPdfFilesStorageDir(filename);
return path.join(global.__storage_dir, storageDir);
return path.join(global.__static_dirname, storageDir);
};