mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 20:03:00 +08:00
21 lines
555 B
JavaScript
21 lines
555 B
JavaScript
const { get } = require('lodash');
|
|
|
|
module.exports = {
|
|
RootMutation: {
|
|
requestDownloadLink: async (_, args, { mutators: { User } }) => {
|
|
await User.requestDownloadLink();
|
|
},
|
|
},
|
|
User: {
|
|
lastAccountDownload: (user, args, { user: currentUser }) => {
|
|
// If the current user is not the requesting user, and the user is not
|
|
// an admin, return nothing.
|
|
if (user.id !== currentUser.id && user.role !== 'ADMIN') {
|
|
return null;
|
|
}
|
|
|
|
return get(user, 'metadata.lastAccountDownload', null);
|
|
},
|
|
},
|
|
};
|