Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin-5655: delete delegated consumer feature in BFF and in tenant process #1198

Open
wants to merge 22 commits into
base: feature/incaricato
Choose a base branch
from

Conversation

AsterITA
Copy link
Contributor

@AsterITA AsterITA commented Nov 12, 2024

Closes PIN-5655

Base automatically changed from feature/Incaricato-tenant_PIN-5653 to feature/incaricato November 12, 2024 15:22
Copy link
Collaborator

@ecamellini ecamellini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the Bruno file under /collections to test this API call? So you can test locally (if not already done) and attach a screenshot

@AsterITA
Copy link
Contributor Author

Could you add the Bruno file under /collections to test this API call? So you can test locally (if not already done) and attach a screenshot

I've added the files but I'm not able to test it locally because I would need the route to add the flag, which is not yet implemented

@AsterITA AsterITA marked this pull request as ready for review November 13, 2024 10:20
Copy link
Collaborator

@ecamellini ecamellini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just left a minor comment, after the local test as we discussed we can merge 🙏

Comment on lines 261 to 284
function isFeatureAssigned(
tenant: Tenant,
featureType: TenantFeature["type"]
): boolean {
return tenant.features.some((f) => f.type === featureType);
}

export function assertFeatureNotAssigned(
tenant: Tenant,
featureType: TenantFeature["type"]
): void {
if (isFeatureAssigned(tenant, featureType)) {
throw tenantAlreadyHasFeature(tenant.id, featureType);
}
}

export function assertFeatureAssigned(
tenant: Tenant,
featureType: TenantFeature["type"]
): void {
if (tenant.features.some((f) => f.type === "DelegatedProducer")) {
throw tenantAlreadyHasDelegatedProducerFeature(tenant.id);
if (!isFeatureAssigned(tenant, featureType)) {
throw tenantDoesNotHaveFeature(tenant.id, featureType);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1000x times better! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants