Skip to content

Commit

Permalink
solved payload validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RidhamShah committed Oct 11, 2023
1 parent a7dc072 commit e5903b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions backend/packages/Upgrade/src/api/DTO/ExperimentDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@ class ConditionPayloadValidator {
public payload: PayloadValidator;

@IsNotEmpty()
@IsString()
public parentCondition: string;
@ValidateNested()
@Type(() => ConditionValidator)
public parentCondition: ConditionValidator;

@IsOptional()
@IsString()
public decisionPoint?: string;
@ValidateNested()
@Type(() => PartitionValidator)
public decisionPoint?: PartitionValidator;
}

class MetricValidator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1265,8 +1265,8 @@ export class ExperimentService {
id: conditionPayload.id,
payloadType: conditionPayload.payload.type,
payloadValue: conditionPayload.payload.value,
parentCondition: conditions.find((doc) => doc.id === conditionPayload.parentCondition),
decisionPoint: partitions.find((doc) => doc.id === conditionPayload.decisionPoint),
parentCondition: conditions.find((doc) => doc.id === conditionPayload.parentCondition.id),
decisionPoint: partitions.find((doc) => doc.id === conditionPayload.decisionPoint.id),
};
return conditionPayloadToReturn;
})) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ export class ExperimentDesignStepperService {
conditionPayloads.push({
id: payloadRowData.id || uuidv4(),
payload: { type: PAYLOAD_TYPE.STRING, value: payloadRowData.payload },
parentCondition: parentCondition.id,
decisionPoint: decisionPoint.id,
parentCondition: parentCondition,
decisionPoint: decisionPoint,
});
});

Expand Down

0 comments on commit e5903b8

Please sign in to comment.