Skip to content

Commit

Permalink
refactor: made format of date in orderbook-db streamlined
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNilesh committed Jun 18, 2024
1 parent e596211 commit f130205
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/adapters/orderbook-db/src/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function executeOrder(orderId: string, hashes: string[]): Promise<IOrder |
{ id: orderId },
{
status: "E",
"timestamps.executed": Date.now(),
"timestamps.executed": new Date(),
hashes: hashes
}
).exec();
Expand Down Expand Up @@ -90,7 +90,7 @@ async function cancelOrder(orderId: string): Promise<IOrder | null> {
{ id: orderId },
{
status: "C",
"timestamps.cancelled": Date.now()
"timestamps.cancelled": new Date()
}
).exec();

Expand Down
8 changes: 4 additions & 4 deletions packages/adapters/orderbook-db/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ interface IOrder {
signer: string; // signer address
wallet: string; // SCW wallet address
timestamps: {
placed: number;
executed?: number;
cancelled?: number;
placed: Date;
executed?: Date;
cancelled?: Date;
};
dapps: string[];
distribution?: boolean;
Expand Down Expand Up @@ -57,7 +57,7 @@ OrderSchema.pre("save", function (next) {
this.status = "P";
// TODO: Include once utils are ready:
// this.id = keccak256(`${this.timestamp}-${this.wallet}`);
this.timestamps.placed = Date.now();
this.timestamps.placed = new Date();
}
next();
});
Expand Down

0 comments on commit f130205

Please sign in to comment.