diff options
| author | Adam Soltys <[email protected]> | 2022-09-02 14:47:08 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-02 14:47:14 -0700 |
| commit | 3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 (patch) | |
| tree | 16cd6c55d5dc481331b1e8b640d179f193e7ea13 /lib/utils.js | |
| parent | 7a8d64833de8873afb92982b3f5bfff59b30c542 (diff) | |
| download | coinos-server-3161dd7ee95b6c7d70f8341298dd4fab84cda8b0.tar.gz coinos-server-3161dd7ee95b6c7d70f8341298dd4fab84cda8b0.zip | |
es6 migration
Diffstat (limited to 'lib/utils.js')
| -rw-r--r-- | lib/utils.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/utils.js b/lib/utils.js index 1de8ffeb..af50d7ec 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,7 +1,7 @@ -import sequelize from 'sequelize'; +import sequelize from '@sequelize/core'; const { Op } = sequelize; -getUser = async (username, transaction) => { +export const getUser = async (username, transaction) => { let params = { include: [ { @@ -25,7 +25,7 @@ getUser = async (username, transaction) => { return user; }; -getUserById = async (id, transaction) => { +export const getUserById = async (id, transaction) => { let params = { include: [ { @@ -46,3 +46,11 @@ getUserById = async (id, transaction) => { return user; }; + +export const prod = process.env.NODE_ENV === "production"; +export const fail = msg => { + throw new Error(msg); +}; + +export const SATS = 100000000; +export const toSats = n => Math.round(n * SATS); |
