Skip to content

Commit aef3b58

Browse files
committed
refactor(requirements): update SOC2 framework and requirement identifiers to new format
- Replaced all instances of the "soc2" frameworkId and its associated requirementIds with new string identifiers across multiple files. - Added new mappings for framework and requirement IDs in the requirements data file to ensure consistency and compatibility with recent schema changes. - Enhanced logging in the createFrameworkInstance function for better debugging and tracking of control creation processes. - Resolves COMP-125
1 parent 103e778 commit aef3b58

File tree

4 files changed

+167
-157
lines changed

4 files changed

+167
-157
lines changed

apps/app/src/actions/organization/lib/utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ export async function createFrameworkInstance(
135135
),
136136
);
137137

138+
console.log("frameworkControls", frameworkControls);
139+
138140
// Prepare data for batch control creation
139141
const controlsToCreate = frameworkControls.map((control) => ({
140142
organizationId,
@@ -143,6 +145,8 @@ export async function createFrameworkInstance(
143145
// We connect frameworkInstances later or handle differently if createMany doesn't support relation connection easily
144146
}));
145147

148+
console.log("controlsToCreate", controlsToCreate);
149+
146150
// Batch create controls if there are any to create
147151
if (controlsToCreate.length > 0) {
148152
await prisma.control.createMany({
@@ -162,6 +166,8 @@ export async function createFrameworkInstance(
162166
select: { id: true, name: true }, // Select only necessary fields
163167
});
164168

169+
console.log("createdOrFoundDbControls", createdOrFoundDbControls);
170+
165171
// Connect the controls to the framework instance
166172
if (createdOrFoundDbControls.length > 0) {
167173
await prisma.frameworkInstance.update({
@@ -258,7 +264,7 @@ export async function createRequirementMaps(
258264
requirementMapsToCreate.push({
259265
controlId: control.id,
260266
frameworkInstanceId: frameworkInstance.id,
261-
requirementId: `${frameworkInstance.frameworkId}_${requirement.requirementId}`,
267+
requirementId: requirement.requirementId,
262268
});
263269
}
264270
}

0 commit comments

Comments
 (0)