Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
save-exact=true
foreground-scripts=true
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-reports-framework",
"version": "4.22.5",
"version": "4.23.0",
"description": "Bitfinex reports framework",
"main": "worker.js",
"license": "Apache-2.0",
Expand Down
74 changes: 0 additions & 74 deletions test/test-cases/api-sync-mode-sqlite-test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -1452,52 +1452,6 @@ module.exports = (
])
})

it('it should be successfully performed by the getPayInvoiceList method', async function () {
this.timeout(5000)

const res = await agent
.post(`${basePath}/json-rpc`)
.type('json')
.send({
auth,
method: 'getPayInvoiceList',
params: {
start: 0,
end,
limit: 2
},
id: 5
})
.expect('Content-Type', /json/)
.expect(200)

assert.isObject(res.body)
assert.propertyVal(res.body, 'id', 5)
assert.isObject(res.body.result)
assert.isArray(res.body.result.res)
assert.isNumber(res.body.result.nextPage)

const resItem = res.body.result.res[0]

assert.isObject(resItem)
assert.containsAllKeys(resItem, [
'id',
't',
'duration',
'amount',
'currency',
'orderId',
'payCurrencies',
'webhook',
'redirectUrl',
'status',
'customerInfo',
'invoices',
'payment',
'merchantName'
])
})

