-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NRPT-777 Update NRIS-EMLI Importer (#901)
* NRPT-777 Update NRIS-EMLI Importer * Add configurable app urls
- Loading branch information
Showing
18 changed files
with
387 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
angular/projects/public-nrpti/src/app/pipes/project-link.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
|
||
import { StoreService, ConfigService } from 'nrpti-angular-components'; | ||
import { ProjectLinkPipe } from './project-link.pipe'; | ||
|
||
describe('LinkifyPipe', () => { | ||
describe('ProjectLinkPipe', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HttpClientTestingModule], | ||
providers: [StoreService, ConfigService, ProjectLinkPipe] | ||
}); | ||
}); | ||
|
||
it('create an instance', () => { | ||
const pipe = new ProjectLinkPipe(); | ||
const pipe: ProjectLinkPipe = TestBed.get(ProjectLinkPipe); | ||
|
||
expect(pipe).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
|
||
// list all collections that require this migration | ||
const collections = ['nrpti', 'redacted_record_subset']; | ||
|
||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function(options, seedLink) {}; | ||
|
||
exports.up = async function(db) { | ||
console.log('**** Deleting existing EMLI records ****'); | ||
|
||
const mClient = await db.connection.connect(db.connectionString, { | ||
native_parser: true | ||
}); | ||
|
||
try { | ||
for (const collection of collections) { | ||
try { | ||
const dbCollection = await mClient.collection(collection); | ||
|
||
const result = await dbCollection.deleteMany({ sourceSystemRef: 'nris-emli' }); | ||
|
||
console.log(`Deleted ${result.deletedCount} records from ${collection}`); | ||
} catch (err) { | ||
console.log(`Error deleting records (${collection}): ${err}`); | ||
} | ||
} | ||
|
||
console.log(`**** Finished deleting existing EMLI records ****`); | ||
} catch (err) { | ||
console.log(`Error deleting records: ${err}`); | ||
} finally { | ||
mClient.close(); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
exports.down = function(db) { | ||
return null; | ||
}; | ||
|
||
exports._meta = { | ||
version: 1 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function(options, seedLink) {}; | ||
|
||
exports.up = async function(db) { | ||
console.log('**** Adding app URLs ****'); | ||
const mClient = await db.connection.connect(db.connectionString, { native_parser: true }); | ||
|
||
try { | ||
const nrpti = await mClient.collection('nrpti'); | ||
await nrpti.insertOne({ | ||
_schemaName: 'ApplicationUrl', | ||
data: { | ||
bcmi: { | ||
dev: 'https://bcmi-f00029-dev.apps.silver.devops.gov.bc.ca', | ||
test: 'https://bcmi-f00029-test.apps.silver.devops.gov.bc.ca', | ||
prod: 'https://mines.nrs.gov.bc.ca' | ||
}, | ||
nrced: { | ||
dev: 'https://nrced-f00029-test.apps.silver.devops.gov.bc.ca', | ||
test: 'https://nrced-f00029-test.apps.silver.devops.gov.bc.ca', | ||
prod: 'https://nrced.gov.bc.ca' | ||
}, | ||
lng: { | ||
dev: 'https://lng-f00029-test.apps.silver.devops.gov.bc.ca', | ||
test: 'https://lng-f00029-test.apps.silver.devops.gov.bc.ca', | ||
prod: 'https://lng.gov.bc.ca' | ||
}, | ||
nrpti: { | ||
dev: 'https://nrpti-f00029-dev.apps.silver.devops.gov.bc.ca', | ||
test: 'https://nrpti-f00029-test.apps.silver.devops.gov.bc.ca', | ||
prod: 'https://nrpti-f00029-prod.apps.silver.devops.gov.bc.ca' | ||
} | ||
} | ||
}); | ||
console.log('**** Finished adding app URLs ****'); | ||
} catch (error) { | ||
console.error(`Migration did not complete. Error processing records: ${error.message}`); | ||
} | ||
|
||
mClient.close(); | ||
}; | ||
|
||
exports.down = function(db) { | ||
return null; | ||
}; | ||
|
||
exports._meta = { | ||
version: 1 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.