wip
This commit is contained in:
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user