it('it should be successfully performed by the getTrades method', async function () {
this.timeout(5000)

Expand Down Expand Up @@ -2767,34 +2721,6 @@ module.exports = (
await testMethodOfGettingReportFile(procPromise, aggrPromise, res)
})

it('it should be successfully performed by the getPayInvoiceListFile method', async function () {
this.timeout(60000)

const procPromise = queueToPromise(params.processorQueue)
const aggrPromise = queueToPromise(params.aggregatorQueue)

const res = await agent
.post(`${basePath}/json-rpc`)
.type('json')
.send({
auth,
method: 'getPayInvoiceListFile',
params: {
isPDFRequired,
end,
start,
limit: 100,
timezone: -3,
email
},
id: 5
})
.expect('Content-Type', /json/)
.expect(200)

await testMethodOfGettingReportFile(procPromise, aggrPromise, res)
})

it('it should be successfully performed by the getTradesFile method', async function () {
this.timeout(60000)

Expand Down
1 change: 0 additions & 1 deletion workers/loc.api/bfx.api.router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class BfxApiRouter extends BaseBfxApiRouter {
['positionsAudit', 90],
['wallets', 90],
['ledgers', 90],
['payInvoiceList', 90],
['accountTrades', 90],
['fundingTrades', 90],
['trades', 10],
Expand Down
22 changes: 0 additions & 22 deletions workers/loc.api/service.report.framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,28 +718,6 @@ class FrameworkReportService extends ReportService {
}, 'getLedgers', args, cb)
}

/**
* @override
*/
getPayInvoiceList (space, args, cb) {
return this._privResponder(async () => {
if (!await this.isSyncModeWithDbData(space, args)) {
return this._subAccountApiData
.getDataForSubAccount(
(args) => super.getPayInvoiceList(space, args),
args,
{ datePropName: 't' }
)
}

return this._dao.findInCollBy(
this._SYNC_API_METHODS.PAY_INVOICE_LIST,
args,
{ isPrepareResponse: true, shouldParamsBeVerified: true }
)
}, 'getPayInvoiceList', args, cb)
}

/**
* @override
*/
Expand Down
4 changes: 0 additions & 4 deletions workers/loc.api/service.report.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ class ReportService extends BaseReportService {
return super.getLedgers(null, args)
}

[SYNC_API_METHODS.PAY_INVOICE_LIST] (args) {
return super.getPayInvoiceList(null, args)
}

[SYNC_API_METHODS.TRADES] (args) {
return super.getTrades(null, args)
}
Expand Down
8 changes: 2 additions & 6 deletions workers/loc.api/sync/dao/dao.better.sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ const setImmediatePromise = promisify(setImmediate)
const MAIN_DB_WORKER_ACTIONS = require(
'bfx-facs-db-better-sqlite/worker/db-worker-actions/db-worker-actions.const'
)
const {
normalizeFilterParams
} = require('bfx-report/workers/loc.api/helpers')
const {
getValidationSchemaId,
getFilterValidationSchemaId
Expand Down Expand Up @@ -913,7 +910,7 @@ class BetterSqliteDAO extends DAO {
*/
async findInCollBy (
method,
reqArgs,
args,
opts
) {
const {
Expand All @@ -932,13 +929,12 @@ class BetterSqliteDAO extends DAO {
: this._getMethodCollMap().get(method)

const apiMethodName = filterModelNameMap.get(method) ?? {}
const args = normalizeFilterParams(apiMethodName, reqArgs)

if (shouldParamsBeVerified) {
const schemaId = getValidationSchemaId(apiMethodName)
const filterSchemaId = getFilterValidationSchemaId(apiMethodName)

await this.dataValidator.validate(reqArgs, schemaId)
await this.dataValidator.validate(args, schemaId)
await this.dataValidator.validate(
{ params: args?.params?.filter },
filterSchemaId
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
'use strict'

/*
* CREATED_AT: 2025-09-19T07:32:50.867Z
* VERSION: v43
*/

const AbstractMigration = require('./abstract.migration')

class MigrationV43 extends AbstractMigration {
/**
* @override
*/
up () {
const sqlArr = [
'DROP TABLE payInvoiceList'
]

this.addSql(sqlArr)
}

/**
* @override
*/
down () {
const sqlArr = [
`CREATE TABLE payInvoiceList (
_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
id VARCHAR(255),
t BIGINT,
duration INT,
amount DECIMAL(22,12),
currency VARCHAR(255),
orderId VARCHAR(255),
payCurrencies TEXT,
webhook VARCHAR(255),
redirectUrl VARCHAR(255),
status VARCHAR(255),
customerInfo TEXT,
invoices TEXT,
payment TEXT,
merchantName VARCHAR(255),
subUserId INT,
user_id INT NOT NULL,
CONSTRAINT payInvoiceList_fk_user_id
FOREIGN KEY (user_id)
REFERENCES users(_id)
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT payInvoiceList_fk_subUserId
FOREIGN KEY (subUserId)
REFERENCES users(_id)
ON UPDATE CASCADE
ON DELETE CASCADE
)`,

`CREATE UNIQUE INDEX payInvoiceList_id_user_id
ON payInvoiceList(id, user_id)`,
`CREATE INDEX payInvoiceList_user_id_currency_t
ON payInvoiceList(user_id, currency, t)`,
`CREATE INDEX payInvoiceList_user_id_id_t
ON payInvoiceList(user_id, id, t)`,
`CREATE INDEX payInvoiceList_user_id_t
ON payInvoiceList(user_id, t)`,
`CREATE INDEX payInvoiceList_user_id_subUserId_t
ON payInvoiceList(user_id, subUserId, t)
WHERE subUserId IS NOT NULL`,
`CREATE INDEX payInvoiceList_subUserId_id
ON payInvoiceList(subUserId, id)
WHERE subUserId IS NOT NULL`
]

this.addSql(sqlArr)
}

/**
* @override
*/
before () { return this.dao.disableForeignKeys() }

/**
* @override
*/
after () { return this.dao.enableForeignKeys() }
}

module.exports = MigrationV43
3 changes: 1 addition & 2 deletions workers/loc.api/sync/schema/allowed.colls.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ module.exports = {
CANDLES: TABLES_NAMES.CANDLES,
STATUS_MESSAGES: TABLES_NAMES.STATUS_MESSAGES,
LOGINS: TABLES_NAMES.LOGINS,
CHANGE_LOGS: TABLES_NAMES.CHANGE_LOGS,
PAY_INVOICE_LIST: TABLES_NAMES.PAY_INVOICE_LIST
CHANGE_LOGS: TABLES_NAMES.CHANGE_LOGS
}
4 changes: 1 addition & 3 deletions workers/loc.api/sync/schema/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 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 = 42
const SUPPORTED_DB_VERSION = 43

const TABLES_NAMES = require('../tables-names')

Expand All @@ -26,7 +26,6 @@ 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 statusMessages = require('./status-messages')
const publicCollsConf = require('./public-colls-conf')
Expand Down Expand Up @@ -60,7 +59,6 @@ const models = new Map([
[TABLES_NAMES.POSITIONS_SNAPSHOT, positionsSnapshot],
[TABLES_NAMES.LOGINS, logins],
[TABLES_NAMES.CHANGE_LOGS, changeLogs],
[TABLES_NAMES.PAY_INVOICE_LIST, payInvoiceList],
[TABLES_NAMES.TICKERS_HISTORY, tickersHistory],
[TABLES_NAMES.STATUS_MESSAGES, statusMessages],
[TABLES_NAMES.PUBLIC_COLLS_CONF, publicCollsConf],
Expand Down
Loading
Loading