feat: refs #6897 add EntryConfig model and enhance entry filtering with new parameters #3366
|
@ -24,7 +24,6 @@ module.exports = Self => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {userId};
|
const myOptions = {userId};
|
||||||
let tx;
|
let tx;
|
||||||
let result;
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
@ -32,12 +31,13 @@ module.exports = Self => {
|
||||||
tx = await Self.beginTransaction({});
|
tx = await Self.beginTransaction({});
|
||||||
myOptions.transaction = tx;
|
myOptions.transaction = tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = await Self.rawSql('CALL entry_clone(?)', [id], myOptions);
|
await Self.rawSql('CALL entry_clone(?, @newEntryId)', [id], myOptions);
|
||||||
|
const result = await Self.rawSql('SELECT @newEntryId', [], myOptions);
|
||||||
|
const newEntryId = result[0]['@newEntryId'];
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
return result[0];
|
return newEntryId;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Reference in New Issue