1
0
mirror of https://github.com/microsoft/TypeScript-Node-Starter.git synced 2025-11-08 23:07:20 +00:00

fit error TS2559: Type '4' has no properties in common with type 'MinMaxOptions'.

fix err TypeScript-Node-Starter/src/controllers/api.ts[6, 9]: missing whitespace, 8 files
fix bugs of issue 15
This commit is contained in:
xiangxiang
2017-07-19 17:14:28 +08:00
parent 462a9a97f3
commit 9ed0760ae9
7 changed files with 15 additions and 15 deletions

View File

@@ -6,7 +6,7 @@ import * as _ from "lodash";
// import { User, UserType } from '../models/User';
import { default as User } from "../models/User";
import {Request, Response, NextFunction} from "express";
import { Request, Response, NextFunction } from "express";
const LocalStrategy = passportLocal.Strategy;
const FacebookStrategy = passportFacebook.Strategy;

View File

@@ -3,7 +3,7 @@
import * as async from "async";
import * as request from "request";
import * as graph from "fbgraph";
import {Response, Request, NextFunction} from "express";
import { Response, Request, NextFunction } from "express";
/**

View File

@@ -1,5 +1,5 @@
import * as nodemailer from "nodemailer";
import {Request, Response} from "express";
import { Request, Response } from "express";
const transporter = nodemailer.createTransport({
service: "SendGrid",

View File

@@ -1,4 +1,4 @@
import {Request, Response} from "express";
import { Request, Response } from "express";
/**
* GET /

View File

@@ -2,9 +2,9 @@ import * as async from "async";
import * as crypto from "crypto";
import * as nodemailer from "nodemailer";
import * as passport from "passport";
import {default as User, UserModel, AuthToken} from "../models/User";
import {Request, Response, NextFunction} from "express";
import {LocalStrategyInfo} from "passport-local";
import { default as User, UserModel, AuthToken } from "../models/User";
import { Request, Response, NextFunction } from "express";
import { LocalStrategyInfo } from "passport-local";
import { WriteError } from "mongodb";
const request = require("express-validator");
@@ -80,7 +80,7 @@ export let getSignup = (req: Request, res: Response) => {
*/
export let postSignup = (req: Request, res: Response, next: NextFunction) => {
req.assert("email", "Email is not valid").isEmail();
req.assert("password", "Password must be at least 4 characters long").len(4);
req.assert("password", "Password must be at least 4 characters long").len({ min: 4 });
req.assert("confirmPassword", "Passwords do not match").equals(req.body.password);
req.sanitize("email").normalizeEmail({ gmail_remove_dots: false });
@@ -165,7 +165,7 @@ export let postUpdateProfile = (req: Request, res: Response, next: NextFunction)
* Update current password.
*/
export let postUpdatePassword = (req: Request, res: Response, next: NextFunction) => {
req.assert("password", "Password must be at least 4 characters long").len(4);
req.assert("password", "Password must be at least 4 characters long").len({ min: 4 });
req.assert("confirmPassword", "Passwords do not match").equals(req.body.password);
const errors = req.validationErrors();
@@ -245,7 +245,7 @@ export let getReset = (req: Request, res: Response, next: NextFunction) => {
* Process the reset password request.
*/
export let postReset = (req: Request, res: Response, next: NextFunction) => {
req.assert("password", "Password must be at least 4 characters long.").len(4);
req.assert("password", "Password must be at least 4 characters long.").len({ min: 4 });
req.assert("confirm", "Passwords must match.").equals(req.body.password);
const errors = req.validationErrors();

View File

@@ -64,8 +64,8 @@ userSchema.pre("save", function save(next) {
});
});
userSchema.methods.comparePassword = function(candidatePassword: string, cb: (err: any, isMatch: any) => {}) {
bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error , isMatch: boolean) => {
userSchema.methods.comparePassword = function (candidatePassword: string, cb: (err: any, isMatch: any) => {}) {
bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error, isMatch: boolean) => {
cb(err, isMatch);
});
};
@@ -74,7 +74,7 @@ userSchema.methods.comparePassword = function(candidatePassword: string, cb: (er
/**
* Helper method for getting user's gravatar.
*/
userSchema.methods.gravatar = function(size: number) {
userSchema.methods.gravatar = function (size: number) {
if (!size) {
size = 200;
}