Skip to content

Commit 2c9396a

Browse files
authored
feat: njord adhoc (#2703)
1 parent 4e1bf7a commit 2c9396a

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ MAGNI_ORIGIN=http://localhost:9000
4040
MEILI_ORIGIN=http://localhost:7700/
4141
SUBMIT_ARTICLE_THRESHOLD=250
4242
ANALYTICS_URL=http://localhost:5000
43-
NJORD_ORIGIN=http://localhost:50051
43+
NJORD_ORIGIN=http://njord-transactions-server
4444

4545
MEILI_INDEX=dev
4646
MEILI_TOKEN=dev

bin/import.ts

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const start = async (): Promise<void> => {
6464
await importEntity(con, 'UserTopReader');
6565
await importEntity(con, 'MarketingCta');
6666
await importEntity(con, 'SourceMember');
67+
await importEntity(con, 'Product');
6768
// Manually have to reset these as insert has a issue with `type` columns
6869
await con.query(`update post set type = 'article' where type = 'Post'`);
6970
await con.query(`update source set type = 'machine' where type = 'Source'`);

seeds/Product.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"id": "a39d7368-22d9-4e01-b961-077179ff992d",
4+
"type": "award",
5+
"image": "https:\/\/daily-now-res.cloudinary.com\/image\/upload\/s--t9sWnia4--\/f_auto,q_auto\/v1740123247\/awards\/Unicorn",
6+
"name": "Test",
7+
"createdAt": "2025-03-05T14:13:01.035Z",
8+
"updatedAt": "2025-03-05T14:13:01.035Z",
9+
"value": 10,
10+
"flags": "{}"
11+
},
12+
{
13+
"id": "ef2e2633-c9b9-401a-a372-0edce9fa6329",
14+
"type": "award",
15+
"image": "https:\/\/daily-now-res.cloudinary.com\/image\/upload\/s--t9sWnia4--\/f_auto,q_auto\/v1740123247\/awards\/Unicorn",
16+
"name": "Test 2",
17+
"createdAt": "2025-03-05T14:13:01.035Z",
18+
"updatedAt": "2025-03-05T14:13:01.035Z",
19+
"value": 25,
20+
"flags": "{}"
21+
},
22+
{
23+
"id": "8aeb45ce-2e96-4dbf-826d-433c98047642",
24+
"type": "award",
25+
"image": "https:\/\/daily-now-res.cloudinary.com\/image\/upload\/s--t9sWnia4--\/f_auto,q_auto\/v1740123247\/awards\/Unicorn",
26+
"name": "Test 3",
27+
"createdAt": "2025-03-05T14:13:01.035Z",
28+
"updatedAt": "2025-03-05T14:13:01.035Z",
29+
"value": 50,
30+
"flags": "{}"
31+
},
32+
{
33+
"id": "1b536ed1-3ab0-4780-a179-d0387d4c6d72",
34+
"type": "award",
35+
"image": "https:\/\/daily-now-res.cloudinary.com\/image\/upload\/s--t9sWnia4--\/f_auto,q_auto\/v1740123247\/awards\/Unicorn",
36+
"name": "Test free",
37+
"createdAt": "2025-03-05T14:13:01.035Z",
38+
"updatedAt": "2025-03-05T14:13:01.035Z",
39+
"value": 0,
40+
"flags": "{}"
41+
}
42+
]

src/workers/transactionBalanceLog.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ export const transactionBalanceLogWorker: TypedWorker<'njord.v1.balance-log'> =
1010
logger.info({ data }, 'transaction log');
1111
},
1212
parseMessage: (message) => {
13-
return {
14-
...message,
15-
data: TransferResponse.fromBinary(message.data),
16-
};
13+
return TransferResponse.fromBinary(message.data);
1714
},
1815
};

src/workers/worker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface BaseTypedWorker<
5353
subscription: string;
5454
handler: Worker;
5555
maxMessages?: number;
56-
parseMessage?: (message: Message) => TypedMessage<T>;
56+
parseMessage?: (message: Message) => T;
5757
}
5858

5959
export interface TypedWorker<T extends keyof PubSubSchema>

0 commit comments

Comments
 (0)