diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 12:08:32 +0800 |
---|---|---|
committer | Fred Carlsen <fred@sjelfull.no> | 2018-12-06 19:06:35 +0800 |
commit | a3718803a0a56d82092f15b6f190a01ba299280f (patch) | |
tree | 885839bf7a17981e3812635f1c9ca33473c337e8 /packages/pipeline | |
parent | 6742142ca567d49e2e67d0ab0f5fc55b1351ec7c (diff) | |
download | dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.tar dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.tar.gz dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.tar.bz2 dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.tar.lz dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.tar.xz dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.tar.zst dexon-sol-tools-a3718803a0a56d82092f15b6f190a01ba299280f.zip |
Fix prettier
Diffstat (limited to 'packages/pipeline')
-rw-r--r-- | packages/pipeline/README.md | 14 | ||||
-rw-r--r-- | packages/pipeline/src/scripts/pull_radar_relay_orders.ts | 29 |
2 files changed, 18 insertions, 25 deletions
diff --git a/packages/pipeline/README.md b/packages/pipeline/README.md index 0f4abd935..794488cac 100644 --- a/packages/pipeline/README.md +++ b/packages/pipeline/README.md @@ -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. diff --git a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts index bbbef9b47..6c18bcaef 100644 --- a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts +++ b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts @@ -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); +}); |