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