Refactoring
This commit is contained in:
parent
1323a08a5f
commit
a12cc1a1b0
2 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import User from '../models/user';
|
import { default as User, IUser } from '../models/user';
|
||||||
import Signin from '../models/signin';
|
import Signin from '../models/signin';
|
||||||
import serialize from '../serializers/signin';
|
import serialize from '../serializers/signin';
|
||||||
import event from '../event';
|
import event from '../event';
|
||||||
|
@ -23,7 +23,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch user
|
// Fetch user
|
||||||
const user = await User.findOne({
|
const user: IUser = await User.findOne({
|
||||||
username_lower: username.toLowerCase()
|
username_lower: username.toLowerCase()
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import recaptcha = require('recaptcha-promise');
|
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 { validateUsername, validatePassword } from '../models/user';
|
||||||
import serialize from '../serializers/user';
|
import serialize from '../serializers/user';
|
||||||
import generateUserToken from '../common/generate-native-user-token';
|
import generateUserToken from '../common/generate-native-user-token';
|
||||||
|
@ -61,7 +61,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
const secret = generateUserToken();
|
const secret = generateUserToken();
|
||||||
|
|
||||||
// Create account
|
// Create account
|
||||||
const account = await User.insert({
|
const account: IUser = await User.insert({
|
||||||
token: secret,
|
token: secret,
|
||||||
avatar_id: null,
|
avatar_id: null,
|
||||||
banner_id: null,
|
banner_id: null,
|
||||||
|
|
Loading…
Reference in a new issue