1
0
mirror of https://github.com/hotomoe/hotomoe synced 2025-01-04 17:02:57 +09:00
hotomoe/src/server/api/endpoints/i.ts
2018-06-18 09:54:53 +09:00

23 lines
475 B
TypeScript

import User, { pack, ILocalUser } from '../../../models/user';
import { IApp } from '../../../models/app';
/**
* Show myself
*/
module.exports = (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
const isSecure = user != null && app == null;
// Serialize
res(await pack(user, user, {
detail: true,
includeSecrets: isSecure
}));
// Update lastUsedAt
User.update({ _id: user._id }, {
$set: {
lastUsedAt: new Date()
}
});
});