Compare commits

..

No commits in common. 'c8dc7a9507ff2592cc38bddefe4828c59314a74c' and '7bd4b58a0df174b4a8c26c34b9d388fc8ab3c4fd' have entirely different histories.

  1. 1
      package.json
  2. 1
      public/15/login-password.json
  3. 0
      public/15/name name/file.txt
  4. 0
      public/15/namename/file.txt
  5. BIN
      public/59/Papers-1(2).docx
  6. BIN
      public/60/LouiseHay-YouCanHealYourLife-HayHouse(1984).epub
  7. 45
      public/60/deeplearning_ex2.py
  8. 1
      public/60/login-password.json
  9. BIN
      public/9/c1a875_e21d978198ad4b9c85cf63a8d1b146cc_mv2 (1).jpeg
  10. BIN
      public/9/c1a875_e75b8c21992e4f749fed9f2bfec29872_mv2 (1).png
  11. BIN
      public/9/c1a875_e75b8c21992e4f749fed9f2bfec29872_mv2 (2).png
  12. BIN
      public/9/coinbanner.jpeg
  13. BIN
      public/9/test.docx
  14. BIN
      public/9/test1/test.docx
  15. BIN
      public/download/15/123353222-1684321000419.zip
  16. BIN
      public/download/15/123353222-1690800641686.zip
  17. BIN
      public/download/60/1233532-1691052065162.zip
  18. 46
      src/api/controllers/v1/image.controller.js
  19. 241
      src/api/controllers/v1/path.controller.js
  20. 1
      src/api/controllers/v1/user.controller.js
  21. 6
      src/api/middlewares/image.middleware.js
  22. 6
      src/api/routes/v1/image.route.js
  23. 3
      src/api/routes/v1/path.route.js
  24. 3
      src/common/models/config.model.js
  25. 6
      src/common/models/file.model.js
  26. 1
      src/common/models/image.model.js
  27. 2
      src/common/models/user.model.js
  28. 127
      src/common/services/adapters/upload-adapter.js
  29. 30
      src/config/locales/en.json
  30. 2495
      yarn.lock

