2016-12-28 23:49:51 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module dependencies
|
|
|
|
*/
|
2017-01-02 22:03:19 +01:00
|
|
|
import deepcopy = require('deepcopy');
|
2016-12-28 23:49:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Serialize a signin record
|
|
|
|
*
|
2017-03-01 09:37:01 +01:00
|
|
|
* @param {any} record
|
|
|
|
* @return {Promise<any>}
|
2016-12-28 23:49:51 +01:00
|
|
|
*/
|
|
|
|
export default (
|
|
|
|
record: any
|
2017-03-01 09:37:01 +01:00
|
|
|
) => new Promise<any>(async (resolve, reject) => {
|
2016-12-28 23:49:51 +01:00
|
|
|
|
|
|
|
const _record = deepcopy(record);
|
|
|
|
|
|
|
|
// Rename _id to id
|
|
|
|
_record.id = _record._id;
|
|
|
|
delete _record._id;
|
|
|
|
|
|
|
|
resolve(_record);
|
|
|
|
});
|