-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: feature/incaricato
Are you sure you want to change the base?
Conversation
Co-authored-by: Eric Camellini <[email protected]>
There was a problem hiding this 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
…/pagopa/interop-be-monorepo into PIN-5655_deleteDelegatedConsumer
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 |
There was a problem hiding this 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 🙏
Co-authored-by: Eric Camellini <[email protected]>
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); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1000x times better! 😁
Closes PIN-5655