@ -45,7 +45,6 @@
"url": "git@gitlab.com:csell-team/b2c/sv-backend-file.git" "url": "git@gitlab.com:csell-team/b2c/sv-backend-file.git"
}, },
"dependencies": { "dependencies": {
"@shopify/cli": "^3.45.4",
"amqplib": "^0.5.2", "amqplib": "^0.5.2",
"archiver": "^5.3.1", "archiver": "^5.3.1",
"auth-adapter": "1.1.0", "auth-adapter": "1.1.0",

@ -1 +0,0 @@
{"status":"error","message":"bad request"}

Binary file not shown.

@ -1,45 +0,0 @@
import torch
torch.manual_seed(2023)
def activation_func(x):
#TODO Implement one of these following activation function: sigmoid, tanh, ReLU, leaky ReLU
epsilon = 0.01 # Only use this variable if you choose Leaky ReLU
result = None
return result
def softmax(x):
# TODO Implement softmax function here
result = None
return result
# Define the size of each layer in the network
num_input = 784 # Number of node in input layer (28x28)
num_hidden_1 = 128 # Number of nodes in hidden layer 1
num_hidden_2 = 256 # Number of nodes in hidden layer 2
num_hidden_3 = 128 # Number of nodes in hidden layer 3
num_classes = 10 # Number of nodes in output layer
# Random input
input_data = torch.randn((1, num_input))
# Weights for inputs to hidden layer 1
W1 = torch.randn(num_input, num_hidden_1)
# Weights for hidden layer 1 to hidden layer 2
W2 = torch.randn(num_hidden_1, num_hidden_2)
# Weights for hidden layer 2 to hidden layer 3
W3 = torch.randn(num_hidden_2, num_hidden_3)
# Weights for hidden layer 3 to output layer
W4 = torch.randn(num_hidden_3, num_classes)
# and bias terms for hidden and output layers
B1 = torch.randn((1, num_hidden_1))
B2 = torch.randn((1, num_hidden_2))
B3 = torch.randn((1, num_hidden_3))
B4 = torch.randn((1, num_classes))
#TODO Calculate forward pass of the network here. Result should have the shape of [1,10]
# Dont forget to check if sum of result = 1.0
result = None
print(result)

@ -1 +0,0 @@
{"status":"error","message":"bad request"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Binary file not shown.

@ -1,17 +1,14 @@
/* eslint-disable camelcase */ /* eslint-disable camelcase */
import { pick } from 'lodash';
import path from 'path'; import path from 'path';
import Busboy from 'busboy'; import Busboy from 'busboy';
import fs from 'fs-extra'; import fs from 'fs-extra';
import multer from 'multer'; import multer from 'multer';
import messages from '../../../config/messages';
import httpStatus from 'http-status'; import httpStatus from 'http-status';
// import moment from 'moment-timezone'; // import moment from 'moment-timezone';
import { handler as ErrorHandel } from '../../middlewares/errors'; import { handler as ErrorHandel } from '../../middlewares/errors';
import ApiException from '../../../common/utils/APIException'; import ApiException from '../../../common/utils/APIException';
// import eventBus from '../../../common/services/event-bus'; // import eventBus from '../../../common/services/event-bus';
import File from "../../../common/models/file.model";
import { handler as ErrorHandler } from '../../middlewares/error';
// import Image from '../../../common/models/image.model'; // import Image from '../../../common/models/image.model';
import { import {
cdn as cdnConfig, cdn as cdnConfig,
@ -37,7 +34,6 @@ exports.uploadSingle = (req, res, next) => {
} }
/** resize image uploaded */ /** resize image uploaded */
// eventBus.emit(Image.Events.IMAGE_CREATED, req.file); // eventBus.emit(Image.Events.IMAGE_CREATED, req.file);
// await File.
return res.json({ url: replaceBaseUrl(req.file.path) }); return res.json({ url: replaceBaseUrl(req.file.path) });
} catch (ex) { } catch (ex) {
return ErrorHandel(ex, req, res, next); return ErrorHandel(ex, req, res, next);
@ -51,44 +47,20 @@ exports.uploadSingle = (req, res, next) => {
*/ */
exports.uploadMultiple = (req, res, next) => { exports.uploadMultiple = (req, res, next) => {
try { try {
// if (!req.files) { if (!req.files) {
// throw new ApiException({ throw new ApiException({
// status: httpStatus.BAD_REQUEST, status: httpStatus.BAD_REQUEST,
// message: 'Invalid file!' message: 'Invalid file!'
// }); });
// } }
const urls = []; const urls = [];
const user = req.locals.user;
let data = {}
// const file = req.files;
for (let index = 0; index < req.files.length; index += 1) { for (let index = 0; index < req.files.length; index += 1) {
urls.push(replaceBaseUrl(req.files[index].path)); urls.push(replaceBaseUrl(req.files[index].path));
data.url = replaceBaseUrl(req.files[index].path);
data.name = req.files[index].originalname;
data.created_by = pick(user, ['id', 'name']);
// File.create()
/** resize image uploaded */ /** resize image uploaded */
// eventBus.emit(Image.Events.IMAGE_CREATED, req.files[index]); // eventBus.emit(Image.Events.IMAGE_CREATED, req.files[index]);
File.create(data)
.then(result => {
res.json({
code: 0,
message: messages.UPLOAD_SUCCESS,
})
}).catch(err => {
ErrorHandler(err, req, res, next);
})
} }
// console.log(urls); return res.json({ urls: urls });
// return res.json({ urls: urls,data : data});
} catch (ex) { } catch (ex) {
console.log("error");
return ErrorHandel(ex, req, res, next); return ErrorHandel(ex, req, res, next);
} }
}; };
@ -126,5 +98,3 @@ exports.uploadFile = (req, res, next) => {
} }
}; };

@ -2,23 +2,18 @@
// import httpStatus from 'http-status'; // import httpStatus from 'http-status';
import fs from 'fs'; import fs from 'fs';
import archiver from 'archiver'; import archiver from 'archiver';
import { exec } from 'child_process';
import multer from 'multer'; import multer from 'multer';
import path from 'path'; import path from 'path';
import { cloneDeep } from 'lodash';
import { handler as ErrorHandel } from '../../middlewares/errors'; import { handler as ErrorHandel } from '../../middlewares/errors';
import File from "../../../common/models/file.model"; // import ApiException from '../../../common/utils/APIException';
import { handler as ErrorHandler } from '../../middlewares/error';
import ApiException from '../../../common/utils/APIException';
import { import {
cdn as cdnConfig, cdn as cdnConfig,
storage as storageConfig storage as storageConfig
} from '../../../config/vars'; } from '../../../config/vars';
import uploadAdapter from '../../../common/services/adapters/upload-adapter'; import uploadAdapter from '../../../common/services/adapters/upload-adapter';
import { cloneDeep, forEach } from 'lodash';
import APIError from '../../middlewares/ApiError';
import { example } from 'joi';
import { where } from 'sequelize';
import messages from '../../../config/messages';
function deleteFolderRecursive(folderPath) { function deleteFolderRecursive(folderPath) {
if (fs.existsSync(folderPath)) { if (fs.existsSync(folderPath)) {
@ -38,78 +33,37 @@ function deleteFolderRecursive(folderPath) {
* *
* @param {Formdata} file * @param {Formdata} file
*/ */
exports.get = (req, res, next) => {
exports.get = async (req, res, next) => {
try { try {
const user = req.user; const user = req.user;
const user_infor = {
id: user.id,
name: user.name
};
console.log(user_infor);
let path = `${storageConfig.uri}/${user.id}`; let path = `${storageConfig.uri}/${user.id}`;
console.log(path);
if (req.body.path) { if (req.body.path) {
path += req.body.path; path += req.body.path;
} }
// console.log(path);
const listFile = []; const listFile = [];
// fs.readdir(path, (err, files) => { fs.readdir(path, (err, files) => {
// if (files && files.length > 0) { if (files && files.length > 0) {
// files.forEach((item) => { files.forEach((item) => {
// listFile.push({ listFile.push({
// name: item, name: item,
// path: `${cdnConfig.uri}/${user.id}/${req.body.path}/${item}`, path: `${cdnConfig.uri}/${user.id}${req.body.path}/${item}`,
// isFolder: fs.lstatSync(`${storageConfig.uri}/${user.id}/${req.body.path}/${item}`).isDirectory(), isFolder: fs.lstatSync(`${storageConfig.uri}/${user.id}/${req.body.path}/${item}`).isDirectory()
// }); });
// }); });
// }
// return res.json({
// code: 0,
// data: listFile
// });
// });
await File.findAll({
where: {
is_active: true,
created_by : user_infor
} }
}).then(result => {
let path = []
result.forEach(data => {
console.log(data.created_by.id);
// console.log(`${storageConfig.uri}/${data.created_by.id}/${req.body.path}/${data.name}`);
const file = {
name: data.name,
path: data.url,
// isFolder: fs.lstatSync(`${storageConfig.uri}/${data.created_by.id}/${req.body.path}/${data.name}`).isDirectory(),
isFolder: fs.lstatSync(`${storageConfig.uri}/${data.created_by.id}/${req.body.path}/${data.name}`).isDirectory(),
download_count : data.download_count
}
path.push(file);
});
return res.json({ return res.json({
code: 0, code: 0,
data : path data: listFile
}) });
}).catch(ex => { });
ErrorHandler(ex, req, res, next);
})
// test local // test local
// fs.readdir(path, (err, files) => { // fs.readdir(path, (err, files) => {
// if (files && files.length > 0) { // if (files && files.length > 0) {
// files.forEach((item) => { // files.forEach((item) => {
// listFile.push({ // listFile.push({
// name: item, // name: item,
// path: `${cdnConfig.uri}/${user.id}${req.body.path}/${item}`,
// path: `${storageConfig.uri}/${user.id}${req.body.path}/${item}`, // path: `${storageConfig.uri}/${user.id}${req.body.path}/${item}`,
// isFolder: fs.lstatSync(`${storageConfig.uri}/${user.id}/${req.body.path}/${item}`).isDirectory() // isFolder: fs.lstatSync(`${storageConfig.uri}/${user.id}/${req.body.path}/${item}`).isDirectory()
// }); // });
@ -198,92 +152,55 @@ exports.delete = (req, res, next) => {
}; };
exports.download = async (req, res, next) => { exports.download = async (req, res, next) => {
try { try {
const user = req.user; const user = req.user;
const namefile = `${user.name}-${Date.now()}.zip`; const namefile = `${user.name.replace(/\s/g, '')}-${Date.now()}.zip`;
const dir = `${storageConfig.uri}/download/${user.id}/${namefile}`; const dir = `${storageConfig.uri}/download/${user.id}/${namefile}`;
const folder = `${storageConfig.uri}/download/${user.id}`; const folder = `${storageConfig.uri}/download/${user.id}`;
multer({ dest: `${folder}` }); multer({ dest: `${folder}` });
await deleteFolderRecursive(folder); await deleteFolderRecursive(folder);
const output = fs.createWriteStream(dir); let command = ` zip -r ${dir} `;
const archive = archiver('zip', {
zlib: { level: 9 } // Sets the compression level.
});
const user_infor = { // const output = fs.createWriteStream(dir);
id: user.id, // const archive = archiver('zip', {
name: user.name // zlib: { level: 9 } // Sets the compression level.
} // });
archive.pipe(output);
if (req.body.data) {
req.body.data.forEach( async (e) => {
// const path = e.path.replace(cdnConfig.uri, storageConfig.uri).replace(/ /g, '\\ ');
// // // const path = e.path.replace(cdnConfig.uri, storageConfig.uri);
// console.log('path: ', path);
let downnload_count_list = new Map();
await File.findOne({
where: {
name: e.name,
url : e.path,
created_by: user_infor,
is_active : true
}
}).then(result => {
// plus one to the download count when download each selected file
downnload_count_list.set( result.id,result.download_count + 1);
const storage = result.url.replace(cdnConfig.uri, storageConfig.uri).replace(/ /g, '\\ ');
if (e.isFolder) {
archive.directory(storage, e.name);
} else {
archive.file(storage, { name: e.name });
}
archive.finalize();
next()
}).catch(ex => {
console.log(ex);
next()
// ErrorHandel(ex, req, res, next);
});
downnload_count_list.forEach(async (value,key) => {
const new_download_count_value = {download_count : value};
await File.update(
new_download_count_value, {
where : {
id : key,
is_active: true
}
}
).then(result => {
console.log("download count add success");
next()
}).catch(ex => {
console.log("error2");
next()
// ErrorHandel(ex, req, res, next); // archive.pipe(output);
}) if (req.body.data) {
}) req.body.data.forEach((e) => {
const path1 = e.path.replace(cdnConfig.uri, storageConfig.uri).replace(/ /g, '\\ ');
command += `${path1} `;
}); });
} }
console.log(command);
return res.json({ exec(command, (error, stdout, stderr) => {
code: 0, if (error) {
data: { console.error(`Command execution error: ${error.message}`);
name: namefile, return res.status(400).json({
path: `${cdnConfig.uri}/download/${user.id}/${namefile}` code: 400,
message: 'error'
});
}
if (stderr) {
console.error(`Command stderr: ${stderr}`);
return res.status(400).json({
code: 400,
message: 'error'
});
} }
console.log(`Command output: ${stdout}`);
return res.json({
code: 0,
data: {
name: namefile,
path: `${cdnConfig.uri}/download/${user.id}/${namefile}`,
}
});
}); });
} catch (ex) { } catch (ex) {
return ErrorHandel(ex, req, res, next); return ErrorHandel(ex, req, res, next);
} }
@ -309,52 +226,24 @@ exports.forceDelete = (req, res, next) => {
exports.deleteMultiple = (req, res, next) => { exports.deleteMultiple = (req, res, next) => {
try { try {
// const dir = `${storageConfig.uri_backup}/${user.id}/${Date.now()}`; const user = req.user;
// multer({ dest: `${dir}` }); const dir = `${storageConfig.uri_backup}/${user.id}/${Date.now()}`;
multer({ dest: `${dir}` });
if (req.body.data) { if (req.body.data) {
req.body.data.forEach(async (e) => { req.body.data.forEach((e) => {
const path = e.path.replace(cdnConfig.uri, storageConfig.uri);
let newpath = e.path.replace(cdnConfig.uri, storageConfig.uri_backup);
// const path = e.path.replace(cdnConfig.uri, storageConfig.uri); const split = newpath.split('/');
// let newpath = e.path.replace(cdnConfig.uri, storageConfig.uri_backup); newpath = `${dir}/${split[split.length - 1]}`;
// const split = newpath.split('/'); fs.rename(path, newpath, (err) => {
// newpath = `${dir}/${split[split.length - 1]}`; if (err) throw err;
// fs.rename(path, newpath, (err) => { return { code: 0, message: 'success' };
// if (err) throw err; });
// return { code: 0, message: 'success' };
// });
console.log(e.path);
const user = req.user;
const user_infor = {
id: user.id,
name: user.name
}
const data = {is_active : false}
await File.update(
data,
{
where: {
name: e.name,
created_by: user_infor,
url : e.path
}
}
).then(result => {
console.log("success");
}).catch(ex => {
console.log(ex);
})
// console.log(e);
}); });
} }
return res.json({ code: 0, message: messages.REMOVE_SUCCESS }); return res.json({ code: 0, message: 'success' });
} catch (ex) { } catch (ex) {
return ErrorHandel(ex, req, res, next); return ErrorHandel(ex, req, res, next);
} }
}; };

@ -20,7 +20,6 @@ exports.create = async (req, res, next) => {
params.type = User.Types.INDIVIDUAL; params.type = User.Types.INDIVIDUAL;
params.service = User.Services.INDIVIDUAL; params.service = User.Services.INDIVIDUAL;
// save data // save data
console.log(req.body);
await User.create(req.body) await User.create(req.body)
.then(data => { .then(data => {
uploadAdapter.createDefaultFolder({ id: data.id }); uploadAdapter.createDefaultFolder({ id: data.id });

@ -15,9 +15,3 @@ exports.load = async (req, res, next) => {
return ErrorHandler(error, req, res); return ErrorHandler(error, req, res);
} }
}; };
// check wheather user has upload any file
exports.checkExist = async(req,res,next) => {
}

@ -2,7 +2,6 @@ import express from 'express';
// import validate from 'express-validation'; // import validate from 'express-validation';
import { authorize } from '../../middlewares/auth.middleware'; import { authorize } from '../../middlewares/auth.middleware';
import Permissions from '../../../common/utils/Permissions'; import Permissions from '../../../common/utils/Permissions';
import userMiddleware from '../../middlewares/user.middleware';
import { uploader } from '../../../common/services/adapters/upload-adapter'; import { uploader } from '../../../common/services/adapters/upload-adapter';
import controller from '../../controllers/v1/image.controller'; import controller from '../../controllers/v1/image.controller';
@ -22,11 +21,10 @@ router
); );
router router
.route('/upload-multiple/:id') .route('/upload-multiple')
.post( .post(
// authorize([Permissions.IMAGE_UPLOAD]), // authorize([Permissions.IMAGE_UPLOAD]),
// validate(uploadValidation), // validate(uploadValidation),
userMiddleware.load,
uploader.array('file', 100), uploader.array('file', 100),
controller.uploadMultiple controller.uploadMultiple
); );
@ -37,6 +35,4 @@ router
controller.uploadFile controller.uploadFile
); );
export default router; export default router;

@ -48,7 +48,4 @@ router
authorize([Permissions.USER]), authorize([Permissions.USER]),
controller.deleteMultiple controller.deleteMultiple
); );
export default router; export default router;

@ -190,8 +190,7 @@ FileConfig.init(
created_by: { created_by: {
type: DataTypes.JSONB, type: DataTypes.JSONB,
defaultValue: null // id | name defaultValue: null // id | name
}, }
}, },
{ {
timestamps: false, timestamps: false,

@ -3,6 +3,7 @@ import httpStatus from 'http-status';
import { Model, DataTypes, Op } from 'sequelize'; import { Model, DataTypes, Op } from 'sequelize';
import { isEqual, isNil, isUndefined, omitBy, pick } from 'lodash'; import { isEqual, isNil, isUndefined, omitBy, pick } from 'lodash';
import moment from 'moment-timezone'; import moment from 'moment-timezone';
import { serviceName } from '../../config/vars'; import { serviceName } from '../../config/vars';
import postgres from '../../config/postgres'; import postgres from '../../config/postgres';
import APIError from '../utils/APIException'; import APIError from '../utils/APIException';
@ -63,10 +64,6 @@ File.init(
created_by: { created_by: {
type: DataTypes.JSONB, type: DataTypes.JSONB,
defaultValue: null // id | name defaultValue: null // id | name
},
download_count: {
type: DataTypes.INTEGER,
defaultValue: 0
} }
}, },
{ {
@ -230,6 +227,7 @@ File.get = async (id) => {
*/ */
File.list = async ({ File.list = async ({
name, name,
// sort // sort
sort_by, sort_by,
order_by, order_by,

@ -99,7 +99,6 @@ Image.Events = {
IMAGE_UPDATED: `${serviceName}.image.updated`, IMAGE_UPDATED: `${serviceName}.image.updated`,
IMAGE_DELETED: `${serviceName}.image.deleted`, IMAGE_DELETED: `${serviceName}.image.deleted`,
}; };
Image.EVENT_SOURCE = `${serviceName}.image`; Image.EVENT_SOURCE = `${serviceName}.image`;
/** /**

@ -704,7 +704,7 @@ User.getUserByPhoneOrEmailRegister = async ({ phone, email }) => {
try { try {
let user = null; let user = null;
if (phone) { if (phone) {
user = await User.find({ user = await User.findOne({
where: { where: {
is_active: true, is_active: true,
phone: phone phone: phone

@ -1,129 +1,3 @@
<<<<<<< HEAD
import multer from 'multer';
// import moment from 'moment-timezone';
import { storage as storageConfig } from '../../../config/vars';
import { forIn } from 'lodash';
import { equal } from 'joi';
/** storage will create folder when new date */
// const date = new Date();
// const year = moment(date).format('YYYY');
// const month = moment(date).format('MM');
const filePath = `${storageConfig.uri}`;
const createDefaultFolder = ( id ) => {
try {
if (id) {
multer({ dest: `${filePath}/${id}` });
console.log(`creat default ${filePath}/${id}` );
} else {
multer({ dest: `${filePath}` });
console.log(`creat default ${filePath}` );
}
// multer({ dest: `${filePath}/images/games` });
// multer({ dest: `${filePath}/images/stories` });
// multer({ dest: `${filePath}/images/chapters` });
// multer({ dest: `${filePath}/images/vouchers` });
// multer({ dest: `${filePath}/images/products` });
// multer({ dest: `${filePath}/images/customers` });
// multer({ dest: `${filePath}/images/promotions` });
// // configuration
// multer({ dest: `${filePath}/images/banners` });
// multer({ dest: `${filePath}/images/categories` });
// multer({ dest: `${filePath}/images/upload/default` });
return true;
} catch (ex) {
return false;
}
};
const createFolder = ({ path }) => {
try {
console.log(`${filePath}/${path}`);
multer({ dest: `${filePath}/${path}` });
// multer({ dest: `${filePath}/images/games` });
// multer({ dest: `${filePath}/images/stories` });
// multer({ dest: `${filePath}/images/chapters` });
// multer({ dest: `${filePath}/images/vouchers` });
// multer({ dest: `${filePath}/images/products` });
// multer({ dest: `${filePath}/images/customers` });
// multer({ dest: `${filePath}/images/promotions` });
// // configuration
// multer({ dest: `${filePath}/images/banners` });
// multer({ dest: `${filePath}/images/categories` });
// multer({ dest: `${filePath}/images/upload/default` });
// console.log(multer);
return true;
} catch (ex) {
return false;
}
};
/** add image to storage follow group */
const storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, filePath);
},
filename: (req, file, cb) => {
/**
* setup folder follow date
*/
createDefaultFolder(req.params.id);
console.log('run in herer', req.query.path, file);
/**
* save image follow type
*/
// let path = req.locals.user.id;
// console.log(path);
let path = req.params.id;
console.log(path);
console.log(file);
// const fileName = file.originalname.includes('.')
// ? file.originalname.slice(0, file.originalname.lastIndexOf('.'))
// : file.originalname;
cb(
null,
`/${path}/${file.originalname.replace(/\s/g, '')}`
);
}
});
const fileFilter = (req, file, cb) => {
// if (
// file.mimetype === 'image/jpeg' ||
// file.mimetype === 'image/webp' ||
// file.mimetype === 'image/png' ||
// file.mimetype === 'image/gif' ||
// ) {
// cb(null, true);
// } else {
// cb(null, false);
// }
cb(null, true);
};
const uploader = multer({
storage,
limits: {
fileSize: 1024 * 1024 * 2048 // 5MB
},
fileFilter
});
module.exports = {
createDefaultFolder,
createFolder,
uploader,
fileFilter
};
=======
import multer from 'multer'; import multer from 'multer';
// import moment from 'moment-timezone'; // import moment from 'moment-timezone';
import { storage as storageConfig } from '../../../config/vars'; import { storage as storageConfig } from '../../../config/vars';
@ -238,4 +112,3 @@ module.exports = {
uploader, uploader,
fileFilter fileFilter
}; };
>>>>>>> 7bd4b58a0df174b4a8c26c34b9d388fc8ab3c4fd

@ -35,33 +35,5 @@
"_ is not defined": "_ is not defined", "_ is not defined": "_ is not defined",
"Cannot access 'splited_dir' before initialization": "Cannot access 'splited_dir' before initialization", "Cannot access 'splited_dir' before initialization": "Cannot access 'splited_dir' before initialization",
"main_dir is not defined": "main_dir is not defined", "main_dir is not defined": "main_dir is not defined",
"Cannot read properties of undefined (reading 'trim')": "Cannot read properties of undefined (reading 'trim')", "Cannot read properties of undefined (reading 'trim')": "Cannot read properties of undefined (reading 'trim')"
"relation \"file_service.tbl_files\" does not exist": "relation \"file_service.tbl_files\" does not exist",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\12\\755296-200.png'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\12\\755296-200.png'",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\755296-200.png'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\755296-200.png'",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\Papers-1(2).docx'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\Papers-1(2).docx'",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\style.txt'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\style.txt'",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\12\\style.txt'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\12\\style.txt'",
"Cannot read properties of undefined (reading 'locals')": "Cannot read properties of undefined (reading 'locals')",
"body is not defined": "body is not defined",
"Tài khoản này đã được đăng kí": "Tài khoản này đã được đăng kí",
"file is not defined": "file is not defined",
"pick is not defined": "pick is not defined",
"path is not defined": "path is not defined",
"Cannot read properties of undefined (reading 'isFolder')": "Cannot read properties of undefined (reading 'isFolder')",
"Cannot read properties of undefined (reading 'isDirectory')": "Cannot read properties of undefined (reading 'isDirectory')",
"data.url.isDirectory is not a function": "data.url.isDirectory is not a function",
"ENOENT: no such file or directory, lstat 'http://103.162.31.170\\15\\login-password.json'": "ENOENT: no such file or directory, lstat 'http://103.162.31.170\\15\\login-password.json'",
"ENOENT: no such file or directory, lstat 'public/15/undefined/login-password.json'": "ENOENT: no such file or directory, lstat 'public/15/undefined/login-password.json'",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\59\\Papers-1(2).docx'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\59\\Papers-1(2).docx'",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\60\\Papers-1(2).docx'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\60\\Papers-1(2).docx'",
"ENOENT: no such file or directory, lstat 'public/60//Papers-1 (2).docx'": "ENOENT: no such file or directory, lstat 'public/60//Papers-1 (2).docx'",
"Converting circular structure to JSON\n --> starting at object with constructor 'Object'\n --- property 'win32' closes the circle": "Converting circular structure to JSON\n --> starting at object with constructor 'Object'\n --- property 'win32' closes the circle",
"EPERM: operation not permitted, lstat 'public\\download\\60\\1233532-1691036912591.zip'": "EPERM: operation not permitted, lstat 'public\\download\\60\\1233532-1691036912591.zip'",
"_file2.default.find is not a function": "_file2.default.find is not a function",
"storage is not defined": "storage is not defined",
"queue closed": "queue closed",
"downnload_count_list is not defined": "downnload_count_list is not defined",
"ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\deeplearning_ex2.py'": "ENOENT: no such file or directory, open 'C:\\Users\\TUNG DO\\upload-file-backend\\public\\undefined\\deeplearning_ex2.py'",
"invalid input syntax for type integer: \"deeplearning_ex2.py\"": "invalid input syntax for type integer: \"deeplearning_ex2.py\""
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save