-
Notifications
You must be signed in to change notification settings - Fork 12
/
console.ts
24 lines (19 loc) · 927 Bytes
/
console.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as repl from 'repl';
import * as mysql from 'mysql';
import * as queryHelpers from './query_helpers';
import * as renderHelpers from './render_helpers';
import * as viewHelpers from './view_helpers';
import config from './config/config';
import {BaseModel} from './models/base';
import {User} from './models/user';
import {Signatory} from './models/signatory';
(async () => {
const pool = mysql.createPool(config.database.connectionObject());
BaseModel.pool = pool;
await queryHelpers.queries(pool, [[], []], "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION,ALLOW_INVALID_DATES';", "SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION,ALLOW_INVALID_DATES';");
const re = repl.start('openletter> ');
const context = {};
Object.assign(context, queryHelpers, renderHelpers, viewHelpers, config);
Object.assign(context, {BaseModel, User, Signatory});
Object.assign(re.context, context);
})();