refs #5576 feat update db/change version
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
9cbf30d17c
commit
f6d0cf7817
|
@ -49,6 +49,7 @@ module.exports = Self => {
|
|||
};
|
||||
|
||||
Self.getFullSizePath = (fileName, collectionDir, dstDir) => {
|
||||
try {
|
||||
const fullSizePath = path.join(collectionDir, `full/${dstDir}`);
|
||||
const fullSizeOriginalPath = path.join(collectionDir, `full`);
|
||||
const toFullSizePath = `${fullSizePath}/${fileName}`;
|
||||
|
@ -58,6 +59,9 @@ module.exports = Self => {
|
|||
toFullSizePath,
|
||||
toFullSizeOriginalPath
|
||||
};
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
};
|
||||
Self.removeLink = async(child, parent = null) => {
|
||||
try {
|
||||
|
@ -134,9 +138,6 @@ module.exports = Self => {
|
|||
if (!err) resolve(data);
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
|
||||
await Self.createLink(toFullSizeOriginalPath, toFullSizePath);
|
||||
// To collection sizes
|
||||
|
@ -186,5 +187,8 @@ module.exports = Self => {
|
|||
|
||||
await Self.createLink(toSizeOriginalPath, toSizePath);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ describe('loopback model Image', () => {
|
|||
});
|
||||
|
||||
it('should handle folder destination', async() => {
|
||||
try {
|
||||
const {name, dstDir} = await models.Image.handleFolderDestination(obj.fileName);
|
||||
|
||||
expect(name).toEqual(nameItem);
|
||||
|
@ -42,9 +43,13 @@ describe('loopback model Image', () => {
|
|||
const collectionDir = await models.Image.getCollectionDir(collectionName);
|
||||
|
||||
expect(collectionDir).toEqual(`${STORAGE_IMAGE_USER}`);
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
});
|
||||
|
||||
it('should handle full size path', async() => {
|
||||
try {
|
||||
const {dstDir} = await models.Image.handleFolderDestination(obj.fileName);
|
||||
const collectionDir = await models.Image.getCollectionDir(collectionName);
|
||||
const _fullSizePath = models.Image.getFullSizePath(obj.fileName, collectionDir, dstDir);
|
||||
|
@ -53,6 +58,9 @@ describe('loopback model Image', () => {
|
|||
expect(fullSizePath).toEqual(`${STORAGE_IMAGE_USER}/${FULL_23_F2}`);
|
||||
expect(toFullSizePath).toEqual(`${STORAGE_IMAGE_USER}/${FULL_23_F2}/${nameItem}`);
|
||||
expect(toFullSizeOriginalPath).toEqual(`${STORAGE_IMAGE_USER}/full/${nameItem}`);
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
});
|
||||
|
||||
it('should resize', async() => {
|
||||
|
@ -71,10 +79,14 @@ describe('loopback model Image', () => {
|
|||
});
|
||||
|
||||
afterAll(async() => {
|
||||
try {
|
||||
await fs.unlink(`${STORAGE_IMAGE_USER}/full/${nameItem}`);
|
||||
|
||||
await fs.unlink(`${STORAGE_IMAGE_USER}/520x520/${nameItem}`);
|
||||
|
||||
await fs.unlink(`${STORAGE_IMAGE_USER}/1600x1600/${nameItem}`);
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE `hedera`.`imageConfig` ADD dirLevels INT UNSIGNED NOT NULL DEFAULT 2;
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('ImageConfig', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
Loading…
Reference in New Issue