-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathindex.js
More file actions
92 lines (85 loc) · 3.36 KB
/
Copy pathindex.js
File metadata and controls
92 lines (85 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
'use strict'
/*
* The version must be increased when DB schema is changed
*
* For each new DB version need to implement new migration
* in the `workers/loc.api/sync/dao/db-migrations/sqlite-migrations` folder,
* e.g. `migration.v1.js`, where `v1` is `SUPPORTED_DB_VERSION`
*/
const SUPPORTED_DB_VERSION = 43
const TABLES_NAMES = require('../tables-names')
const users = require('./users')
const subAccounts = require('./sub-accounts')
const ledgers = require('./ledgers')
const trades = require('./trades')
const fundingTrades = require('./funding-trades')
const publicTrades = require('./public-trades')
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 tickersHistory = require('./tickers-history')
const statusMessages = require('./status-messages')
const publicCollsConf = require('./public-colls-conf')
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 scheduler = require('./scheduler')
const syncMode = require('./sync-mode')
const progress = require('./progress')
const syncQueue = require('./sync-queue')
const syncUserSteps = require('./sync-user-steps')
const models = new Map([
[TABLES_NAMES.USERS, users],
[TABLES_NAMES.SUB_ACCOUNTS, subAccounts],
[TABLES_NAMES.LEDGERS, ledgers],
[TABLES_NAMES.TRADES, trades],
[TABLES_NAMES.FUNDING_TRADES, fundingTrades],
[TABLES_NAMES.PUBLIC_TRADES, publicTrades],
[TABLES_NAMES.ORDERS, orders],
[TABLES_NAMES.MOVEMENTS, movements],
[TABLES_NAMES.FUNDING_OFFER_HISTORY, fundingOfferHistory],
[TABLES_NAMES.FUNDING_LOAN_HISTORY, fundingLoanHistory],
[TABLES_NAMES.FUNDING_CREDIT_HISTORY, fundingCreditHistory],
[TABLES_NAMES.POSITIONS_HISTORY, positionsHistory],
[TABLES_NAMES.POSITIONS_SNAPSHOT, positionsSnapshot],
[TABLES_NAMES.LOGINS, logins],
[TABLES_NAMES.CHANGE_LOGS, changeLogs],
[TABLES_NAMES.TICKERS_HISTORY, tickersHistory],
[TABLES_NAMES.STATUS_MESSAGES, statusMessages],
[TABLES_NAMES.PUBLIC_COLLS_CONF, publicCollsConf],
[TABLES_NAMES.SYMBOLS, symbols],
[TABLES_NAMES.MAP_SYMBOLS, mapSymbols],
[TABLES_NAMES.INACTIVE_CURRENCIES, inactiveCurrencies],
[TABLES_NAMES.INACTIVE_SYMBOLS, inactiveSymbols],
[TABLES_NAMES.FUTURES, futures],
[TABLES_NAMES.CURRENCIES, currencies],
[TABLES_NAMES.MARGIN_CURRENCY_LIST, marginCurrencyList],
[TABLES_NAMES.CANDLES, candles],
[TABLES_NAMES.SCHEDULER, scheduler],
[TABLES_NAMES.SYNC_MODE, syncMode],
[TABLES_NAMES.PROGRESS, progress],
[TABLES_NAMES.SYNC_QUEUE, syncQueue],
[TABLES_NAMES.SYNC_USER_STEPS, syncUserSteps]
])
const getModelsMap = () => {
return new Map(models)
}
const getModelOf = (tableName) => {
return models.get(tableName)
}
module.exports = {
SUPPORTED_DB_VERSION,
getModelsMap,
getModelOf
}