This commit is contained in:
syuilo
2018-07-06 02:58:29 +09:00
parent fcfd9239c1
commit 9b41023c43
109 changed files with 212 additions and 130 deletions

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import * as speakeasy from 'speakeasy';
import User, { ILocalUser } from '../../../../../models/user';
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'token' parameter
const [token, tokenErr] = $.str.get(params.token);
if (tokenErr) return rej('invalid token param');

View File

@ -5,7 +5,7 @@ import * as QRCode from 'qrcode';
import User, { ILocalUser } from '../../../../../models/user';
import config from '../../../../../config';
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'password' parameter
const [password, passwordErr] = $.str.get(params.password);
if (passwordErr) return rej('invalid password param');

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import * as bcrypt from 'bcryptjs';
import User, { ILocalUser } from '../../../../../models/user';
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'password' parameter
const [password, passwordErr] = $.str.get(params.password);
if (passwordErr) return rej('invalid password param');

View File

@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get authorized apps of my account
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');

View File

@ -5,7 +5,7 @@ import User, { ILocalUser } from '../../../../models/user';
/**
* Change password
*/
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'currentPasword' parameter
const [currentPassword, currentPasswordErr] = $.str.get(params.currentPasword);
if (currentPasswordErr) return rej('invalid currentPasword param');

View File

@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get favorited notes
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');

View File

@ -9,7 +9,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get notifications
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'following' parameter
const [following = false, followingError] =
$.bool.optional.get(params.following);

View File

@ -6,7 +6,7 @@ import { pack } from '../../../../models/user';
/**
* Pin note
*/
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@ -7,7 +7,7 @@ import generateUserToken from '../../common/generate-native-user-token';
/**
* Regenerate native token
*/
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'password' parameter
const [password, passwordErr] = $.str.get(params.password);
if (passwordErr) return rej('invalid password param');

View File

@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get signin history of my account
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');

View File

@ -8,7 +8,7 @@ import { IApp } from '../../../../models/app';
/**
* Update myself
*/
module.exports = async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
const isSecure = user != null && app == null;
const updates = {} as any;

View File

@ -5,7 +5,7 @@ import event from '../../../../publishers/stream';
/**
* Update myself
*/
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name, nameErr] = $.str.get(params.name);
if (nameErr) return rej('invalid name param');

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'home' parameter
const [home, homeErr] = $.arr(
$.obj.strict()

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'home' parameter
const [home, homeErr] = $.arr(
$.obj.strict()

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'id' parameter
const [id, idErr] = $.str.get(params.id);
if (idErr) return rej('invalid id param');