laster 0.0.2
This commit is contained in:
@@ -1096,6 +1096,43 @@ async function addPackageVersion(input) {
|
||||
return versionId;
|
||||
}
|
||||
|
||||
async function replacePackageVersionArtifact(input) {
|
||||
const pool = await getPool();
|
||||
const result = await pool.request()
|
||||
.input('PackageId', sql.UniqueIdentifier, input.packageId)
|
||||
.input('Version', sql.NVarChar(50), input.version)
|
||||
.input('FilePath', sql.NVarChar(1000), input.filePath || null)
|
||||
.input('DockerImage', sql.NVarChar(500), input.dockerImage || null)
|
||||
.input('FileChecksumSha256', sql.Char(64), input.checksum || null)
|
||||
.input('FileSizeBytes', sql.BigInt, input.fileSizeBytes || null)
|
||||
.input('ChangeLog', sql.NVarChar(sql.MAX), input.changeLog || null)
|
||||
.input('ReleaseDate', sql.DateTime2, input.releaseDate ? new Date(input.releaseDate) : new Date())
|
||||
.query(`
|
||||
UPDATE dbo.PackageVersions
|
||||
SET FilePath = @FilePath,
|
||||
DockerImage = @DockerImage,
|
||||
FileChecksumSha256 = @FileChecksumSha256,
|
||||
FileSizeBytes = @FileSizeBytes,
|
||||
ChangeLog = COALESCE(@ChangeLog, ChangeLog),
|
||||
ReleaseDate = @ReleaseDate,
|
||||
UploadedAt = SYSUTCDATETIME(),
|
||||
IsDeprecated = 0
|
||||
OUTPUT inserted.Id
|
||||
WHERE PackageId = @PackageId
|
||||
AND Version = @Version;
|
||||
`);
|
||||
|
||||
const row = result.recordset[0];
|
||||
if (!row) return null;
|
||||
|
||||
const versionId = String(row.Id);
|
||||
await pool.request()
|
||||
.input('PackageVersionId', sql.UniqueIdentifier, versionId)
|
||||
.execute('dbo.SetLatestPackageVersion');
|
||||
|
||||
return versionId;
|
||||
}
|
||||
|
||||
async function deletePackage(packageId) {
|
||||
const pool = await getPool();
|
||||
const transaction = new sql.Transaction(pool);
|
||||
@@ -1369,6 +1406,7 @@ module.exports = {
|
||||
getApplicationById,
|
||||
createPackageWithVersion,
|
||||
addPackageVersion,
|
||||
replacePackageVersionArtifact,
|
||||
deletePackage,
|
||||
setLatestPackageVersion,
|
||||
deletePackageVersion,
|
||||
|
||||
Reference in New Issue
Block a user