mbs-importer-jps
Advanced tools
Comparing version 1.0.0-1 to 1.0.0-2
@@ -12,2 +12,3 @@ import { Job, JobConfig } from "server-socket-framework-jps"; | ||
private fileName; | ||
private db; | ||
constructor(); | ||
@@ -14,0 +15,0 @@ static getInstance(): XMLImporter; |
@@ -24,3 +24,2 @@ "use strict"; | ||
const xml2js_1 = __importDefault(require("xml2js")); | ||
const MongoDataSource_1 = require("./db/MongoDataSource"); | ||
require('dotenv').config(); | ||
@@ -115,6 +114,6 @@ const converters = require('./util/fieldConverters'); | ||
}); | ||
MongoDataSource_1.MongoDataSource.getCollection(this.collection).deleteMany({}).then((result) => { | ||
MongoDataSource_1.MongoDataSource.getCollection(this.collection).insertMany(processedItems).then((result) => { | ||
db.collection(this.collection).deleteMany({}).then((result) => { | ||
db.collection(this.collection).insertMany(processedItems).then((result) => { | ||
// now we need to calculated the derived values | ||
MongoDataSource_1.MongoDataSource.getCollection(this.collection).find({ isDerived: true }).toArray().then((derivedItems) => { | ||
db.collection(this.collection).find({ isDerived: true }).toArray().then((derivedItems) => { | ||
/* | ||
@@ -185,3 +184,3 @@ compute the derived fee | ||
} | ||
MongoDataSource_1.MongoDataSource.getCollection(this.collection).replaceOne({ _id: item._id }, item); | ||
db.collection(this.collection).replaceOne({ _id: item._id }, item); | ||
}); | ||
@@ -208,10 +207,7 @@ resolve(processedItems.length); | ||
databaseConnected(db) { | ||
// this.importWithConnection(this.fileName,db).then((result) => { | ||
// this.handleCompleted(this.fileName); | ||
// }); | ||
this.db = db; | ||
} | ||
executeJob(runId, cb) { | ||
const db = MongoDataSource_1.MongoDataSource.getInstance().getDatabase(); | ||
if (db) { | ||
this.importWithConnection(this.fileName, db).then((result) => { | ||
if (this.db) { | ||
this.importWithConnection(this.fileName, this.db).then((result) => { | ||
this.handleCompleted(this.fileName); | ||
@@ -218,0 +214,0 @@ cb(runId, this.getConfig(), server_socket_framework_jps_1.JobStatus.completed, null); |
{ | ||
"name": "mbs-importer-jps", | ||
"version": "1.0.0-1", | ||
"version": "1.0.0-2", | ||
"description": "A patient management web application", | ||
@@ -5,0 +5,0 @@ "main": "dist/XMLImporter.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40144
493