Skip to content

Commit

Permalink
Merge branch 'dev' into feature/static-mark-status-enums
Browse files Browse the repository at this point in the history
  • Loading branch information
danoswaltCL authored Jul 6, 2023
2 parents f092b8f + 639b3ee commit 5c563ef
Show file tree
Hide file tree
Showing 37 changed files with 2,598 additions and 288 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ module.exports = {
'plugins': [
"@typescript-eslint",
'@angular-eslint/eslint-plugin',
'eslint-plugin-tsdoc',
'prettier'
],
'root': true,
'rules': {
'tsdoc/syntax': 'warn',
'@angular-eslint/component-class-suffix': 'error',
'@angular-eslint/directive-class-suffix': 'error',
'@angular-eslint/no-input-rename': 'error',
Expand Down
166 changes: 139 additions & 27 deletions backend/packages/Upgrade/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { env } from '../../env';
import { MonitoredDecisionPointLog } from '../models/MonitoredDecisionPointLog';
import { MarkExperimentValidatorv4 } from './validators/MarkExperimentValidator.v4';
import { Log } from '../models/Log';
import { flatten } from '@nestjs/common';
import { CaliperLogEnvelope } from './validators/CaliperLogEnvelope';

interface IMonitoredDecisionPoint {
id: string;
Expand Down Expand Up @@ -633,6 +635,53 @@ export class ExperimentClientController {
});
}

/**
* @swagger
* /log/caliper:
* post:
* description: Post Caliper format log data
* consumes:
* - application/json
* parameters:
* - in: body
* name: data
* required: true
* description: User Document
* tags:
* - Client Side SDK
* produces:
* - application/json
* responses:
* '200':
* description: Log data
* '500':
* description: null value in column "id\" of relation \"experiment_user\" violates not-null constraint
*/
@Post('log/caliper')
public async caliperLog(
@Body({ validate: { validationError: { target: false, value: false } } })
@Req()
request: AppRequest,
envelope: CaliperLogEnvelope
): Promise<Log[]> {
const result = envelope.data.map(async (log) => {
// getOriginalUserDoc call for alias
const experimentUserDoc = await this.getUserDoc(log.object.assignee.id, request.logger);
if (experimentUserDoc) {
// append userDoc in logger
request.logger.child({ userDoc: experimentUserDoc });
request.logger.info({ message: 'Got the original user doc' });
}
return this.experimentAssignmentService.caliperDataLog(log, {
logger: request.logger,
userDoc: experimentUserDoc,
});
});

const logsToReturn = await Promise.all(result);
return flatten(logsToReturn);
}

/**
* @swagger
* /bloblog:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class ExperimentAssignmentService {
if (!experimentId) {
if (filteredExperiments.length > 1) {
const random = seedrandom(userId)();
experimentId = filteredExperiments[Math.floor(random * experiments.length)].id;
experimentId = filteredExperiments[Math.floor(random * filteredExperiments.length)].id;
} else {
experimentId = filteredExperiments[0]?.id;
}
Expand Down
1 change: 0 additions & 1 deletion clientlibs/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.30.1</version>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
Expand Down
Loading

0 comments on commit 5c563ef

Please sign in to comment.