📝 Added a field to the comic model
This commit is contained in:
@@ -37,6 +37,7 @@ const ComicSchema = mongoose.Schema({
|
||||
name: String,
|
||||
path: String,
|
||||
fileSize: Number,
|
||||
containedIn: String,
|
||||
},
|
||||
acquisition: {
|
||||
wanted: Boolean,
|
||||
|
||||
12169
package-lock.json
generated
12169
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@
|
||||
"jest": "^25.1.0",
|
||||
"jest-cli": "^25.1.0",
|
||||
"moleculer-repl": "^0.6.2",
|
||||
"threetwo-ui-typings": "^1.0.1-0",
|
||||
"ts-jest": "^25.3.0",
|
||||
"ts-node": "^8.8.1"
|
||||
},
|
||||
@@ -36,8 +37,8 @@
|
||||
"@types/mkdirp": "^1.0.0",
|
||||
"@types/node": "^13.9.8",
|
||||
"@types/pino": "^6.3.8",
|
||||
"JSONStream": "^1.3.5",
|
||||
"fs-extra": "^10.0.0",
|
||||
"JSONStream": "^1.3.5",
|
||||
"lodash": "^4.17.21",
|
||||
"moleculer": "^0.14.0",
|
||||
"moleculer-db": "^0.8.4",
|
||||
|
||||
@@ -12,7 +12,6 @@ import { walkFolder } from "../utils/file.utils";
|
||||
import { convertXMLToJSON } from "../utils/xml.utils";
|
||||
|
||||
export default class ProductsService extends Service {
|
||||
// @ts-ignore
|
||||
public constructor(
|
||||
public broker: ServiceBroker,
|
||||
schema: ServiceSchema<{}> = { name: "import" }
|
||||
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
IExtractedComicBookCoverFile,
|
||||
IExtractionOptions,
|
||||
IFolderData,
|
||||
} from "../interfaces/folder.interface";
|
||||
} from "threetwo-ui-typings";
|
||||
import { logger } from "./logger.utils";
|
||||
import { validateComicBookMetadata } from "../utils/validation.utils";
|
||||
import { constructPaths, explodePath } from "../utils/file.utils";
|
||||
@@ -79,6 +79,7 @@ export const unrar = async (
|
||||
|
||||
switch (extractionOptions.extractTarget) {
|
||||
case "cover":
|
||||
console.log(walkedFolder);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
let fileNameToExtract = "";
|
||||
@@ -100,6 +101,7 @@ export const unrar = async (
|
||||
});
|
||||
const extractedFile = [...file.files][0];
|
||||
const fileArrayBuffer = extractedFile.extraction;
|
||||
|
||||
// Resize it to the specified width
|
||||
const outputFilePath =
|
||||
paths.targetPath + "/" + fileName;
|
||||
@@ -112,6 +114,7 @@ export const unrar = async (
|
||||
name: `${fileName}`,
|
||||
path: paths.targetPath,
|
||||
fileSize: fileHeader.packSize,
|
||||
containedIn: walkedFolder.containedIn,
|
||||
};
|
||||
if (validateComicBookMetadata(comicBookMetadata)) {
|
||||
resolve(comicBookMetadata);
|
||||
@@ -153,6 +156,7 @@ export const unrar = async (
|
||||
name: `${file.fileHeader.name}`,
|
||||
path: paths.targetPath,
|
||||
fileSize: file.fileHeader.packSize,
|
||||
containedIn: walkedFolder.containedIn,
|
||||
});
|
||||
}
|
||||
resolve(_.flatten(comicBookCoverFiles));
|
||||
@@ -216,6 +220,7 @@ export const unzip = async (
|
||||
name: fileName,
|
||||
fileSize: size,
|
||||
path: paths.targetPath,
|
||||
containedIn: walkedFolder.containedIn,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user