This commit is contained in:
syuilo 2017-03-09 03:50:09 +09:00
parent 3d536ddb3f
commit 31f36fa618
64 changed files with 241 additions and 256 deletions

View file

@ -1,7 +1,7 @@
/**
* Module dependencies
*/
import it from 'cafy';
import $ from 'cafy';
import User from '../../models/user';
import { validateUsername } from '../../models/user';
@ -13,7 +13,7 @@ import { validateUsername } from '../../models/user';
*/
module.exports = async (params) => new Promise(async (res, rej) => {
// Get 'username' parameter
const [username, usernameError] = it(params.username).expect.string().required().trim().validate(validateUsername).get();
const [username, usernameError] = $(params.username).string().pipe(validateUsername).$;
if (usernameError) return rej('invalid username param');
// Get exist