mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-19 08:27:35 -07:00
33 lines
596 B
TypeScript
33 lines
596 B
TypeScript
import $ from 'cafy';
|
|
import User from '../../../../models/user';
|
|
import { publishMainStream } from '../../../../stream';
|
|
import define from '../../define';
|
|
|
|
export const meta = {
|
|
requireCredential: true,
|
|
|
|
secure: true,
|
|
|
|
params: {
|
|
home: {
|
|
validator: $.arr($.obj({
|
|
name: $.str,
|
|
id: $.str,
|
|
place: $.str,
|
|
data: $.obj()
|
|
}).strict())
|
|
}
|
|
}
|
|
};
|
|
|
|
export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
|
await User.update(user._id, {
|
|
$set: {
|
|
'clientSettings.home': ps.home
|
|
}
|
|
});
|
|
|
|
res();
|
|
|
|
publishMainStream(user._id, 'homeUpdated', ps.home);
|
|
}));
|