mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-18 16:07:31 -07:00
0b12d87896
An account document is attached to a user document if an account of the user is on the server. It may be missing if the user is on a remote server.
28 lines
515 B
TypeScript
28 lines
515 B
TypeScript
/**
|
|
* Module dependencies
|
|
*/
|
|
import User, { pack } from '../models/user';
|
|
|
|
/**
|
|
* Show myself
|
|
*
|
|
* @param {any} params
|
|
* @param {any} user
|
|
* @param {any} app
|
|
* @param {Boolean} isSecure
|
|
* @return {Promise<any>}
|
|
*/
|
|
module.exports = (params, user, _, isSecure) => new Promise(async (res, rej) => {
|
|
// Serialize
|
|
res(await pack(user, user, {
|
|
detail: true,
|
|
includeSecrets: isSecure
|
|
}));
|
|
|
|
// Update lastUsedAt
|
|
User.update({ _id: user._id }, {
|
|
$set: {
|
|
'account.last_used_at': new Date()
|
|
}
|
|
});
|
|
});
|