From a12cc1a1b067745695bd6f55defe5eb2d7400da0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Sep 2017 17:31:37 +0900 Subject: [PATCH] Refactoring --- src/api/private/signin.ts | 4 ++-- src/api/private/signup.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/private/signin.ts b/src/api/private/signin.ts index afa83e50c3..c7dc243980 100644 --- a/src/api/private/signin.ts +++ b/src/api/private/signin.ts @@ -1,6 +1,6 @@ import * as express from 'express'; import * as bcrypt from 'bcryptjs'; -import User from '../models/user'; +import { default as User, IUser } from '../models/user'; import Signin from '../models/signin'; import serialize from '../serializers/signin'; import event from '../event'; @@ -23,7 +23,7 @@ export default async (req: express.Request, res: express.Response) => { } // Fetch user - const user = await User.findOne({ + const user: IUser = await User.findOne({ username_lower: username.toLowerCase() }, { fields: { diff --git a/src/api/private/signup.ts b/src/api/private/signup.ts index 899fa88472..bcc17a876d 100644 --- a/src/api/private/signup.ts +++ b/src/api/private/signup.ts @@ -1,7 +1,7 @@ import * as express from 'express'; import * as bcrypt from 'bcryptjs'; import recaptcha = require('recaptcha-promise'); -import User from '../models/user'; +import { default as User, IUser } from '../models/user'; import { validateUsername, validatePassword } from '../models/user'; import serialize from '../serializers/user'; import generateUserToken from '../common/generate-native-user-token'; @@ -61,7 +61,7 @@ export default async (req: express.Request, res: express.Response) => { const secret = generateUserToken(); // Create account - const account = await User.insert({ + const account: IUser = await User.insert({ token: secret, avatar_id: null, banner_id: null,