yumechi-no-kuni/src/server/api/models/signin.ts

30 lines
547 B
TypeScript
Raw Normal View History

2018-02-01 17:06:01 -06:00
import * as mongo from 'mongodb';
import deepcopy = require('deepcopy');
2018-03-28 11:20:40 -05:00
import db from '../../../db/mongodb';
2017-01-16 18:12:33 -06:00
2018-02-01 17:06:01 -06:00
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);
});