fix: refs #6897 update entry_clone method to return newEntryId instead of result
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2025-02-10 11:40:54 +01:00
parent 2f0cd27ed8
commit 6110295cc2
1 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,6 @@ module.exports = Self => {
const userId = ctx.req.accessToken.userId;
const myOptions = {userId};
let tx;
let result;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -32,12 +31,13 @@ module.exports = Self => {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
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();
return result[0];
return newEntryId;
} catch (e) {
if (tx) await tx.rollback();
throw e;