1
0
Fork 0

[DEV-5312] Get delta processor program field from mongodb

master
Austin Schaffer 2019-12-18 11:36:40 -05:00
parent d7f01e12c8
commit 5e5932fe9d
7 changed files with 20 additions and 2 deletions

View File

@ -81,6 +81,9 @@ export interface DeltaDocument
/** The document id */
id: DocumentId,
/** The source program */
programId: string,
/** The entity name */
agentName: string,

View File

@ -45,6 +45,9 @@ export type DocumentMeta =
/** The document id */
id: DocumentId,
/** The source program */
program: string,
/** The entity name */
entity_name: string,

View File

@ -109,6 +109,7 @@ export class DeltaProcessor
const ratedata = doc.ratedata || {};
const meta = {
id: doc.id,
program: doc.programId,
entity_name: doc.agentName,
entity_id: +doc.agentEntityId,
startDate: doc.startDate,

View File

@ -139,7 +139,7 @@ export class V1MessageWriter implements MessageWriter
},
program: {
Program: {
id: 'quote_server',
id: meta.program,
version: '',
},
},

View File

@ -40,6 +40,7 @@ export class MongoDeltaDao implements DeltaDao
/** The document fields to read */
readonly RESULT_FIELDS: Record<string, number> = {
id: 1,
programId: 1,
agentName: 1,
agentEntityId: 1,
startDate: 1,

View File

@ -428,6 +428,7 @@ describe( 'system.DeltaProcessor', () =>
const createdData = <UnixTimestamp>234234234;
const doc = <DeltaDocument[]>[ {
id: <DocumentId>123,
programId: 'mega',
agentName: entity_num,
agentEntityId: entity_id,
startDate: createdData,
@ -447,6 +448,7 @@ describe( 'system.DeltaProcessor', () =>
},
{
id: <DocumentId>234,
programId: 'mega',
agentName: entity_num,
agentEntityId: entity_id,
startDate: createdData,
@ -471,6 +473,7 @@ describe( 'system.DeltaProcessor', () =>
entity_id: 4321,
entity_name: 'Some Agency',
id: 123,
program: 'mega',
lastUpdate: 123123123,
startDate: 234234234,
},
@ -483,6 +486,7 @@ describe( 'system.DeltaProcessor', () =>
entity_id: 4321,
entity_name: 'Some Agency',
id: 234,
program: 'mega',
lastUpdate: 123123123,
startDate: 234234234,
},
@ -548,6 +552,7 @@ describe( 'system.DeltaProcessor', () =>
const emitter = new EventEmitter();
const doc = <DeltaDocument[]>[ {
id: <DocumentId>123,
programId: 'mega',
agentName: 'Some Agency',
agentEntityId: 4321,
startDate: <UnixTimestamp>234234234,
@ -567,6 +572,7 @@ describe( 'system.DeltaProcessor', () =>
},
{
id: <DocumentId>234,
programId: 'mega',
agentName: 'Some Agency',
agentEntityId: 4321,
startDate: <UnixTimestamp>234234234,
@ -591,6 +597,7 @@ describe( 'system.DeltaProcessor', () =>
entity_id: 4321,
entity_name: 'Some Agency',
id: 123,
program: 'mega',
lastUpdate: 123123123,
startDate: 234234234,
},

View File

@ -372,11 +372,13 @@ describe( 'system.V1MessageWriter', () =>
} );
it( 'Message is formatted correctly', () =>
{
const bucket = { foo: [ 'bar', 'baz' ] };
const ratedata = {};
const doc_id = <DocumentId>123;
const program = 'mega';
const entity_name = 'Some Agency';
const entity_id = 123;
const startDate = <UnixTimestamp>345;
@ -386,6 +388,7 @@ describe( 'system.V1MessageWriter', () =>
const encoder = createMockEncoderCtor( schema );
const meta = <DocumentMeta>{
id: doc_id,
program: program,
entity_name: entity_name,
entity_id: entity_id,
startDate: startDate,
@ -442,7 +445,7 @@ describe( 'system.V1MessageWriter', () =>
},
program: {
Program: {
id: 'quote_server',
id: program,
version: '',
},
},