refactor: replace let for const
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ddd6d61d9e
commit
6e999302bf
|
@ -16,16 +16,14 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.deleteOldFiles = async options => {
|
||||
let tx;
|
||||
const tx = await Self.beginTransaction({});
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
if (!myOptions.transaction)
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const claimContainer = './storage/claim';
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('claim downloadFile()', () => {
|
||||
let dmsId = 7;
|
||||
const dmsId = 7;
|
||||
|
||||
it('should return a response for an employee with image content-type', async() => {
|
||||
let workerId = 1107;
|
||||
let ctx = {req: {accessToken: {userId: workerId}}};
|
||||
const workerId = 1107;
|
||||
const ctx = {req: {accessToken: {userId: workerId}}};
|
||||
const result = await app.models.Claim.downloadFile(ctx, dmsId);
|
||||
|
||||
expect(result[1]).toEqual('image/jpeg');
|
||||
|
|
|
@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server');
|
|||
|
||||
describe('claim uploadFile()', () => {
|
||||
it(`should return an error for a user without enough privileges`, async() => {
|
||||
let clientId = 1101;
|
||||
let ticketDmsTypeId = 14;
|
||||
let ctx = {req: {accessToken: {userId: clientId}}, args: {dmsTypeId: ticketDmsTypeId}};
|
||||
const clientId = 1101;
|
||||
const ticketDmsTypeId = 14;
|
||||
const ctx = {req: {accessToken: {userId: clientId}}, args: {dmsTypeId: ticketDmsTypeId}};
|
||||
|
||||
let error;
|
||||
await app.models.Claim.uploadFile(ctx).catch(e => {
|
||||
|
|
|
@ -57,16 +57,15 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.uploadFile = async(ctx, id, options) => {
|
||||
let tx;
|
||||
const tx = await Self.beginTransaction({});
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
if (!myOptions.transaction)
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
const models = Self.app.models;
|
||||
const promises = [];
|
||||
const TempContainer = models.TempContainer;
|
||||
|
|
Loading…
Reference in New Issue