Fix prettier

This commit is contained in:
Alex Browne
2018-12-04 20:08:32 -08:00
parent 00f86ca0f7
commit 2e704ac01a
2 changed files with 18 additions and 25 deletions

View File

@@ -150,17 +150,17 @@ set the`ZEROEX_DATA_PIPELINE_DB_URL` environment variable to a valid
#### Additional guidelines and tips:
- Table names should be plural and separated by underscores (e.g.,
* Table names should be plural and separated by underscores (e.g.,
`exchange_fill_events`).
- Any table which contains data which comes directly from a third-party source
* Any table which contains data which comes directly from a third-party source
should be namespaced in the `raw` PostgreSQL schema.
- Column names in the database should be separated by underscores (e.g.,
* Column names in the database should be separated by underscores (e.g.,
`maker_asset_type`).
- Field names in entity classes (like any other fields in TypeScript) should
* Field names in entity classes (like any other fields in TypeScript) should
be camel-cased (e.g., `makerAssetType`).
- All timestamps should be stored as milliseconds since the Unix Epoch.
- Use the `BigNumber` type for TypeScript code which deals with 256-bit
* All timestamps should be stored as milliseconds since the Unix Epoch.
* Use the `BigNumber` type for TypeScript code which deals with 256-bit
numbers from smart contracts or for any case where we are dealing with large
floating point numbers.
- [TypeORM documentation](http://typeorm.io/#/) is pretty robust and can be a
* [TypeORM documentation](http://typeorm.io/#/) is pretty robust and can be a
helpful resource.

View File

@@ -29,22 +29,17 @@ async function getOrderbookAsync(): Promise<void> {
console.log(`Got ${rawOrders.records.length} orders.`);
console.log('Parsing orders...');
// Parse the sra orders, then add source url to each.
const orders = R.pipe(
parseSraOrders,
R.map(setSourceUrl(RADAR_RELAY_URL)),
)(rawOrders);
const orders = R.pipe(parseSraOrders, R.map(setSourceUrl(RADAR_RELAY_URL)))(rawOrders);
// Save all the orders and update the observed time stamps in a single
// transaction.
console.log('Saving orders and updating timestamps...');
await connection.transaction(
async (manager: EntityManager): Promise<void> => {
for (const order of orders) {
await manager.save(SraOrder, order);
const observedTimestamp = createObservedTimestampForOrder(order);
await manager.save(observedTimestamp);
}
},
);
await connection.transaction(async (manager: EntityManager): Promise<void> => {
for (const order of orders) {
await manager.save(SraOrder, order);
const observedTimestamp = createObservedTimestampForOrder(order);
await manager.save(observedTimestamp);
}
});
}
const sourceUrlProp = R.lensProp('sourceUrl');
@@ -53,8 +48,6 @@ const sourceUrlProp = R.lensProp('sourceUrl');
* Sets the source url for a single order. Returns a new order instead of
* mutating the given one.
*/
const setSourceUrl = R.curry(
(sourceURL: string, order: SraOrder): SraOrder => {
return R.set(sourceUrlProp, sourceURL, order);
},
);
const setSourceUrl = R.curry((sourceURL: string, order: SraOrder): SraOrder => {
return R.set(sourceUrlProp, sourceURL, order);
});