refs #4975 Added call to last method in upload
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2023-01-09 18:28:09 +01:00
parent 2803de9445
commit f23eb9f4ad
1 changed files with 11 additions and 12 deletions

View File

@ -63,22 +63,13 @@ module.exports = Self => {
if (!existBranch)
throw new UserError('Not exist this branch');
let lastVersion = await models.MdbBranch.findOne({
where: {appName}
}, myOptions);
let lastMethod = await Self.last(ctx, appName, myOptions);
lastMethod.version++;
if (lastVersion++ != toVersion)
if (lastMethod.version != toVersion)
throw new UserError('Try again');
const userId = ctx.req.accessToken.userId;
models.MdbVersionTree.create({
app: appName,
version: toVersion,
branchFk: branch,
fromVersion,
userFk: userId
});
const tempContainer = await TempContainer.container('access');
const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);
const files = Object.values(uploaded.files).map(file => {
@ -121,6 +112,14 @@ module.exports = Self => {
}
}
await models.MdbVersionTree.create({
app: appName,
version: toVersion,
branchFk: branch,
fromVersion,
userFk: userId
}, myOptions);
await models.MdbVersion.upsert({
app: appName,
branchFk: branch,