Skip to content

Commit 0c88411

Browse files
committed
chore: merge main into release for new releases
2 parents 249d57c + c92a416 commit 0c88411

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

apps/api/src/trust-portal/trust-portal.service.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,22 @@ export class TrustPortalService {
345345
);
346346
}
347347

348-
if (!trustRecord[config.enabledField]) {
348+
if (trustRecord[config.statusField] !== 'compliant') {
349349
throw new BadRequestException(
350-
`Framework ${framework} is not enabled for this organization`,
350+
`Framework ${framework} must be marked as compliant before uploading a certificate`,
351351
);
352352
}
353353

354-
if (trustRecord[config.statusField] !== 'compliant') {
355-
throw new BadRequestException(
356-
`Framework ${framework} must be marked as compliant before uploading a certificate`,
354+
// Auto-enable the framework if it's not already enabled (for backward compatibility with old organizations)
355+
if (!trustRecord[config.enabledField]) {
356+
await db.trust.update({
357+
where: { organizationId },
358+
data: {
359+
[config.enabledField]: true,
360+
},
361+
});
362+
this.logger.log(
363+
`Auto-enabled framework ${framework} for organization ${organizationId} during certificate upload`,
357364
);
358365
}
359366
}

bun.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307
"@types/jszip": "^3.4.1",
308308
"@upstash/ratelimit": "^2.0.5",
309309
"archiver": "^7.0.1",
310-
"better-auth": "^1.3.27",
310+
"better-auth": "^1.4.5",
311311
"class-variance-authority": "^0.7.1",
312312
"geist": "^1.3.1",
313313
"jszip": "^3.10.1",

0 commit comments

Comments
 (0)