Merge branch 'emergency-fix/back_types_routers_users' into 'development'

Emergency fix/back types routers users

See merge request !21
parents 91e2ce16 a6b7e8fc
...@@ -2,18 +2,22 @@ import express,{Router, Request, Response} from 'express'; ...@@ -2,18 +2,22 @@ import express,{Router, Request, Response} from 'express';
import {User} from '../models/User'; import {User} from '../models/User';
import {myDataSource} from '../app-data-source'; import {myDataSource} from '../app-data-source';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import multer = require('multer'); import multer from 'multer';
import path = require("path"); import path from 'path';
import {config} from "../config" import {config} from "../config"
const router:Router = express.Router(); const router:Router = express.Router();
const dataSource = myDataSource; const dataSource = myDataSource;
type DestinationCallback = (error: Error | null, destination: string) => void
type FileNameCallback = (error: Error | null, filename: string) => void
const storage = multer.diskStorage({ const storage = multer.diskStorage({
destination: (req, file, cb) => { destination: (req:Request, file: Express.Multer.File, cb:DestinationCallback) => {
cb(null, config.uploadPath); cb(null, config.uploadPath);
}, },
filename: (req, file, cb) => { filename: (req:Request, file: Express.Multer.File, cb:FileNameCallback) => {
cb(null, nanoid() + path.extname(file.originalname)); cb(null, nanoid() + path.extname(file.originalname));
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment