PKI revamp: general improvements

This commit is contained in:
Carlos Monastyrski
2025-10-17 15:47:41 -03:00
parent 4f23e6dc53
commit e195afba11
34 changed files with 601 additions and 579 deletions
@@ -116,7 +116,7 @@ export const certificateProfileServiceFactory = ({
const existingSlugProfile = await certificateProfileDAL.findBySlugAndProjectId(data.slug, projectId);
if (existingSlugProfile) {
throw new ForbiddenRequestError({
message: "Certificate profile with this slug already exists in project"
message: "Certificate profile with this name already exists in project"
});
}
@@ -245,7 +245,7 @@ export const certificateProfileServiceFactory = ({
);
if (conflictingProfile && conflictingProfile.id !== profileId) {
throw new ForbiddenRequestError({
message: "Certificate profile with this slug already exists in project"
message: "Certificate profile with this name already exists in project"
});
}
}
@@ -521,14 +521,6 @@ export const certificateProfileServiceFactory = ({
ProjectPermissionSub.CertificateProfiles
);
// Check if profile is in use by any certificates
const isInUse = await certificateProfileDAL.isProfileInUse(profileId);
if (isInUse) {
throw new ForbiddenRequestError({
message: "Cannot delete certificate profile that has issued certificates"
});
}
const deletedProfile = await certificateProfileDAL.deleteById(profileId);
if (!deletedProfile) {
throw new NotFoundError({ message: "Failed to delete certificate profile" });