chore: pr feedbacks

This commit is contained in:
Nicolas Meienberger 2025-12-29 18:13:53 +01:00 committed by Nico
parent 18d767a406
commit beda5a4008
2 changed files with 10 additions and 2 deletions

View file

@ -405,7 +405,7 @@ export const deleteSnapshotDto = describeRoute({
* Delete multiple snapshots * Delete multiple snapshots
*/ */
export const deleteSnapshotsBody = type({ export const deleteSnapshotsBody = type({
snapshotIds: "string[]", snapshotIds: "string[]>=1",
}); });
export const deleteSnapshotsResponse = type({ export const deleteSnapshotsResponse = type({
@ -434,7 +434,7 @@ export const deleteSnapshotsDto = describeRoute({
* Tag multiple snapshots * Tag multiple snapshots
*/ */
export const tagSnapshotsBody = type({ export const tagSnapshotsBody = type({
snapshotIds: "string[]", snapshotIds: "string[]>=1",
add: "string[]?", add: "string[]?",
remove: "string[]?", remove: "string[]?",
set: "string[]?", set: "string[]?",

View file

@ -571,6 +571,10 @@ const deleteSnapshots = async (config: RepositoryConfig, snapshotIds: string[])
const repoUrl = buildRepoUrl(config); const repoUrl = buildRepoUrl(config);
const env = await buildEnv(config); const env = await buildEnv(config);
if (snapshotIds.length === 0) {
throw new Error("No snapshot IDs provided for deletion.");
}
const args: string[] = ["--repo", repoUrl, "forget", ...snapshotIds, "--prune"]; const args: string[] = ["--repo", repoUrl, "forget", ...snapshotIds, "--prune"];
addCommonArgs(args, env); addCommonArgs(args, env);
@ -597,6 +601,10 @@ const tagSnapshots = async (
const repoUrl = buildRepoUrl(config); const repoUrl = buildRepoUrl(config);
const env = await buildEnv(config); const env = await buildEnv(config);
if (snapshotIds.length === 0) {
throw new Error("No snapshot IDs provided for tagging.");
}
const args: string[] = ["--repo", repoUrl, "tag", ...snapshotIds]; const args: string[] = ["--repo", repoUrl, "tag", ...snapshotIds];
if (tags.add) { if (tags.add) {