Refactorng
This commit is contained in:
parent
865fd25af1
commit
aa4ef6745a
132 changed files with 180 additions and 212 deletions
|
|
@ -1,15 +1,14 @@
|
|||
import $ from 'cafy';
|
||||
import User, { ILocalUser } from '../../../../models/user';
|
||||
import event from '../../../../publishers/stream';
|
||||
import event from '../../../../stream';
|
||||
|
||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||
// Get 'home' parameter
|
||||
const [home, homeErr] = $.arr(
|
||||
$.obj.strict()
|
||||
.have('name', $.str)
|
||||
.have('id', $.str)
|
||||
.have('data', $.obj))
|
||||
.get(params.home);
|
||||
const [home, homeErr] = $.arr($.obj({
|
||||
name: $.str,
|
||||
id: $.str,
|
||||
data: $.obj()
|
||||
}).strict()).get(params.home);
|
||||
if (homeErr) return rej('invalid home param');
|
||||
|
||||
await User.update(user._id, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue