Skip to content

Commit

Permalink
fix label status
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Kiryakov <[email protected]>
  • Loading branch information
Stepan-Kirjakov committed Jan 7, 2025
1 parent e0196ef commit 0ad1ef9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions guardian-service/src/api/policy-labels.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ export async function policyLabelsAPI(logger: PinoLogger): Promise<void> {
if (!item || item.owner !== owner.owner) {
return new MessageError('Item does not exist.');
}
if (item.status === EntityStatus.ACTIVE) {
return new MessageError('Item is active.');
if (item.status === EntityStatus.PUBLISHED) {
return new MessageError('Item is published.');
}

item.name = label.name;
Expand Down Expand Up @@ -295,8 +295,8 @@ export async function policyLabelsAPI(logger: PinoLogger): Promise<void> {
if (!item || item.owner !== owner.owner) {
return new MessageError('Item does not exist.');
}
if (item.status === EntityStatus.ACTIVE) {
return new MessageError('Item is active.');
if (item.status === EntityStatus.PUBLISHED) {
return new MessageError('Item is published.');
}
await DatabaseServer.removePolicyLabel(item);
return new MessageResponse(true);
Expand Down Expand Up @@ -326,7 +326,7 @@ export async function policyLabelsAPI(logger: PinoLogger): Promise<void> {
return new MessageError('Item does not exist.');
}
if (item.status === EntityStatus.PUBLISHED) {
return new MessageError(`Item is already active.`);
return new MessageError(`Item is already published.`);
}

const result = await publishPolicyLabel(item, owner, emptyNotifier(), logger);
Expand Down Expand Up @@ -358,7 +358,7 @@ export async function policyLabelsAPI(logger: PinoLogger): Promise<void> {
return new MessageError('Item does not exist.');
}
if (item.status === EntityStatus.PUBLISHED) {
return new MessageError(`Item is already active.`);
return new MessageError(`Item is already published.`);
}

const notifier = await initNotifier(task);
Expand Down

0 comments on commit 0ad1ef9

Please sign in to comment.