Skip to content

Commit

Permalink
Merge pull request #13 from oslabs-beta/common
Browse files Browse the repository at this point in the history
update common pkg in all services
  • Loading branch information
seantokuzo committed Dec 20, 2023
2 parents 095e6ea + ef6b68e commit e4d1cda
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 33 deletions.
8 changes: 4 additions & 4 deletions examples_new/microservices/auth/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples_new/microservices/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@chronosrx/common": "^1.0.3",
"@chronosrx/common": "^1.0.4",
"axios": "^1.6.2",
"bcryptjs": "^2.4.3",
"cookie-parser": "^1.4.6",
Expand Down
75 changes: 73 additions & 2 deletions examples_new/microservices/common/build/events/events.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
export declare enum Events {
export declare enum EventTypes {
USER_CREATED = "USER_CREATED",
ITEM_CREATED = "ITEM_CREATED",
ORDER_CREATED = "ORDER_CREATED"
ITEM_UPDATED = "ITEM_UPDATED",
ITEM_DELETED = "ITEM_DELETED",
INVENTORY_CREATED = "INVENTORY_CREATED",
INVENTORY_UPDATED = "INVENTORY_UPDATED",
INVENTORY_DELETED = "INVENTORY_DELETED",
ORDER_CREATED = "ORDER_CREATED",
ORDER_DELETED = "ORDER_DELETED"
}
export type Events = {
type: EventTypes.USER_CREATED;
payload: {
id: string;
username: string;
};
} | {
type: EventTypes.ITEM_CREATED;
payload: {
id: string;
itemName: string;
sellerId: string;
unitPrice: number;
};
} | {
type: EventTypes.ITEM_UPDATED;
payload: {
id: string;
itemName: string;
sellerId: string;
unitPrice: number;
};
} | {
type: EventTypes.ITEM_DELETED;
payload: {
id: string;
};
} | {
type: EventTypes.INVENTORY_CREATED;
payload: {
id: string;
itemId: string;
itemName: string;
sellerId: string;
unitPrice: number;
units: number;
};
} | {
type: EventTypes.INVENTORY_UPDATED;
payload: {
id: string;
itemId: string;
itemName: string;
sellerId: string;
unitPrice: number;
units: number;
};
} | {
type: EventTypes.INVENTORY_DELETED;
payload: {
itemId: string;
};
} | {
type: EventTypes.ORDER_CREATED;
payload: {
itemId: string;
amount: number;
};
} | {
type: EventTypes.ORDER_DELETED;
payload: {
itemId: string;
amount: number;
};
};
20 changes: 13 additions & 7 deletions examples_new/microservices/common/build/events/events.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Events = void 0;
var Events;
(function (Events) {
Events["USER_CREATED"] = "USER_CREATED";
Events["ITEM_CREATED"] = "ITEM_CREATED";
Events["ORDER_CREATED"] = "ORDER_CREATED";
})(Events = exports.Events || (exports.Events = {}));
exports.EventTypes = void 0;
var EventTypes;
(function (EventTypes) {
EventTypes["USER_CREATED"] = "USER_CREATED";
EventTypes["ITEM_CREATED"] = "ITEM_CREATED";
EventTypes["ITEM_UPDATED"] = "ITEM_UPDATED";
EventTypes["ITEM_DELETED"] = "ITEM_DELETED";
EventTypes["INVENTORY_CREATED"] = "INVENTORY_CREATED";
EventTypes["INVENTORY_UPDATED"] = "INVENTORY_UPDATED";
EventTypes["INVENTORY_DELETED"] = "INVENTORY_DELETED";
EventTypes["ORDER_CREATED"] = "ORDER_CREATED";
EventTypes["ORDER_DELETED"] = "ORDER_DELETED";
})(EventTypes = exports.EventTypes || (exports.EventTypes = {}));
4 changes: 2 additions & 2 deletions examples_new/microservices/common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples_new/microservices/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chronosrx/common",
"version": "1.0.2",
"version": "1.0.4",
"description": "Common modules for Chronos Microservice",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
77 changes: 76 additions & 1 deletion examples_new/microservices/common/src/events/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Events {
export enum EventTypes {
USER_CREATED = 'USER_CREATED',
ITEM_CREATED = 'ITEM_CREATED',
ITEM_UPDATED = 'ITEM_UPDATED',
Expand All @@ -9,3 +9,78 @@ export enum Events {
ORDER_CREATED = 'ORDER_CREATED',
ORDER_DELETED = 'ORDER_DELETED',
}

export type Events =
| {
type: EventTypes.USER_CREATED;
payload: {
id: string;
username: string;
};
}
| {
type: EventTypes.ITEM_CREATED;
payload: {
id: string;
itemName: string;
sellerId: string;
unitPrice: number;
};
}
| {
type: EventTypes.ITEM_UPDATED;
payload: {
id: string;
itemName: string;
sellerId: string;
unitPrice: number;
};
}
| {
type: EventTypes.ITEM_DELETED;
payload: {
id: string;
};
}
| {
type: EventTypes.INVENTORY_CREATED;
payload: {
id: string;
itemId: string;
itemName: string;
sellerId: string;
unitPrice: number;
units: number;
};
}
| {
type: EventTypes.INVENTORY_UPDATED;
payload: {
id: string;
itemId: string;
itemName: string;
sellerId: string;
unitPrice: number;
units: number;
};
}
| {
type: EventTypes.INVENTORY_DELETED;
payload: {
itemId: string;
};
}
| {
type: EventTypes.ORDER_CREATED;
payload: {
itemId: string;
amount: number;
};
}
| {
type: EventTypes.ORDER_DELETED;
payload: {
itemId: string;
amount: number;
};
};
8 changes: 4 additions & 4 deletions examples_new/microservices/event-bus/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples_new/microservices/event-bus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@chronosrx/common": "^1.0.3",
"@chronosrx/common": "^1.0.4",
"axios": "^1.6.2",
"express": "^4.18.2",
"ts-node-dev": "^2.0.0"
Expand Down
8 changes: 4 additions & 4 deletions examples_new/microservices/inventory/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples_new/microservices/inventory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@chronosrx/common": "^1.0.3",
"@chronosrx/common": "^1.0.4",
"cookie-parser": "^1.4.6",
"dotenv": "^16.3.1",
"express": "^4.18.2",
Expand Down
8 changes: 4 additions & 4 deletions examples_new/microservices/items/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples_new/microservices/items/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@chronosrx/common": "^1.0.3",
"@chronosrx/common": "^1.0.4",
"axios": "^1.6.2",
"cookie-parser": "^1.4.6",
"dotenv": "^16.3.1",
Expand Down

0 comments on commit e4d1cda

Please sign in to comment.