wip
This commit is contained in:
parent
1dab37bdae
commit
9a282e37be
23 changed files with 920 additions and 973 deletions
|
|
@ -1,3 +1,29 @@
|
|||
import * as mongo from 'mongodb';
|
||||
import deepcopy = require('deepcopy');
|
||||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.get('signin') as any; // fuck type definition
|
||||
const Signin = db.get<ISignin>('signin');
|
||||
export default Signin;
|
||||
|
||||
export interface ISignin {
|
||||
_id: mongo.ObjectID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack a signin record for API response
|
||||
*
|
||||
* @param {any} record
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
export const pack = (
|
||||
record: any
|
||||
) => new Promise<any>(async (resolve, reject) => {
|
||||
|
||||
const _record = deepcopy(record);
|
||||
|
||||
// Rename _id to id
|
||||
_record.id = _record._id;
|
||||
delete _record._id;
|
||||
|
||||
resolve(_record);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue