mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 14:13:38 +08:00
26 lines
549 B
JavaScript
26 lines
549 B
JavaScript
const errors = require('../../errors');
|
|
|
|
const {
|
|
UPDATE_SETTINGS,
|
|
} = require('../../perms/constants');
|
|
|
|
const SettingsService = require('../../services/settings');
|
|
|
|
const update = async (ctx, settings) => SettingsService.update(settings);
|
|
|
|
module.exports = (ctx) => {
|
|
let mutators = {
|
|
Settings: {
|
|
update: () => Promise.reject(errors.ErrNotAuthorized),
|
|
}
|
|
};
|
|
|
|
if (ctx.user) {
|
|
if (ctx.user.can(UPDATE_SETTINGS)) {
|
|
mutators.Settings.update = (id, settings) => update(ctx, id, settings);
|
|
}
|
|
}
|
|
|
|
return mutators;
|
|
};
|