File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
apps/api/src/trust-portal Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 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",
You can’t perform that action at this time.
0 commit comments