Skip to content

Commit 39673fb

Browse files
authored
Merge branch 'main' into tofik/error-fix-upload-docs-for-old-orgs
2 parents 9f66f0a + c6570c3 commit 39673fb

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [1.68.1](https://github.com/trycompai/comp/compare/v1.68.0...v1.68.1) (2025-12-08)
2+
3+
4+
### Bug Fixes
5+
6+
* **trust:** old org upload certificate problems ([#1871](https://github.com/trycompai/comp/issues/1871)) ([c92a416](https://github.com/trycompai/comp/commit/c92a416161cdd2fe66a885f60a0de96f6a57c132))
7+
18
# [1.68.0](https://github.com/trycompai/comp/compare/v1.67.1...v1.68.0) (2025-12-05)
29

310

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)