diff --git a/.gitignore b/.gitignore index 04a977352..a6007f318 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ coverage node_modules dist -storage +#storage npm-debug.log .eslintcache datasources.*.json diff --git a/back/methods/dms/updateFile.js b/back/methods/dms/updateFile.js index 9f8f4f293..a420f2ea1 100644 --- a/back/methods/dms/updateFile.js +++ b/back/methods/dms/updateFile.js @@ -1,5 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); const fs = require('fs-extra'); +const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('updateFile', { @@ -84,66 +85,46 @@ module.exports = Self => { }; async function uploadNewFile(ctx, dms, myOptions) { - const storageConnector = Self.app.dataSources.dmsStorage.connector; const models = Self.app.models; + const TempContainer = models.TempContainer; + const DmsContainer = models.DmsContainer; const fileOptions = {}; - - const tempContainer = await getContainer('temp'); - const makeUpload = await models.Container.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); + const tempContainer = await TempContainer.container('dms'); + const makeUpload = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); const keys = Object.values(makeUpload.files); const files = keys.map(file => file[0]); - const file = files[0]; + const uploadedFile = files[0]; - if (file) { - const oldExtension = storageConnector.getFileExtension(dms.file); - const newExtension = storageConnector.getFileExtension(file.name); + if (uploadedFile) { + const oldExtension = DmsContainer.getFileExtension(dms.file); + const newExtension = DmsContainer.getFileExtension(uploadedFile.name); const fileName = `${dms.id}.${newExtension}`; try { if (oldExtension != newExtension) { - const pathHash = storageConnector.getPathHash(dms.id); + const pathHash = DmsContainer.getHash(dms.id); - await models.Container.removeFile(pathHash, dms.file); + await DmsContainer.removeFile(pathHash, dms.file); } } catch (err) {} const updatedDms = await dms.updateAttributes({ - contentType: file.type, + contentType: uploadedFile.type, file: fileName }, myOptions); - const pathHash = storageConnector.getPathHash(updatedDms.id); - const container = await getContainer(pathHash); + const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name); + const srcFile = path.join(file.client.root, file.container, file.name); - const originPath = `${tempContainer.client.root}/${tempContainer.name}/${file.name}`; - const destinationPath = `${container.client.root}/${pathHash}/${updatedDms.file}`; + const pathHash = DmsContainer.getHash(updatedDms.id); + const dmsContainer = await DmsContainer.container(pathHash); + const dstFile = path.join(dmsContainer.client.root, pathHash, updatedDms.file); - fs.rename(originPath, destinationPath); + await fs.move(srcFile, dstFile, { + overwrite: true + }); return updatedDms; } } - - /** - * Returns a container instance - * If doesn't exists creates a new one - * - * @param {String} name Container name - * @return {Object} Container instance - */ - async function getContainer(name) { - const models = Self.app.models; - let container; - try { - container = await models.Container.getContainer(name); - } catch (err) { - if (err.code === 'ENOENT') { - container = await models.Container.createContainer({ - name: name - }); - } else throw err; - } - - return container; - } }; diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js index 8e5c4eb63..c3065c3cc 100644 --- a/back/methods/dms/uploadFile.js +++ b/back/methods/dms/uploadFile.js @@ -1,5 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); const fs = require('fs-extra'); +const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('uploadFile', { @@ -46,8 +47,9 @@ module.exports = Self => { }); Self.uploadFile = async(ctx, options) => { - const storageConnector = Self.app.dataSources.dmsStorage.connector; const models = Self.app.models; + const TempContainer = models.TempContainer; + const DmsContainer = models.DmsContainer; const fileOptions = {}; const args = ctx.args; @@ -62,28 +64,33 @@ module.exports = Self => { myOptions.transaction = tx; } + let srcFile; try { const hasWriteRole = await models.DmsType.hasWriteRole(ctx, args.dmsTypeId, myOptions); if (!hasWriteRole) throw new UserError(`You don't have enough privileges`); // Upload file to temporary path - const tempContainer = await getContainer('temp'); - const uploaded = await models.Container.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); + const tempContainer = await TempContainer.container('dms'); + const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); const files = Object.values(uploaded.files).map(file => { return file[0]; }); const addedDms = []; - for (const file of files) { - const newDms = await createDms(ctx, file, myOptions); - const pathHash = storageConnector.getPathHash(newDms.id); - const container = await getContainer(pathHash); + for (const uploadedFile of files) { + const newDms = await createDms(ctx, uploadedFile, myOptions); + const pathHash = DmsContainer.getHash(newDms.id); - const originPath = `${tempContainer.client.root}/${tempContainer.name}/${file.name}`; - const destinationPath = `${container.client.root}/${pathHash}/${newDms.file}`; + const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name); + srcFile = path.join(file.client.root, file.container, file.name); - await fs.rename(originPath, destinationPath); + const dmsContainer = await DmsContainer.container(pathHash); + const dstFile = path.join(dmsContainer.client.root, pathHash, newDms.file); + + await fs.move(srcFile, dstFile, { + overwrite: true + }); addedDms.push(newDms); } @@ -92,13 +99,16 @@ module.exports = Self => { return addedDms; } catch (e) { if (tx) await tx.rollback(); + + if (fs.existsSync(srcFile)) + await fs.unlink(srcFile); + throw e; } }; async function createDms(ctx, file, myOptions) { const models = Self.app.models; - const storageConnector = Self.app.dataSources.dmsStorage.connector; const myUserId = ctx.req.accessToken.userId; const myWorker = await models.Worker.findOne({where: {userFk: myUserId}}, myOptions); const args = ctx.args; @@ -115,32 +125,9 @@ module.exports = Self => { }, myOptions); let fileName = file.name; - const extension = storageConnector.getFileExtension(fileName); + const extension = models.DmsContainer.getFileExtension(fileName); fileName = `${newDms.id}.${extension}`; return newDms.updateAttribute('file', fileName, myOptions); } - - /** - * Returns a container instance - * If doesn't exists creates a new one - * - * @param {String} name Container name - * @return {Object} Container instance - */ - async function getContainer(name) { - const models = Self.app.models; - let container; - try { - container = await models.Container.getContainer(name); - } catch (err) { - if (err.code === 'ENOENT') { - container = await models.Container.createContainer({ - name: name - }); - } else throw err; - } - - return container; - } }; diff --git a/back/methods/image/download.js b/back/methods/image/download.js index ba709aff8..9b02a7b39 100644 --- a/back/methods/image/download.js +++ b/back/methods/image/download.js @@ -1,5 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); const fs = require('fs-extra'); +const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('download', { @@ -69,8 +70,9 @@ module.exports = Self => { const container = await models.ImageContainer.getContainer(collection); const rootPath = container.client.root; + const fileSrc = path.join(rootPath, collection, size); const file = { - path: `${rootPath}/${collection}/${size}/${image.name}.png`, + path: `${fileSrc}/${image.name}.png`, contentType: 'image/png', name: `${image.name}.png` }; diff --git a/back/methods/image/specs/upload.spec.js b/back/methods/image/specs/upload.spec.js index 3f2cb6f64..8521f2f20 100644 --- a/back/methods/image/specs/upload.spec.js +++ b/back/methods/image/specs/upload.spec.js @@ -29,8 +29,8 @@ describe('image upload()', () => { expect(error.message).toEqual(`You don't have enough privileges`); }); - it('should call to the ImageContainer upload method for the collection "catalog"', async() => { - const containerModel = app.models.ImageContainer; + it('should call to the TempContainer upload method for the collection "catalog"', async() => { + const containerModel = app.models.TempContainer; spyOn(containerModel, 'upload'); const ctx = {req: {accessToken: {userId: buyerId}}, @@ -73,8 +73,8 @@ describe('image upload()', () => { const workerId = 106; const itemId = 4; - it('should be able to call to the ImageContainer upload method for the collection "user"', async() => { - const containerModel = app.models.ImageContainer; + it('should be able to call to the TempContainer upload method for the collection "user"', async() => { + const containerModel = app.models.TempContainer; spyOn(containerModel, 'upload'); const ctx = {req: {accessToken: {userId: marketingId}}, @@ -91,8 +91,8 @@ describe('image upload()', () => { expect(containerModel.upload).toHaveBeenCalled(); }); - it('should be able to call to the ImageContainer upload method for the collection "catalog"', async() => { - const containerModel = app.models.ImageContainer; + it('should be able to call to the TempContainer upload method for the collection "catalog"', async() => { + const containerModel = app.models.TempContainer; spyOn(containerModel, 'upload'); const ctx = {req: {accessToken: {userId: marketingId}}, @@ -115,8 +115,8 @@ describe('image upload()', () => { const workerId = 106; const itemId = 4; - it('should upload a file for the collection "user" and call to the ImageContainer upload method', async() => { - const containerModel = app.models.ImageContainer; + it('should upload a file for the collection "user" and call to the TempContainer upload method', async() => { + const containerModel = app.models.TempContainer; spyOn(containerModel, 'upload'); const ctx = {req: {accessToken: {userId: hhrrId}}, diff --git a/back/methods/image/upload.js b/back/methods/image/upload.js index b50a55b34..59e9738ec 100644 --- a/back/methods/image/upload.js +++ b/back/methods/image/upload.js @@ -1,5 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); const fs = require('fs-extra'); +const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('upload', { @@ -17,6 +18,12 @@ module.exports = Self => { type: 'string', description: 'The collection name', required: true + }, + { + arg: 'fileName', + type: 'string', + description: 'The file name', + required: true }], returns: { type: 'Object', @@ -30,48 +37,36 @@ module.exports = Self => { Self.upload = async ctx => { const models = Self.app.models; + const TempContainer = models.TempContainer; const fileOptions = {}; const args = ctx.args; - const hasWriteRole = await models.ImageCollection.hasWriteRole(ctx, args.collection); - if (!hasWriteRole) - throw new UserError(`You don't have enough privileges`); - - if (process.env.NODE_ENV == 'test') - throw new UserError(`You can't upload images on the test instance`); - - // Upload file to temporary path - const container = await getContainer(args.collection); - const uploaded = await models.ImageContainer.upload(container.name, ctx.req, ctx.result, fileOptions); - const [uploadedFile] = Object.values(uploaded.files).map(file => { - return file[0]; - }); - - const file = await models.ImageContainer.getFile(container.name, uploadedFile.name); - const srcFile = `${file.client.root}/${file.container}/${file.name}`; - await models.Image.registerImage(container.name, srcFile, args.id); - }; - - /** - * Returns a container instance - * If doesn't exists creates a new one - * - * @param {String} name Container name - * @return {Object} Container instance - */ - async function getContainer(name) { - const models = Self.app.models; - let container; + let srcFile; try { - container = await models.ImageContainer.getContainer(name); - } catch (err) { - if (err.code === 'ENOENT') { - container = await models.ImageContainer.createContainer({ - name: name - }); - } else throw err; - } + const hasWriteRole = await models.ImageCollection.hasWriteRole(ctx, args.collection); + if (!hasWriteRole) + throw new UserError(`You don't have enough privileges`); - return container; - } + if (process.env.NODE_ENV == 'test') + throw new UserError(`You can't upload images on the test instance`); + + await TempContainer.allowedContentTypes(); + + // Upload file to temporary path + const tempContainer = await TempContainer.container(args.collection); + const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); + const [uploadedFile] = Object.values(uploaded.files).map(file => { + return file[0]; + }); + const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name); + srcFile = path.join(file.client.root, file.container, file.name); + + await models.Image.registerImage(args.collection, srcFile, args.fileName, args.id); + } catch (e) { + if (fs.existsSync(srcFile)) + await fs.unlink(srcFile); + + throw e; + } + }; }; diff --git a/back/model-config.json b/back/model-config.json index 3db249f0f..5e4cc23a2 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -17,9 +17,6 @@ "Company": { "dataSource": "vn" }, - "Container": { - "dataSource": "dmsStorage" - }, "Continent": { "dataSource": "vn" }, @@ -35,6 +32,9 @@ "Delivery": { "dataSource": "vn" }, + "DmsContainer": { + "dataSource": "dmsStorage" + }, "Image": { "dataSource": "vn" }, @@ -53,6 +53,9 @@ "Province": { "dataSource": "vn" }, + "TempContainer": { + "dataSource": "tempStorage" + }, "UserConfig": { "dataSource": "vn" }, diff --git a/back/models/container.json b/back/models/container.json deleted file mode 100644 index eca4c30c7..000000000 --- a/back/models/container.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "Container", - "base": "VnModel", - "idInjection": true, - "options": { - "validateUpsert": true - }, - "properties": {}, - "validations": [], - "relations": {}, - "acls": [], - "methods": [] - } \ No newline at end of file diff --git a/back/models/dms-container.json b/back/models/dms-container.json new file mode 100644 index 000000000..196c95420 --- /dev/null +++ b/back/models/dms-container.json @@ -0,0 +1,10 @@ +{ + "name": "DmsContainer", + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/back/models/dmsType.js b/back/models/dms-type.js similarity index 100% rename from back/models/dmsType.js rename to back/models/dms-type.js diff --git a/back/models/dmsType.json b/back/models/dms-type.json similarity index 100% rename from back/models/dmsType.json rename to back/models/dms-type.json diff --git a/back/models/dms.js b/back/models/dms.js index 9e767904e..91291a0c2 100644 --- a/back/models/dms.js +++ b/back/models/dms.js @@ -14,12 +14,12 @@ module.exports = Self => { }; Self.getFile = async function(id) { - const storageConnector = Self.app.dataSources.dmsStorage.connector; const models = Self.app.models; + const DmsContainer = models.DmsContainer; const dms = await Self.findById(id); - const pathHash = storageConnector.getPathHash(dms.id); + const pathHash = DmsContainer.getHash(dms.id); try { - await models.Container.getFile(pathHash, dms.file); + await DmsContainer.getFile(pathHash, dms.file); } catch (e) { if (e.code != 'ENOENT') throw e; @@ -30,7 +30,7 @@ module.exports = Self => { throw error; } - const stream = models.Container.downloadStream(pathHash, dms.file); + const stream = DmsContainer.downloadStream(pathHash, dms.file); return [stream, dms.contentType, `filename="${dms.file}"`]; }; diff --git a/back/models/image-container.json b/back/models/image-container.json index 22cea05f5..26a6cb44d 100644 --- a/back/models/image-container.json +++ b/back/models/image-container.json @@ -1,13 +1,10 @@ { "name": "ImageContainer", - "base": "VnModel", - "idInjection": true, - "options": { - "validateUpsert": true - }, - "properties": {}, - "validations": [], - "relations": {}, - "acls": [], - "methods": [] - } \ No newline at end of file + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/back/models/image.js b/back/models/image.js index cbe2cfdac..78d159940 100644 --- a/back/models/image.js +++ b/back/models/image.js @@ -6,7 +6,7 @@ module.exports = Self => { require('../methods/image/download')(Self); require('../methods/image/upload')(Self); - Self.registerImage = async(collectionName, srcFile, entityId) => { + Self.registerImage = async(collectionName, srcFilePath, fileName, entityId) => { const models = Self.app.models; const tx = await Self.beginTransaction({}); const myOptions = {transaction: tx}; @@ -30,13 +30,10 @@ module.exports = Self => { } }, myOptions); - const file = srcFile.split('/').pop(); - const fileName = file.split('.')[0]; const data = { name: fileName, collectionFk: collectionName }; - const newImage = await Self.upsertWithWhere(data, { name: fileName, collectionFk: collectionName, @@ -44,9 +41,10 @@ module.exports = Self => { }, myOptions); // Resizes and saves the image - const container = await models.ImageContainer.getContainer(collectionName); + const container = await models.ImageContainer.container(collectionName); const rootPath = container.client.root; const collectionDir = path.join(rootPath, collectionName); + const file = `${fileName}.png`; const dstDir = path.join(collectionDir, 'full'); const dstFile = path.join(dstDir, file); @@ -56,7 +54,7 @@ module.exports = Self => { }; await fs.mkdir(dstDir, {recursive: true}); - await sharp(srcFile, {failOnError: false}) + await sharp(srcFilePath, {failOnError: false}) .resize(collection.maxWidth, collection.maxHeight, resizeOpts) .png() .toFile(dstFile); @@ -71,7 +69,7 @@ module.exports = Self => { }; await fs.mkdir(dstDir, {recursive: true}); - await sharp(srcFile, {failOnError: false}) + await sharp(srcFilePath, {failOnError: false}) .resize(size.width, size.height, resizeOpts) .png() .toFile(dstFile); @@ -91,8 +89,8 @@ module.exports = Self => { ); } - if (fs.existsSync(srcFile)) - await fs.unlink(srcFile); + if (fs.existsSync(srcFilePath)) + await fs.unlink(srcFilePath); await tx.commit(); return newImage; diff --git a/back/models/temp-container.json b/back/models/temp-container.json new file mode 100644 index 000000000..1456497f1 --- /dev/null +++ b/back/models/temp-container.json @@ -0,0 +1,10 @@ +{ + "name": "TempContainer", + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 690b2572e..f7a9b4241 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -767,19 +767,19 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`, `minPrice`) VALUES - (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd', 1, NULL, 0), - (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd', 1, NULL, 0), - (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 'a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd', 1, NULL, 0), - (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, '0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), - (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '189081e0-3ab4-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), - (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '25238060-3ab4-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), - (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 'c4097310-3ab4-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), - (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 'd3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd', 1, NULL, 0), - (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd', 1, NULL, 0), - (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd', 1, NULL, 0), - (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 'a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), - (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 'e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), - (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 'fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd', 2, NULL, 0), + (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '1', 1, NULL, 0), + (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '2', 1, NULL, 0), + (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '3', 1, NULL, 0), + (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, '4', 2, NULL, 0), + (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '5', 2, NULL, 0), + (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '6', 2, NULL, 0), + (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '7', 2, NULL, 0), + (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '8', 1, NULL, 0), + (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '9', 1, NULL, 0), + (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '10', 1, NULL, 0), + (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, '11', 2, NULL, 0), + (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '12', 2, NULL, 0), + (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '13', 2, NULL, 0), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), diff --git a/front/salix/components/upload-photo/index.html b/front/salix/components/upload-photo/index.html index fc5b6c735..c36eb7fe1 100644 --- a/front/salix/components/upload-photo/index.html +++ b/front/salix/components/upload-photo/index.html @@ -6,13 +6,29 @@
+ + + + + + + + diff --git a/front/salix/components/upload-photo/index.js b/front/salix/components/upload-photo/index.js index aa3c1a22a..924a6a8a4 100644 --- a/front/salix/components/upload-photo/index.js +++ b/front/salix/components/upload-photo/index.js @@ -12,8 +12,26 @@ export default class UploadPhoto extends Component { * @param {*} id - Entity id */ show(collection, id) { - this.newPhoto = {id, collection}; + this.newPhoto = { + id: id, + collection: collection, + fileName: id + }; this.$.dialog.show(); + this.getAllowedContentTypes(); + } + + getAllowedContentTypes() { + this.$http.get('ImageContainers/allowedContentTypes').then(res => { + const contentTypes = res.data.join(', '); + this.allowedContentTypes = contentTypes; + }); + } + + get contentTypesInfo() { + return this.$t('ContentTypesInfo', { + allowedContentTypes: this.allowedContentTypes + }); } /** diff --git a/front/salix/components/upload-photo/locale/es.yml b/front/salix/components/upload-photo/locale/es.yml index 10271cf92..d2e696ba9 100644 --- a/front/salix/components/upload-photo/locale/es.yml +++ b/front/salix/components/upload-photo/locale/es.yml @@ -1,2 +1,3 @@ Upload new photo: Subir una nueva foto -Select an image: Selecciona una imagen \ No newline at end of file +Select an image: Selecciona una imagen +File name: Nombre del fichero \ No newline at end of file diff --git a/loopback/common/models/container.js b/loopback/common/models/container.js new file mode 100644 index 000000000..f24982021 --- /dev/null +++ b/loopback/common/models/container.js @@ -0,0 +1,57 @@ +const md5 = require('md5'); + +module.exports = function(Self) { + Self.setup = function() { + Self.super_.setup.call(this); + + this.remoteMethod('allowedContentTypes', { + description: 'Returns a list of allowed contentTypes', + accessType: 'READ', + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/allowedContentTypes`, + verb: 'GET' + } + }); + }; + + /** + * Returns a container instance + * If doesn't exists creates a new one + * + * @param {String} name Container name + * @return {Object} Container instance + */ + Self.container = async function(name) { + const models = Self.app.models; + let container; + try { + container = await models[this.modelName].getContainer(name); + } catch (err) { + if (err.code === 'ENOENT') { + container = await models[this.modelName].createContainer({ + name: name + }); + } else throw err; + } + + return container; + }; + + Self.getHash = function(id) { + return md5(id.toString()).substring(0, 3); + }; + + Self.getFileExtension = function(fileName) { + return fileName.split('.').pop().toLowerCase(); + }; + + Self.allowedContentTypes = async function() { + const connector = this.dataSource.connector; + const allowedContentTypes = connector.allowedContentTypes; + return allowedContentTypes; + }; +}; diff --git a/loopback/common/models/container.json b/loopback/common/models/container.json new file mode 100644 index 000000000..da4811028 --- /dev/null +++ b/loopback/common/models/container.json @@ -0,0 +1,12 @@ +{ + "name": "Container", + "base": "VnModel", + "acls": [ + { + "property": "status", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} diff --git a/loopback/server/boot/storage.js b/loopback/server/boot/storage.js deleted file mode 100644 index 7559a7dec..000000000 --- a/loopback/server/boot/storage.js +++ /dev/null @@ -1,31 +0,0 @@ -const uuid = require('uuid/v1'); -const md5 = require('md5'); - -module.exports = app => { - const storageConnector = app.dataSources.dmsStorage.connector; - - storageConnector.getFilename = function(file) { - return `${uuid()}.${storageConnector.getFileExtension(file.name)}`; - }; - - storageConnector.getFileExtension = function(fileName) { - return fileName.split('.').pop().toLowerCase(); - }; - - storageConnector.getPathHash = function(id) { - return md5(id.toString()).substring(0, 3); - }; - - const imageStorageConnector = app.dataSources.imageStorage.connector; - imageStorageConnector.getFilename = function(file) { - return `${uuid()}.png`; - }; - - /* imageStorageConnector.getFileExtension = function(fileName) { - return fileName.split('.').pop().toLowerCase(); - }; - - imageStorageConnector.getPathHash = function(id) { - return md5(id.toString()).substring(0, 3); - }; */ -}; diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 793dcaea8..8ce442b8e 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -17,6 +17,26 @@ "connectTimeout": 40000, "acquireTimeout": 20000 }, + "tempStorage": { + "name": "tempStorage", + "connector": "loopback-component-storage", + "provider": "filesystem", + "root": "./storage/tmp", + "maxFileSize": "262144000", + "allowedContentTypes": [ + "application/x-7z-compressed", + "application/x-zip-compressed", + "application/x-rar-compressed", + "application/octet-stream", + "application/pdf", + "application/zip", + "application/rar", + "multipart/x-zip", + "image/png", + "image/jpeg", + "image/jpg" + ] + }, "dmsStorage": { "name": "dmsStorage", "connector": "loopback-component-storage", diff --git a/loopback/server/model-config.json b/loopback/server/model-config.json index 20e22accd..ff1a2daa2 100644 --- a/loopback/server/model-config.json +++ b/loopback/server/model-config.json @@ -49,5 +49,8 @@ }, "Application": { "dataSource": "vn" + }, + "Container": { + "dataSource": "vn" } } \ No newline at end of file diff --git a/modules/client/back/methods/client-dms/allowedContentTypes.js b/modules/client/back/methods/client-dms/allowedContentTypes.js deleted file mode 100644 index 3d4b90876..000000000 --- a/modules/client/back/methods/client-dms/allowedContentTypes.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('allowedContentTypes', { - description: 'Returns a list of allowed contentTypes', - accessType: 'READ', - returns: { - type: ['Object'], - root: true - }, - http: { - path: `/allowedContentTypes`, - verb: 'GET' - } - }); - - Self.allowedContentTypes = async() => { - const storageConnector = Self.app.dataSources.dmsStorage.connector; - const allowedContentTypes = storageConnector.allowedContentTypes; - const modelAllowedContentTypes = Self.definition.settings.allowedContentTypes; - - return modelAllowedContentTypes || allowedContentTypes; - }; -}; - diff --git a/modules/client/back/models/client-dms.js b/modules/client/back/models/client-dms.js index 0cffb042c..9e5da9132 100644 --- a/modules/client/back/models/client-dms.js +++ b/modules/client/back/models/client-dms.js @@ -1,4 +1,3 @@ module.exports = Self => { require('../methods/client-dms/removeFile')(Self); - require('../methods/client-dms/allowedContentTypes')(Self); }; diff --git a/modules/client/front/dms/create/index.js b/modules/client/front/dms/create/index.js index 3c3f20100..461d0aa36 100644 --- a/modules/client/front/dms/create/index.js +++ b/modules/client/front/dms/create/index.js @@ -26,7 +26,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('clientDms/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/client/front/dms/edit/index.js b/modules/client/front/dms/edit/index.js index 2b8a7046d..8765eeff2 100644 --- a/modules/client/front/dms/edit/index.js +++ b/modules/client/front/dms/edit/index.js @@ -17,7 +17,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('clientDms/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index ec9177505..ce52c103b 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -33,8 +33,10 @@ module.exports = Self => { // Exit loop if (!image) return clearInterval(timer); - const fileName = `${image.itemFk}.png`; - const filePath = path.join(tempPath, fileName); + const srcFile = image.url.split('/').pop(); + const fileName = srcFile.split('.')[0]; + const file = `${fileName}.png`; + const filePath = path.join(tempPath, file); const writeStream = fs.createWriteStream(filePath); writeStream.on('open', () => { @@ -57,7 +59,7 @@ module.exports = Self => { writeStream.on('finish', async function() { try { - await models.Image.registerImage('catalog', filePath, image.itemFk); + await models.Image.registerImage('catalog', filePath, fileName, image.itemFk); await image.destroy(); } catch (error) { await errorHandler(image.itemFk, error, filePath); diff --git a/modules/ticket/back/methods/ticket-dms/allowedContentTypes.js b/modules/ticket/back/methods/ticket-dms/allowedContentTypes.js deleted file mode 100644 index 3d4b90876..000000000 --- a/modules/ticket/back/methods/ticket-dms/allowedContentTypes.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('allowedContentTypes', { - description: 'Returns a list of allowed contentTypes', - accessType: 'READ', - returns: { - type: ['Object'], - root: true - }, - http: { - path: `/allowedContentTypes`, - verb: 'GET' - } - }); - - Self.allowedContentTypes = async() => { - const storageConnector = Self.app.dataSources.dmsStorage.connector; - const allowedContentTypes = storageConnector.allowedContentTypes; - const modelAllowedContentTypes = Self.definition.settings.allowedContentTypes; - - return modelAllowedContentTypes || allowedContentTypes; - }; -}; - diff --git a/modules/ticket/back/models/ticket-dms.js b/modules/ticket/back/models/ticket-dms.js index 8a6d03434..ddb338632 100644 --- a/modules/ticket/back/models/ticket-dms.js +++ b/modules/ticket/back/models/ticket-dms.js @@ -1,4 +1,3 @@ module.exports = Self => { require('../methods/ticket-dms/removeFile')(Self); - require('../methods/ticket-dms/allowedContentTypes')(Self); }; diff --git a/modules/ticket/front/dms/create/index.js b/modules/ticket/front/dms/create/index.js index 142158e46..b25abf17c 100644 --- a/modules/ticket/front/dms/create/index.js +++ b/modules/ticket/front/dms/create/index.js @@ -25,7 +25,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('ticketDms/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/ticket/front/dms/edit/index.js b/modules/ticket/front/dms/edit/index.js index e50092f77..808ca6a6a 100644 --- a/modules/ticket/front/dms/edit/index.js +++ b/modules/ticket/front/dms/edit/index.js @@ -16,7 +16,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('ticketDms/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/travel/back/methods/travel-thermograph/allowedContentTypes.js b/modules/travel/back/methods/travel-thermograph/allowedContentTypes.js deleted file mode 100644 index 3d4b90876..000000000 --- a/modules/travel/back/methods/travel-thermograph/allowedContentTypes.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('allowedContentTypes', { - description: 'Returns a list of allowed contentTypes', - accessType: 'READ', - returns: { - type: ['Object'], - root: true - }, - http: { - path: `/allowedContentTypes`, - verb: 'GET' - } - }); - - Self.allowedContentTypes = async() => { - const storageConnector = Self.app.dataSources.dmsStorage.connector; - const allowedContentTypes = storageConnector.allowedContentTypes; - const modelAllowedContentTypes = Self.definition.settings.allowedContentTypes; - - return modelAllowedContentTypes || allowedContentTypes; - }; -}; - diff --git a/modules/travel/back/models/travel-thermograph.js b/modules/travel/back/models/travel-thermograph.js index a16e68b98..91aa4de69 100644 --- a/modules/travel/back/models/travel-thermograph.js +++ b/modules/travel/back/models/travel-thermograph.js @@ -1,5 +1,4 @@ module.exports = Self => { - require('../methods/travel-thermograph/allowedContentTypes')(Self); require('../methods/travel-thermograph/getThermographTemperatures')(Self); }; diff --git a/modules/travel/front/thermograph/create/index.js b/modules/travel/front/thermograph/create/index.js index df8d0fe68..666393350 100644 --- a/modules/travel/front/thermograph/create/index.js +++ b/modules/travel/front/thermograph/create/index.js @@ -21,7 +21,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('TravelThermographs/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/travel/front/thermograph/edit/index.js b/modules/travel/front/thermograph/edit/index.js index daa0f696b..a8df3142d 100644 --- a/modules/travel/front/thermograph/edit/index.js +++ b/modules/travel/front/thermograph/edit/index.js @@ -17,7 +17,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('TravelThermographs/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/worker/back/methods/worker-dms/allowedContentTypes.js b/modules/worker/back/methods/worker-dms/allowedContentTypes.js deleted file mode 100644 index 3d4b90876..000000000 --- a/modules/worker/back/methods/worker-dms/allowedContentTypes.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('allowedContentTypes', { - description: 'Returns a list of allowed contentTypes', - accessType: 'READ', - returns: { - type: ['Object'], - root: true - }, - http: { - path: `/allowedContentTypes`, - verb: 'GET' - } - }); - - Self.allowedContentTypes = async() => { - const storageConnector = Self.app.dataSources.dmsStorage.connector; - const allowedContentTypes = storageConnector.allowedContentTypes; - const modelAllowedContentTypes = Self.definition.settings.allowedContentTypes; - - return modelAllowedContentTypes || allowedContentTypes; - }; -}; - diff --git a/modules/worker/back/models/worker-dms.js b/modules/worker/back/models/worker-dms.js index 4b862a81e..b9d6f9a77 100644 --- a/modules/worker/back/models/worker-dms.js +++ b/modules/worker/back/models/worker-dms.js @@ -1,7 +1,6 @@ module.exports = Self => { require('../methods/worker-dms/downloadFile')(Self); require('../methods/worker-dms/removeFile')(Self); - require('../methods/worker-dms/allowedContentTypes')(Self); require('../methods/worker-dms/filter')(Self); Self.isMine = async function(ctx, dmsId) { diff --git a/modules/worker/front/dms/create/index.js b/modules/worker/front/dms/create/index.js index f712edaf3..ff6112211 100644 --- a/modules/worker/front/dms/create/index.js +++ b/modules/worker/front/dms/create/index.js @@ -26,7 +26,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('workerDms/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/worker/front/dms/edit/index.js b/modules/worker/front/dms/edit/index.js index 68c851ff3..31d4c2853 100644 --- a/modules/worker/front/dms/edit/index.js +++ b/modules/worker/front/dms/edit/index.js @@ -17,7 +17,7 @@ class Controller extends Section { } getAllowedContentTypes() { - this.$http.get('WorkerDms/allowedContentTypes').then(res => { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { const contentTypes = res.data.join(', '); this.allowedContentTypes = contentTypes; }); diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index ce236932f..d6e1bc25c 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -60,7 +60,7 @@ - diff --git a/print/config/print.json b/print/config/print.json index 5f4c0f7b8..bb7468281 100755 --- a/print/config/print.json +++ b/print/config/print.json @@ -43,6 +43,6 @@ "pool": true }, "storage": { - "root": "./e2e/dms" + "root": "./storage/dms" } } \ No newline at end of file diff --git a/storage/image/catalog/1600x900/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/1.png similarity index 100% rename from storage/image/catalog/1600x900/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/1.png diff --git a/storage/image/catalog/1600x900/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/10.png similarity index 100% rename from storage/image/catalog/1600x900/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/10.png diff --git a/storage/image/catalog/1600x900/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/11.png similarity index 100% rename from storage/image/catalog/1600x900/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/11.png diff --git a/storage/image/catalog/1600x900/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/12.png similarity index 100% rename from storage/image/catalog/1600x900/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/12.png diff --git a/storage/image/catalog/1600x900/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/13.png similarity index 100% rename from storage/image/catalog/1600x900/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/13.png diff --git a/storage/image/catalog/1600x900/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/2.png similarity index 100% rename from storage/image/catalog/1600x900/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/2.png diff --git a/storage/image/catalog/1600x900/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/3.png similarity index 100% rename from storage/image/catalog/1600x900/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/3.png diff --git a/storage/image/catalog/1600x900/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/4.png similarity index 100% rename from storage/image/catalog/1600x900/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/4.png diff --git a/storage/image/catalog/1600x900/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/5.png similarity index 100% rename from storage/image/catalog/1600x900/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/5.png diff --git a/storage/image/catalog/1600x900/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/6.png similarity index 100% rename from storage/image/catalog/1600x900/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/6.png diff --git a/storage/image/catalog/1600x900/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/7.png similarity index 100% rename from storage/image/catalog/1600x900/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/7.png diff --git a/storage/image/catalog/1600x900/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/8.png similarity index 100% rename from storage/image/catalog/1600x900/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/8.png diff --git a/storage/image/catalog/1600x900/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/1600x900/9.png similarity index 100% rename from storage/image/catalog/1600x900/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/1600x900/9.png diff --git a/storage/image/catalog/200x200/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/1.png similarity index 100% rename from storage/image/catalog/200x200/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/1.png diff --git a/storage/image/catalog/200x200/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/10.png similarity index 100% rename from storage/image/catalog/200x200/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/10.png diff --git a/storage/image/catalog/200x200/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/11.png similarity index 100% rename from storage/image/catalog/200x200/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/11.png diff --git a/storage/image/catalog/200x200/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/12.png similarity index 100% rename from storage/image/catalog/200x200/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/12.png diff --git a/storage/image/catalog/200x200/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/13.png similarity index 100% rename from storage/image/catalog/200x200/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/13.png diff --git a/storage/image/catalog/200x200/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/2.png similarity index 100% rename from storage/image/catalog/200x200/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/2.png diff --git a/storage/image/catalog/200x200/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/3.png similarity index 100% rename from storage/image/catalog/200x200/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/3.png diff --git a/storage/image/catalog/200x200/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/4.png similarity index 100% rename from storage/image/catalog/200x200/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/4.png diff --git a/storage/image/catalog/200x200/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/5.png similarity index 100% rename from storage/image/catalog/200x200/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/5.png diff --git a/storage/image/catalog/200x200/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/6.png similarity index 100% rename from storage/image/catalog/200x200/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/6.png diff --git a/storage/image/catalog/200x200/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/7.png similarity index 100% rename from storage/image/catalog/200x200/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/7.png diff --git a/storage/image/catalog/200x200/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/8.png similarity index 100% rename from storage/image/catalog/200x200/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/8.png diff --git a/storage/image/catalog/200x200/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/200x200/9.png similarity index 100% rename from storage/image/catalog/200x200/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/200x200/9.png diff --git a/storage/image/catalog/50x50/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/1.png similarity index 100% rename from storage/image/catalog/50x50/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/1.png diff --git a/storage/image/catalog/50x50/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/10.png similarity index 100% rename from storage/image/catalog/50x50/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/10.png diff --git a/storage/image/catalog/50x50/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/11.png similarity index 100% rename from storage/image/catalog/50x50/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/11.png diff --git a/storage/image/catalog/50x50/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/12.png similarity index 100% rename from storage/image/catalog/50x50/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/12.png diff --git a/storage/image/catalog/50x50/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/13.png similarity index 100% rename from storage/image/catalog/50x50/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/13.png diff --git a/storage/image/catalog/50x50/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/2.png similarity index 100% rename from storage/image/catalog/50x50/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/2.png diff --git a/storage/image/catalog/50x50/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/3.png similarity index 100% rename from storage/image/catalog/50x50/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/3.png diff --git a/storage/image/catalog/50x50/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/4.png similarity index 100% rename from storage/image/catalog/50x50/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/4.png diff --git a/storage/image/catalog/50x50/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/5.png similarity index 100% rename from storage/image/catalog/50x50/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/5.png diff --git a/storage/image/catalog/50x50/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/6.png similarity index 100% rename from storage/image/catalog/50x50/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/6.png diff --git a/storage/image/catalog/50x50/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/7.png similarity index 100% rename from storage/image/catalog/50x50/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/7.png diff --git a/storage/image/catalog/50x50/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/8.png similarity index 100% rename from storage/image/catalog/50x50/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/8.png diff --git a/storage/image/catalog/50x50/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/50x50/9.png similarity index 100% rename from storage/image/catalog/50x50/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/50x50/9.png diff --git a/storage/image/catalog/70x70/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/1.png similarity index 100% rename from storage/image/catalog/70x70/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/1.png diff --git a/storage/image/catalog/70x70/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/10.png similarity index 100% rename from storage/image/catalog/70x70/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/10.png diff --git a/storage/image/catalog/70x70/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/11.png similarity index 100% rename from storage/image/catalog/70x70/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/11.png diff --git a/storage/image/catalog/70x70/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/12.png similarity index 100% rename from storage/image/catalog/70x70/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/12.png diff --git a/storage/image/catalog/70x70/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/13.png similarity index 100% rename from storage/image/catalog/70x70/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/13.png diff --git a/storage/image/catalog/70x70/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/2.png similarity index 100% rename from storage/image/catalog/70x70/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/2.png diff --git a/storage/image/catalog/70x70/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/3.png similarity index 100% rename from storage/image/catalog/70x70/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/3.png diff --git a/storage/image/catalog/70x70/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/4.png similarity index 100% rename from storage/image/catalog/70x70/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/4.png diff --git a/storage/image/catalog/70x70/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/5.png similarity index 100% rename from storage/image/catalog/70x70/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/5.png diff --git a/storage/image/catalog/70x70/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/6.png similarity index 100% rename from storage/image/catalog/70x70/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/6.png diff --git a/storage/image/catalog/70x70/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/7.png similarity index 100% rename from storage/image/catalog/70x70/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/7.png diff --git a/storage/image/catalog/70x70/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/8.png similarity index 100% rename from storage/image/catalog/70x70/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/8.png diff --git a/storage/image/catalog/70x70/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/70x70/9.png similarity index 100% rename from storage/image/catalog/70x70/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/70x70/9.png diff --git a/storage/image/catalog/full/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/1.png similarity index 100% rename from storage/image/catalog/full/861e1ed0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/1.png diff --git a/storage/image/catalog/full/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/10.png similarity index 100% rename from storage/image/catalog/full/2c484f00-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/10.png diff --git a/storage/image/catalog/full/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/11.png similarity index 100% rename from storage/image/catalog/full/a3d9bea0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/11.png diff --git a/storage/image/catalog/full/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/12.png similarity index 100% rename from storage/image/catalog/full/e48b2d30-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/12.png diff --git a/storage/image/catalog/full/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/13.png similarity index 100% rename from storage/image/catalog/full/fb5cd9f0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/13.png diff --git a/storage/image/catalog/full/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/2.png similarity index 100% rename from storage/image/catalog/full/9b0316c0-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/2.png diff --git a/storage/image/catalog/full/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/3.png similarity index 100% rename from storage/image/catalog/full/a93bd600-3ab3-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/3.png diff --git a/storage/image/catalog/full/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/4.png similarity index 100% rename from storage/image/catalog/full/0e1c92d0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/4.png diff --git a/storage/image/catalog/full/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/5.png similarity index 100% rename from storage/image/catalog/full/189081e0-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/5.png diff --git a/storage/image/catalog/full/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/6.png similarity index 100% rename from storage/image/catalog/full/25238060-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/6.png diff --git a/storage/image/catalog/full/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/7.png similarity index 100% rename from storage/image/catalog/full/c4097310-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/7.png diff --git a/storage/image/catalog/full/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/8.png similarity index 100% rename from storage/image/catalog/full/d3bf8380-3ab4-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/8.png diff --git a/storage/image/catalog/full/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png b/storage/image/catalog/full/9.png similarity index 100% rename from storage/image/catalog/full/20e9fff0-3ab5-11eb-9ab8-27f6fc3b85fd.png rename to storage/image/catalog/full/9.png diff --git a/storage/tmp/tmp.txt b/storage/tmp/tmp.txt new file mode 100644 index 000000000..dd8c1c65f --- /dev/null +++ b/storage/tmp/tmp.txt @@ -0,0 +1 @@ +// Force dir creation \ No newline at end of file