-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from ZIMkaRU/refactoring/move-sync-schema-to-…
…separate-files Move sync schema to separate files
- Loading branch information
Showing
27 changed files
with
578 additions
and
405 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.CANDLES, | ||
maxLimit: 10000, | ||
dateFieldName: 'mts', | ||
symbolFieldName: '_symbol', | ||
timeframeFieldName: '_timeframe', | ||
sort: [['mts', -1]], | ||
hasNewData: false, | ||
start: [], | ||
confName: 'candlesConf', | ||
isSyncRequiredAtLeastOnce: true, | ||
additionalApiCallArgs: { isNotMoreThanInnerMax: true }, | ||
type: COLLS_TYPES.PUBLIC_INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.CANDLES) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.CHANGE_LOGS, | ||
maxLimit: 10000, | ||
dateFieldName: 'mtsCreate', | ||
symbolFieldName: null, | ||
sort: [['mtsCreate', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: false, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.CHANGE_LOGS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.CURRENCIES, | ||
maxLimit: 10000, | ||
projection: null, | ||
sort: [['name', 1]], | ||
hasNewData: false, | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.PUBLIC_UPDATABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.CURRENCIES) | ||
} |
20 changes: 20 additions & 0 deletions
20
workers/loc.api/sync/schema/sync-schema/funding-credit-history.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.FUNDING_CREDIT_HISTORY, | ||
maxLimit: 10000, | ||
dateFieldName: 'mtsUpdate', | ||
symbolFieldName: 'symbol', | ||
sort: [['mtsUpdate', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: false, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.FUNDING_CREDIT_HISTORY) | ||
} |
20 changes: 20 additions & 0 deletions
20
workers/loc.api/sync/schema/sync-schema/funding-loan-history.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.FUNDING_LOAN_HISTORY, | ||
maxLimit: 10000, | ||
dateFieldName: 'mtsUpdate', | ||
symbolFieldName: 'symbol', | ||
sort: [['mtsUpdate', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: false, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.FUNDING_LOAN_HISTORY) | ||
} |
20 changes: 20 additions & 0 deletions
20
workers/loc.api/sync/schema/sync-schema/funding-offer-history.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.FUNDING_OFFER_HISTORY, | ||
maxLimit: 10000, | ||
dateFieldName: 'mtsUpdate', | ||
symbolFieldName: 'symbol', | ||
sort: [['mtsUpdate', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: false, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.FUNDING_OFFER_HISTORY) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.FUNDING_TRADES, | ||
maxLimit: 1000, | ||
dateFieldName: 'mtsCreate', | ||
symbolFieldName: 'symbol', | ||
sort: [['mtsCreate', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: false, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.FUNDING_TRADES) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.FUTURES, | ||
maxLimit: 10000, | ||
projection: 'pairs', | ||
sort: [['pairs', 1]], | ||
hasNewData: false, | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.PUBLIC_UPDATABLE_ARRAY, | ||
model: getModelOf(TABLES_NAMES.FUTURES) | ||
} |
18 changes: 18 additions & 0 deletions
18
workers/loc.api/sync/schema/sync-schema/inactive-currencies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.INACTIVE_CURRENCIES, | ||
maxLimit: 10000, | ||
projection: 'pairs', | ||
sort: [['pairs', 1]], | ||
hasNewData: false, | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.PUBLIC_UPDATABLE_ARRAY, | ||
model: getModelOf(TABLES_NAMES.INACTIVE_CURRENCIES) | ||
} |
18 changes: 18 additions & 0 deletions
18
workers/loc.api/sync/schema/sync-schema/inactive-symbols.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.INACTIVE_SYMBOLS, | ||
maxLimit: 10000, | ||
projection: 'pairs', | ||
sort: [['pairs', 1]], | ||
hasNewData: false, | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.PUBLIC_UPDATABLE_ARRAY, | ||
model: getModelOf(TABLES_NAMES.INACTIVE_SYMBOLS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict' | ||
|
||
const SYNC_API_METHODS = require('../sync.api.methods') | ||
|
||
const ledgers = require('./ledgers') | ||
const trades = require('./trades') | ||
const fundingTrades = require('./funding-trades') | ||
const publicTrades = require('./public-trades') | ||
const statusMessages = require('./status-messages') | ||
const orders = require('./orders') | ||
const movements = require('./movements') | ||
const fundingOfferHistory = require('./funding-offer-history') | ||
const fundingLoanHistory = require('./funding-loan-history') | ||
const fundingCreditHistory = require('./funding-credit-history') | ||
const positionsHistory = require('./positions-history') | ||
const positionsSnapshot = require('./positions-snapshot') | ||
const logins = require('./logins') | ||
const changeLogs = require('./change-logs') | ||
const payInvoiceList = require('./pay-invoice-list') | ||
const tickersHistory = require('./tickers-history') | ||
const wallets = require('./wallets') | ||
const symbols = require('./symbols') | ||
const mapSymbols = require('./map-symbols') | ||
const inactiveCurrencies = require('./inactive-currencies') | ||
const inactiveSymbols = require('./inactive-symbols') | ||
const futures = require('./futures') | ||
const currencies = require('./currencies') | ||
const marginCurrencyList = require('./margin-currency-list') | ||
const candles = require('./candles') | ||
|
||
const _methodCollMap = new Map([ | ||
[SYNC_API_METHODS.LEDGERS, ledgers], | ||
[SYNC_API_METHODS.TRADES, trades], | ||
[SYNC_API_METHODS.FUNDING_TRADES, fundingTrades], | ||
[SYNC_API_METHODS.PUBLIC_TRADES, publicTrades], | ||
[SYNC_API_METHODS.STATUS_MESSAGES, statusMessages], | ||
[SYNC_API_METHODS.ORDERS, orders], | ||
[SYNC_API_METHODS.MOVEMENTS, movements], | ||
[SYNC_API_METHODS.FUNDING_OFFER_HISTORY, fundingOfferHistory], | ||
[SYNC_API_METHODS.FUNDING_LOAN_HISTORY, fundingLoanHistory], | ||
[SYNC_API_METHODS.FUNDING_CREDIT_HISTORY, fundingCreditHistory], | ||
[SYNC_API_METHODS.POSITIONS_HISTORY, positionsHistory], | ||
[SYNC_API_METHODS.POSITIONS_SNAPSHOT, positionsSnapshot], | ||
[SYNC_API_METHODS.LOGINS, logins], | ||
[SYNC_API_METHODS.CHANGE_LOGS, changeLogs], | ||
[SYNC_API_METHODS.PAY_INVOICE_LIST, payInvoiceList], | ||
[SYNC_API_METHODS.TICKERS_HISTORY, tickersHistory], | ||
[SYNC_API_METHODS.WALLETS, wallets], | ||
[SYNC_API_METHODS.SYMBOLS, symbols], | ||
[SYNC_API_METHODS.MAP_SYMBOLS, mapSymbols], | ||
[SYNC_API_METHODS.INACTIVE_CURRENCIES, inactiveCurrencies], | ||
[SYNC_API_METHODS.INACTIVE_SYMBOLS, inactiveSymbols], | ||
[SYNC_API_METHODS.FUTURES, futures], | ||
[SYNC_API_METHODS.CURRENCIES, currencies], | ||
[SYNC_API_METHODS.MARGIN_CURRENCY_LIST, marginCurrencyList], | ||
[SYNC_API_METHODS.CANDLES, candles] | ||
]) | ||
|
||
const { cloneSchema } = require('../helpers') | ||
|
||
const getMethodCollMap = (methodCollMap = _methodCollMap) => { | ||
return cloneSchema(methodCollMap) | ||
} | ||
|
||
module.exports = { | ||
getMethodCollMap | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.LEDGERS, | ||
maxLimit: 2500, | ||
dateFieldName: 'mts', | ||
symbolFieldName: 'currency', | ||
sort: [['mts', -1], ['id', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.LEDGERS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.LOGINS, | ||
maxLimit: 10000, | ||
dateFieldName: 'time', | ||
symbolFieldName: null, | ||
sort: [['time', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.LOGINS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.MAP_SYMBOLS, | ||
maxLimit: 10000, | ||
projection: ['key', 'value'], | ||
sort: [['key', 1]], | ||
hasNewData: false, | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.PUBLIC_UPDATABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.MAP_SYMBOLS) | ||
} |
18 changes: 18 additions & 0 deletions
18
workers/loc.api/sync/schema/sync-schema/margin-currency-list.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.MARGIN_CURRENCY_LIST, | ||
maxLimit: 10000, | ||
projection: 'symbol', | ||
sort: [['symbol', 1]], | ||
hasNewData: false, | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.PUBLIC_UPDATABLE_ARRAY, | ||
model: getModelOf(TABLES_NAMES.MARGIN_CURRENCY_LIST) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.MOVEMENTS, | ||
maxLimit: 250, | ||
dateFieldName: 'mtsUpdated', | ||
symbolFieldName: 'currency', | ||
sort: [['mtsUpdated', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: true, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.MOVEMENTS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const TABLES_NAMES = require('../tables-names') | ||
const ALLOWED_COLLS = require('../allowed.colls') | ||
const COLLS_TYPES = require('../colls.types') | ||
|
||
const { getModelOf } = require('../models') | ||
|
||
module.exports = { | ||
name: ALLOWED_COLLS.ORDERS, | ||
maxLimit: 2500, | ||
dateFieldName: 'mtsUpdate', | ||
symbolFieldName: 'symbol', | ||
sort: [['mtsUpdate', -1]], | ||
hasNewData: false, | ||
start: [], | ||
isSyncRequiredAtLeastOnce: false, | ||
type: COLLS_TYPES.INSERTABLE_ARRAY_OBJECTS, | ||
model: getModelOf(TABLES_NAMES.ORDERS) | ||
} |
Oops, something went wrong.