This file contains hidden or 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
/** @name API.plugin.sortAPI */ | |
module.exports = { | |
/** | |
* @param {object} initialSort - start sort | |
* @param {object} params - client params | |
* */ | |
get: function (initialSort, params) { | |
let sort = {}; | |
if (params.sortKey && params.sortType) | |
sort[params.sortKey] = (params.sortType === 'DESC') ? -1 : 1; |
This file contains hidden or 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
/** @name API.plugin.pageAPI */ | |
module.exports = { | |
/** | |
* @param page - number | |
* @param limit - number | |
* @param config - object | |
* @param config.maxPage - number | |
* @param config.maxLimit - number | |
* @param config.defaultLimit - number | |
* @param config.defaultPage - number |
This file contains hidden or 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
const mongoose = require('mongoose'); | |
module.exports = (API) => { | |
class _ObjectId { | |
constructor(len, options) { | |
this.name = 'ObjectID'; | |
} |
This file contains hidden or 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
const redis = require('../modules/RedisClientAPI').redis; | |
const random = require('../modules/random'); | |
const config = require('../modules/config'); | |
const Promise = require("bluebird"); | |
const {promisify} = require('util'); | |
const redisAsync = { | |
get: promisify(redis.get).bind(redis), | |
del: promisify(redis.del).bind(redis), | |
ttl: promisify(redis.ttl).bind(redis), | |
set: promisify(redis.set).bind(redis), |
This file contains hidden or 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
import Vue from "vue"; | |
import {Bar, Line, mixins} from "vue-chartjs"; | |
Vue.component("chartline", { | |
extends: Line, | |
mixins: [mixins.reactiveProp], | |
props: ["options"], | |
mounted() { | |
const max = Math.max(...this.chartData.datasets[0].data); | |
this.renderChart(this.chartData, { |
This file contains hidden or 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
const bitcoin = require('bitcoinjs-lib'); | |
/** @method address/btc */ | |
API.register('btc', (user, param) => { | |
return new Promise((resolve, reject) => { | |
let keyPair = bitcoin.ECPair.makeRandom({network: config.get('crypto:bitcoin:testnet') ? bitcoin.networks.testnet : bitcoin.networks.bitcoin}); | |
let address = keyPair.getAddress(); | |
let pkey = keyPair.toWIF(); | |
resolve({address, pkey}) |
This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
const pathProject = path.normalize(__dirname + '/..'); | |
const config = require('../modules/config'); | |
function getPathAPI(apiPath) { | |
return apiPath.replace(path.normalize(pathProject + '/api/'), '').replace('.js', '') | |
} | |
function requireAPI(apiPath) { |
This file contains hidden or 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
function genetationJSON(res) { | |
let f = [{ | |
item: { | |
from: "____XML1", | |
to: "____XML2", | |
in: "____rateIn", | |
out: "____rateOut", | |
amount: "____reserve", |