Skip to content

Commit e4d1cda

Browse files
authored
Merge pull request #13 from oslabs-beta/common
update common pkg in all services
2 parents 095e6ea + ef6b68e commit e4d1cda

File tree

13 files changed

+185
-33
lines changed

13 files changed

+185
-33
lines changed

examples_new/microservices/auth/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples_new/microservices/auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"author": "",
1919
"license": "ISC",
2020
"dependencies": {
21-
"@chronosrx/common": "^1.0.3",
21+
"@chronosrx/common": "^1.0.4",
2222
"axios": "^1.6.2",
2323
"bcryptjs": "^2.4.3",
2424
"cookie-parser": "^1.4.6",
Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,76 @@
1-
export declare enum Events {
1+
export declare enum EventTypes {
22
USER_CREATED = "USER_CREATED",
33
ITEM_CREATED = "ITEM_CREATED",
4-
ORDER_CREATED = "ORDER_CREATED"
4+
ITEM_UPDATED = "ITEM_UPDATED",
5+
ITEM_DELETED = "ITEM_DELETED",
6+
INVENTORY_CREATED = "INVENTORY_CREATED",
7+
INVENTORY_UPDATED = "INVENTORY_UPDATED",
8+
INVENTORY_DELETED = "INVENTORY_DELETED",
9+
ORDER_CREATED = "ORDER_CREATED",
10+
ORDER_DELETED = "ORDER_DELETED"
511
}
12+
export type Events = {
13+
type: EventTypes.USER_CREATED;
14+
payload: {
15+
id: string;
16+
username: string;
17+
};
18+
} | {
19+
type: EventTypes.ITEM_CREATED;
20+
payload: {
21+
id: string;
22+
itemName: string;
23+
sellerId: string;
24+
unitPrice: number;
25+
};
26+
} | {
27+
type: EventTypes.ITEM_UPDATED;
28+
payload: {
29+
id: string;
30+
itemName: string;
31+
sellerId: string;
32+
unitPrice: number;
33+
};
34+
} | {
35+
type: EventTypes.ITEM_DELETED;
36+
payload: {
37+
id: string;
38+
};
39+
} | {
40+
type: EventTypes.INVENTORY_CREATED;
41+
payload: {
42+
id: string;
43+
itemId: string;
44+
itemName: string;
45+
sellerId: string;
46+
unitPrice: number;
47+
units: number;
48+
};
49+
} | {
50+
type: EventTypes.INVENTORY_UPDATED;
51+
payload: {
52+
id: string;
53+
itemId: string;
54+
itemName: string;
55+
sellerId: string;
56+
unitPrice: number;
57+
units: number;
58+
};
59+
} | {
60+
type: EventTypes.INVENTORY_DELETED;
61+
payload: {
62+
itemId: string;
63+
};
64+
} | {
65+
type: EventTypes.ORDER_CREATED;
66+
payload: {
67+
itemId: string;
68+
amount: number;
69+
};
70+
} | {
71+
type: EventTypes.ORDER_DELETED;
72+
payload: {
73+
itemId: string;
74+
amount: number;
75+
};
76+
};
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.Events = void 0;
4-
var Events;
5-
(function (Events) {
6-
Events["USER_CREATED"] = "USER_CREATED";
7-
Events["ITEM_CREATED"] = "ITEM_CREATED";
8-
Events["ORDER_CREATED"] = "ORDER_CREATED";
9-
})(Events = exports.Events || (exports.Events = {}));
3+
exports.EventTypes = void 0;
4+
var EventTypes;
5+
(function (EventTypes) {
6+
EventTypes["USER_CREATED"] = "USER_CREATED";
7+
EventTypes["ITEM_CREATED"] = "ITEM_CREATED";
8+
EventTypes["ITEM_UPDATED"] = "ITEM_UPDATED";
9+
EventTypes["ITEM_DELETED"] = "ITEM_DELETED";
10+
EventTypes["INVENTORY_CREATED"] = "INVENTORY_CREATED";
11+
EventTypes["INVENTORY_UPDATED"] = "INVENTORY_UPDATED";
12+
EventTypes["INVENTORY_DELETED"] = "INVENTORY_DELETED";
13+
EventTypes["ORDER_CREATED"] = "ORDER_CREATED";
14+
EventTypes["ORDER_DELETED"] = "ORDER_DELETED";
15+
})(EventTypes = exports.EventTypes || (exports.EventTypes = {}));

examples_new/microservices/common/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples_new/microservices/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chronosrx/common",
3-
"version": "1.0.2",
3+
"version": "1.0.4",
44
"description": "Common modules for Chronos Microservice",
55
"main": "./build/index.js",
66
"types": "./build/index.d.ts",

examples_new/microservices/common/src/events/events.ts

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export enum Events {
1+
export enum EventTypes {
22
USER_CREATED = 'USER_CREATED',
33
ITEM_CREATED = 'ITEM_CREATED',
44
ITEM_UPDATED = 'ITEM_UPDATED',
@@ -9,3 +9,78 @@ export enum Events {
99
ORDER_CREATED = 'ORDER_CREATED',
1010
ORDER_DELETED = 'ORDER_DELETED',
1111
}
12+
13+
export type Events =
14+
| {
15+
type: EventTypes.USER_CREATED;
16+
payload: {
17+
id: string;
18+
username: string;
19+
};
20+
}
21+
| {
22+
type: EventTypes.ITEM_CREATED;
23+
payload: {
24+
id: string;
25+
itemName: string;
26+
sellerId: string;
27+
unitPrice: number;
28+
};
29+
}
30+
| {
31+
type: EventTypes.ITEM_UPDATED;
32+
payload: {
33+
id: string;
34+
itemName: string;
35+
sellerId: string;
36+
unitPrice: number;
37+
};
38+
}
39+
| {
40+
type: EventTypes.ITEM_DELETED;
41+
payload: {
42+
id: string;
43+
};
44+
}
45+
| {
46+
type: EventTypes.INVENTORY_CREATED;
47+
payload: {
48+
id: string;
49+
itemId: string;
50+
itemName: string;
51+
sellerId: string;
52+
unitPrice: number;
53+
units: number;
54+
};
55+
}
56+
| {
57+
type: EventTypes.INVENTORY_UPDATED;
58+
payload: {
59+
id: string;
60+
itemId: string;
61+
itemName: string;
62+
sellerId: string;
63+
unitPrice: number;
64+
units: number;
65+
};
66+
}
67+
| {
68+
type: EventTypes.INVENTORY_DELETED;
69+
payload: {
70+
itemId: string;
71+
};
72+
}
73+
| {
74+
type: EventTypes.ORDER_CREATED;
75+
payload: {
76+
itemId: string;
77+
amount: number;
78+
};
79+
}
80+
| {
81+
type: EventTypes.ORDER_DELETED;
82+
payload: {
83+
itemId: string;
84+
amount: number;
85+
};
86+
};

examples_new/microservices/event-bus/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples_new/microservices/event-bus/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"author": "",
1212
"license": "ISC",
1313
"dependencies": {
14-
"@chronosrx/common": "^1.0.3",
14+
"@chronosrx/common": "^1.0.4",
1515
"axios": "^1.6.2",
1616
"express": "^4.18.2",
1717
"ts-node-dev": "^2.0.0"

examples_new/microservices/inventory/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples_new/microservices/inventory/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"author": "",
1919
"license": "ISC",
2020
"dependencies": {
21-
"@chronosrx/common": "^1.0.3",
21+
"@chronosrx/common": "^1.0.4",
2222
"cookie-parser": "^1.4.6",
2323
"dotenv": "^16.3.1",
2424
"express": "^4.18.2",

examples_new/microservices/items/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples_new/microservices/items/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"author": "",
1919
"license": "ISC",
2020
"dependencies": {
21-
"@chronosrx/common": "^1.0.3",
21+
"@chronosrx/common": "^1.0.4",
2222
"axios": "^1.6.2",
2323
"cookie-parser": "^1.4.6",
2424
"dotenv": "^16.3.1",

0 commit comments

Comments
 (0)