From 1b540ff4c3501e6a3596db62200e1b652569e8b8 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 May 2021 15:32:14 +0300 Subject: [PATCH 01/83] Allow closing pureV5 tasks without activation --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f2a00536..41d0effd 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1306,7 +1306,7 @@ async function update (currentUser, challengeId, data, isFull) { } } if (data.status === constants.challengeStatuses.Completed) { - if (challenge.status !== constants.challengeStatuses.Active) { + if (!_.get(challenge, 'legacy.pureV5Task') && challenge.status !== constants.challengeStatuses.Active) { throw new errors.BadRequestError('You cannot mark a Draft challenge as Completed') } } From a385bf9a527c0f55b007ef8be8d87c1ff51f92cf Mon Sep 17 00:00:00 2001 From: gauravseta Date: Thu, 27 May 2021 16:49:14 +0530 Subject: [PATCH 02/83] issue 416 fix] --- src/services/ChallengeService.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 4ab79a71..cd7df6f3 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1055,7 +1055,8 @@ createChallenge.schema = { reviewScorecardId: Joi.number().integer(), isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), - pureV5Task: Joi.boolean() + pureV5Task: Joi.boolean(), + pureV5: Joi.boolean(), }), billing: Joi.object().keys({ billingAccountId: Joi.string(), @@ -1323,6 +1324,9 @@ async function update (currentUser, challengeId, data, isFull) { if (_.get(challenge, 'legacy.pureV5Task') && _.get(data, 'legacy.pureV5Task') && _.get(challenge, 'legacy.pureV5Task') !== _.get(data, 'legacy.pureV5Task')) { throw new errors.ForbiddenError('Cannot change legacy.pureV5Task') } + if (_.get(challenge, 'legacy.pureV5') && _.get(data, 'legacy.pureV5') && _.get(challenge, 'legacy.pureV5') !== _.get(data, 'legacy.pureV5')) { + throw new errors.ForbiddenError('Cannot change legacy.pureV5') + } if (!_.isUndefined(challenge.legacy) && !_.isUndefined(data.legacy)) { _.extend(challenge.legacy, data.legacy) @@ -1771,7 +1775,8 @@ function sanitizeChallenge (challenge) { 'reviewScorecardId', 'isTask', 'useSchedulingAPI', - 'pureV5Task' + 'pureV5Task', + 'pureV5' ]) } if (challenge.billing) { @@ -1837,7 +1842,8 @@ fullyUpdateChallenge.schema = { reviewScorecardId: Joi.number().integer(), isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), - pureV5Task: Joi.boolean() + pureV5Task: Joi.boolean(), + pureV5: Joi.boolean() }).unknown(true), billing: Joi.object().keys({ billingAccountId: Joi.string(), @@ -1938,7 +1944,8 @@ partiallyUpdateChallenge.schema = { forumId: Joi.number().integer(), isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), - pureV5Task: Joi.boolean() + pureV5Task: Joi.boolean(), + pureV5: Joi.boolean() }).unknown(true), task: Joi.object().keys({ isTask: Joi.boolean().default(false), From d266b449c6b1fe94a562f75ac5360094a8ee483c Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 27 May 2021 18:32:09 +0300 Subject: [PATCH 03/83] minor fixes on pureV5 flag --- src/services/ChallengeService.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index cd7df6f3..9df9b61c 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -902,7 +902,7 @@ async function createChallenge (currentUser, challenge) { throw new errors.BadRequestError('You cannot create an Active challenge. Please create a Draft challenge and then change the status to Active.') } const { directProjectId } = await helper.ensureProjectExist(challenge.projectId, currentUser) - if (_.get(challenge, 'legacy.pureV5Task')) { + if (_.get(challenge, 'legacy.pureV5Task') || _.get(challenge, 'legacy.pureV5')) { _.set(challenge, 'legacy.directProjectId', directProjectId) } const { track, type } = await validateChallengeData(challenge) @@ -1292,7 +1292,7 @@ async function update (currentUser, challengeId, data, isFull) { } if (data.status) { if (data.status === constants.challengeStatuses.Active) { - if (!_.get(challenge, 'legacy.pureV5Task') && _.isUndefined(_.get(challenge, 'legacyId'))) { + if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && _.isUndefined(_.get(challenge, 'legacyId'))) { throw new errors.BadRequestError('You cannot activate the challenge as it has not been created on legacy yet. Please try again later or contact support.') } // if activating a challenge, the challenge must have a billing account id @@ -1302,7 +1302,7 @@ async function update (currentUser, challengeId, data, isFull) { } } if (data.status === constants.challengeStatuses.Completed) { - if (!_.get(challenge, 'legacy.pureV5Task') && challenge.status !== constants.challengeStatuses.Active) { + if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { throw new errors.BadRequestError('You cannot mark a Draft challenge as Completed') } } From 47706763e578f2dda584b1e4d55ee27144a1b71e Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 4 Jun 2021 16:46:21 +0300 Subject: [PATCH 04/83] update swagger and postman --- Verification.md | 13 +- docs/swagger.yaml | 3204 +- ...oder-challenge-api.postman_collection.json | 25644 +++------------- ...der-challenge-api.postman_environment.json | 254 +- 4 files changed, 5802 insertions(+), 23313 deletions(-) diff --git a/Verification.md b/Verification.md index ca8874f7..7105194f 100644 --- a/Verification.md +++ b/Verification.md @@ -1,10 +1,13 @@ # TopCoder Challenge API Verification -## Postman tests -- clear the environment, run command `npm run init-db` and `npm run init-es force` -- import Postman collection and environment in the docs folder to Postman -- run tests from up to down in order -- You need to run command `npm run sync-es` before you run `Challenges/get challenge` and `Challenges/search challenge` test case. +## E2E Postman tests +- Import Postman collection and environment in the docs folder to Postman +- Set `token` variable in environment variables folder +- Open Runner +- Put E2E Test Folder inside Runner +- Set `Delay` to 2000ms +- Check `Save Responses` +- Start Run ## DynamoDB Verification Run command `npm run view-data ` to view table data, ModelName can be `Challenge`, `ChallengeType`, `AuditLog`, `Phase`, `TimelineTemplate`, `Attachment` or `ChallengeTimelineTemplate` diff --git a/docs/swagger.yaml b/docs/swagger.yaml index bb38ec8d..2c95a65a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,4 @@ -swagger: '2.0' +swagger: "2.0" info: version: 1.0.0 title: Challenge V5 API @@ -53,188 +53,144 @@ paths: - Challenges description: | Retrieve challenges in the system. + security: + - bearer: [] produces: - application/json parameters: - - $ref: '#/parameters/page' - - $ref: '#/parameters/perPage' + - $ref: "#/parameters/page" + - $ref: "#/parameters/perPage" - name: id in: query - description: 'Filter by id, exact match' + description: Filter by id, exact match required: false type: string format: UUID - name: confidentialityType in: query description: Filter by confidentialityType + required: false type: string - enum: - - public - - private + enum: [public, private] - name: directProjectId in: query description: Filter by directProjectId - type: integer - - name: type - in: query - description: >- - Filter by type abbreviation, exact match. If provided, the typeId - will be ignored required: false - type: string - - name: types + type: integer + - name: typeIds in: query - description: >- - Filter by multiple type abbreviation, exact match. If types is provided, typeIds will be - ignored + description: Filter by multiple type IDs, exact match. required: false type: array items: type: string - - name: typeIds + format: UUID + - name: trackIds in: query - description: >- - Filter by multiple type IDs, exact match. + description: Filter by multiple track IDs, exact match. required: false type: array items: type: string - - name: tracks + format: UUID + - name: types in: query - description: >- - Filter by multiple track abbreviation, exact match. If types is provided, trackIds will be - ignored + description: Filter by multiple type abbreviation, exact match. If types is provided, typeIds will be ignored required: false type: array items: type: string - - name: trackIds + - name: tracks in: query - description: >- - Filter by multiple track IDs, exact match. + description: Filter by multiple track abbreviation, exact match. If tracks is provided, trackIds will be ignored required: false type: array items: type: string - name: typeId in: query - description: >- - Filter by type id, exact match. If type is provided, typeId will be - ignored + description: Filter by type id, exact match. If type is provided, typeId will be ignored required: false type: string format: UUID - - name: track + - name: trackId in: query - description: 'Filter by track, case-insensitive, partial matches are allowed.' + description: Filter by track id, exact match. If track is provided, trackId will be ignored required: false type: string - - name: trackId + format: UUID + - name: type in: query - description: >- - Filter by track id, exact match. If track is provided, trackId will - be ignored + description: Filter by type abbreviation, exact match. If provided, the typeId will be ignored required: false type: string - format: UUID - - name: search + - name: track in: query - description: >- - Filter by name, description and tags fields, - case-insensitive, partial matches are allowed. + description: Filter by track, case-insensitive, partial matches are allowed. required: false type: string - name: name in: query - description: 'Filter by name, case-insensitive, partial matches are allowed.' + description: Filter by name, case-insensitive, partial matches are allowed. If search is provided, name will be ignored + required: false + type: string + - name: search + in: query + description: Filter by name, description and tags fields, case-insensitive, partial matches are allowed. If search is provided, name and description will be ignored. required: false type: string - name: description in: query - description: >- - Filter by description, case-insensitive, partial matches are - allowed. + description: Filter by description, case-insensitive, partial matches are allowed. If search is provided, description will be ignored. required: false type: string - name: timelineTemplateId in: query - description: 'Filter by timeline template id, exact match' + description: Filter by timeline template id, exact match required: false type: string - format: UUID - name: reviewType in: query - description: >- - Filter by review type, case-insensitive, partial matches are - allowed. + description: Filter by review type, case-insensitive, partial matches are allowed. required: false type: string - name: tag in: query - description: 'Filter by tag name, case-insensitive, partial matches are allowed.' + description: Filter by tag name, case-insensitive, partial matches are allowed. required: false type: string - name: tags in: query - description: >- - Filter by multiple tag names, case-insensitive, partial matches are - allowed. + description: Filter by multiple tag names, case-insensitive, partial matches are allowed. required: false type: array items: type: string - name: includeAllTags in: query - description: >- - Require all provided tags to be present on a challenge for a match - required: false - default: true - type: boolean - - name: totalPrizesFrom - in: query - description: >- - Filter by the lowest amount of total prizes on the challenge - type: number - required: false - - name: totalPrizesTo - in: query - description: >- - Filter by the highest amount of total prizes on the challenge - type: number - required: false - - name: events - in: query - description: >- - Filter by multiple event keys (ie: tco21) - required: false - type: array - items: - type: number - - name: includeAllEvents - in: query - description: >- - Require all provided events to be present on a challenge for a match + description: Require all provided tags to be present on a challenge for a match. required: false default: true type: boolean - name: projectId in: query - description: 'Filter by v5 project id, exact match.' + description: Filter by v5 project id, exact match. required: false type: integer + minimum: 1 - name: forumId in: query - description: 'Filter by forum id, exact match.' + description: Filter by forum id, exact match. required: false type: integer - name: legacyId in: query - description: 'Filter by legacy id, exact match.' + description: Filter by legacy id, exact match. required: false type: integer - name: status in: query - description: 'Filter by status, case-insensitive, partial matches are allowed.' + description: Filter by status, case-insensitive, exact match. required: false type: string enum: @@ -243,19 +199,17 @@ paths: - Cancelled - Active - Completed - - name: currentPhaseId - in: query - description: Filter by id of the current phase - required: false - type: string - - name: currentPhaseName - in: query - description: Filter by name of the current phase - required: false - type: string + - Deleted + - Cancelled - Failed Review + - Cancelled - Failed Screening + - Cancelled - Zero Submissions + - Cancelled - Winner Unresponsive + - Cancelled - Client Request + - Cancelled - Requirements Infeasible + - Cancelled - Zero Registrations - name: group in: query - description: 'Filter by group name, case-insensitive, partial matches are allowed.' + description: Filter by group name, case-insensitive, partial matches are allowed. required: false type: string - name: startDateStart @@ -264,108 +218,120 @@ paths: required: false type: string format: date-time - - name: registrationStartDateStart + - name: startDateEnd in: query - description: Filter by registration start date (lower bound of date range) + description: Filter by start date (upper bound of date range) required: false type: string format: date-time - - name: registrationStartDateEnd + - name: endDateStart in: query - description: Filter by registration start date (upper bound of date range) + description: Filter by end date (lower bound of date range) required: false type: string format: date-time - - name: registrationEndDateStart + - name: endDateEnd in: query - description: Filter by registration end date (lower bound of date range) + description: Filter by end date (upper bound of date range) required: false type: string format: date-time - - name: registrationEndDateEnd + - name: currentPhaseName in: query - description: Filter by registration end date (upper bound of date range) + description: Filter by name of the current phase + required: false + type: string + - name: createdDateStart + in: query + description: Filter by created date (lower bound of date range) required: false type: string format: date-time - - name: submissionStartDateStart + - name: createdDateEnd in: query - description: Filter by submission start date (lower bound of date range) + description: Filter by created date (upper bound of date range) required: false type: string format: date-time - - name: submissionStartDateEnd + - name: updatedDateStart in: query - description: Filter by submission start date (upper bound of date range) + description: Filter by updated date (lower bound of date range) required: false type: string format: date-time - - name: submissionEndDateStart + - name: updatedDateEnd in: query - description: Filter by submission end date (lower bound of date range) + description: Filter by updated date (upper bound of date range) required: false type: string format: date-time - - name: submissionEndDateEnd + - name: registrationStartDateStart in: query - description: Filter by submission end date (upper bound of date range) + description: Filter by registration start date (lower bound of date range) required: false type: string format: date-time - - name: startDateEnd + - name: registrationStartDateEnd in: query - description: Filter by start date (upper bound of date range) + description: Filter by registration start date (upper bound of date range) required: false type: string format: date-time - - name: endDateStart + - name: registrationEndDateStart in: query - description: Filter by end date (lower bound of date range) + description: Filter by registration end date (lower bound of date range) required: false type: string format: date-time - - name: endDateEnd + - name: registrationEndDateEnd in: query - description: Filter by end date (upper bound of date range) + description: Filter by registration end date (upper bound of date range) required: false type: string format: date-time - - name: createdDateStart + - name: submissionStartDateStart in: query - description: Filter by created date (lower bound of date range) + description: Filter by submission start date (lower bound of date range) required: false type: string format: date-time - - name: createdDateEnd + - name: submissionStartDateEnd in: query - description: Filter by created date (upper bound of date range) + description: Filter by submission start date (upper bound of date range) required: false type: string format: date-time - - name: updatedDateStart + - name: submissionEndDateStart in: query - description: Filter by updated date (lower bound of date range) + description: Filter by submission end date (lower bound of date range) required: false type: string format: date-time - - name: updatedDateEnd + - name: submissionEndDateEnd in: query - description: Filter by updated date (upper bound of date range) + description: Filter by submission end date (upper bound of date range) required: false type: string format: date-time - name: createdBy in: query - description: >- - Filter by 'createdBy' field, case-insensitive, partial matches are - allowed. + description: Filter by 'createdBy' field, case-insensitive, partial matches are allowed. required: false type: string - name: updatedBy in: query - description: >- - Filter by 'updatedBy' field, case-insensitive, partial matches are - allowed. + description: Filter by 'updatedBy' field, case-insensitive, partial matches are allowed. + required: false + type: string + - name: isLightweight + in: query + description: Turn off description and privateDescription for a smaller response payload + required: false + type: boolean + default: false + - name: memberId + in: query + description: Filter challenges memberId has access to required: false type: string - name: sortBy @@ -373,62 +339,82 @@ paths: description: Sort the results by the field. required: false type: string + enum: + [ + updatedBy, + updated, + createdBy, + created, + endDate, + startDate, + projectId, + name, + typeId, + overview.totalPrizes, + ] - name: sortOrder in: query description: Order the results by the asc/desc. required: false type: string - - name: isLightweight - in: query - description: >- - Turn off description and privateDescription for a smaller response - payload - required: false - type: boolean - default: false + enum: [asc, desc] - name: isTask in: query - description: >- - Filter based on the task.isTask property. - Only available for admins/m2m. - Will be ignored for regular users or not authenticated users + description: Filter based on the task.isTask property. Only available for admins/m2m. Will be ignored for regular users or not authenticated users required: false type: boolean - default: false - name: taskIsAssigned in: query - description: >- - Filter based on the task.isAssigned property. - Only available for admins/m2m. - Will be ignored for regular users or not authenticated users + description: Filter based on the task.isAssigned property. Only available for admins/m2m. Will be ignored for regular users or not authenticated users required: false type: boolean - default: false - name: taskMemberId in: query - description: >- - Filter based on the task.memberId property. - Only available for admins/m2m. - Will be ignored for regular users or not authenticated users + description: Filter based on the task.memberId property. Only available for admins/m2m. Will be ignored for regular users or not authenticated users required: false type: string + - name: events + in: query + description: Filter by multiple event keys (tco21) + required: false + type: array + items: + type: string + - name: includeAllEvents + in: query + description: Require all provided events to be present on a challenge for a match + required: false + default: true + type: boolean - name: useSchedulingAPI in: query description: Search based on `legacy.useSchedulingAPI` type: boolean required: false + - name: totalPrizesFrom + in: query + description: Filter by the lowest amount of total prizes on the challenge + type: number + required: false + minimum: 0 + - name: totalPrizesTo + in: query + description: Filter by the highest amount of total prizes on the challenge + type: number + required: false + minimum: 0 - in: body name: body required: false schema: - $ref: '#/definitions/SearchChallengeRequestBody' + $ref: "#/definitions/SearchChallengeRequestBody" responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/Challenge' + $ref: "#/definitions/Challenge" headers: X-Next-Page: type: integer @@ -451,19 +437,18 @@ paths: Link: type: string description: Pagination link header. - '400': - description: Bad request. Request parameters were invalid. + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" post: tags: - Challenges - description: | - Create a new challenge in the system. + description: Create a new challenge in the system. security: - bearer: [] produces: @@ -473,35 +458,39 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeRequestBody' + $ref: "#/definitions/ChallengeRequestBodyForCreate" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeResponseBodyForCreateOrUpdate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Challenge" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the challenge + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the challenge schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "404": + description: Not found. Timeline Template is not found schema: - $ref: '#/definitions/ErrorModel' - '/challenges/{challengeId}': + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/ErrorModel" + /challenges/{challengeId}: get: tags: - Challenges description: Retrieve the Challenge with provided challenge id. + security: + - bearer: [] produces: - application/json parameters: @@ -512,22 +501,26 @@ paths: format: UUID description: The id of challenge to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/Challenge' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Challenge" + "400": + description: Bad request. Request parameters were invalid. + schema: + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to wiew the challenge schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - Challenges @@ -547,40 +540,36 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeRequestBody' + $ref: "#/definitions/ChallengeRequestBodyForFullyUpdate" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeResponseBodyForCreateOrUpdate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Challenge" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" patch: tags: - Challenges - description: > - Partially update the challenge with the provided id. Only the fields - that are provided in the body will be changed. + description: Partially update the challenge with the provided id. Only the fields that are provided in the body will be changed. security: - bearer: [] produces: @@ -596,39 +585,36 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeRequestBody' + $ref: "#/definitions/ChallengeRequestBodyForPartiallyUpdate" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeResponseBodyForCreateOrUpdate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Challenge" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge. + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge. schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" delete: tags: - Challenges - description: > - Delete the challenge with the provided id. + description: Delete the challenge with the provided id. Only challenges with status of "New" can be deleted. security: - bearer: [] @@ -640,53 +626,50 @@ paths: required: true type: string format: UUID - description: The id of challenge to update + description: The id of challenge to delete responses: - '200': + "200": description: Deleted - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Challenge' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Challenge" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge. + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge. schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /challenge-types: get: tags: - ChallengeTypes - description: | - Retrieve challenge types in the system. + description: Retrieve challenge types in the system. produces: - application/json parameters: - - $ref: '#/parameters/page' - - $ref: '#/parameters/perPage' + - $ref: "#/parameters/page" + - $ref: "#/parameters/perPage100" - name: name in: query - description: 'Filter by name, case-insensitive, partial matches are allowed.' + description: Filter by name, case-insensitive, partial matches are allowed. required: false type: string - name: description in: query - description: Filter by description. Partial matches are allowed. + description: Filter by description. Partial matches are allowed. required: false type: string - name: isActive @@ -694,18 +677,24 @@ paths: description: Filter by isActive flag. required: false type: boolean + - name: isTask + in: query + description: Filter by isTask flag. + required: false + type: boolean + default: false - name: abbreviation in: query - description: Filter by abbreviation. Partial matches are allowed. + description: Filter by abbreviation. Partial matches are allowed. required: false type: string responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/ChallengeType' + $ref: "#/definitions/ChallengeType" headers: X-Next-Page: type: integer @@ -728,19 +717,18 @@ paths: Link: type: string description: Pagination link header. - '400': + "400": description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" post: tags: - ChallengeTypes - description: | - Create a new challenge type in the system. + description: Create a new challenge type in the system. security: - bearer: [] produces: @@ -750,37 +738,33 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTypeData' + $ref: "#/definitions/ChallengeTypeData" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeType' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeType" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the challenge type + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the challenge type schema: - $ref: '#/definitions/ErrorModel' - '409': - description: > - Conflict. Other challenge type has already used the same name, - abbreviation or legacyId. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge type has already used the same name or abbreviation. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/challenge-types/{challengeTypeId}': + $ref: "#/definitions/ErrorModel" + /challenge-types/{challengeTypeId}: get: tags: - ChallengeTypes @@ -795,22 +779,22 @@ paths: format: UUID description: The id of challenge type to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/ChallengeType' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeType" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge type not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - ChallengeTypes @@ -830,46 +814,40 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTypeData' + $ref: "#/definitions/ChallengeTypeData" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeType' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeType" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge type + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge type schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge type not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: > - Conflict. Other challenge type has already used the same name, - abbreviation or legacyId. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge type has already used the same name or abbreviation. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" patch: tags: - ChallengeTypes - description: > - Partially update the challenge type with specified id. Only the fields - that are provided will be updated. + description: Partially update the challenge type with specified id. Only the fields that are provided will be updated. security: - bearer: [] produces: @@ -885,59 +863,54 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTypeData' + $ref: "#/definitions/ChallengeTypeDataPatch" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeType' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeType" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge type + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge type schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge type not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: > - Conflict. Other challenge type has already used the same name, - abbreviation or legacyId. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge type has already used the same name or abbreviation. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /challenge-tracks: get: tags: - ChallengeTracks - description: | - Retrieve challenge tracks in the system. + description: Retrieve challenge tracks in the system. produces: - application/json parameters: - - $ref: '#/parameters/page' - - $ref: '#/parameters/perPage' + - $ref: "#/parameters/page" + - $ref: "#/parameters/perPage100" - name: name in: query - description: 'Filter by name, case-insensitive, partial matches are allowed.' + description: Filter by name, case-insensitive, partial matches are allowed. required: false type: string - name: description in: query - description: Filter by description. Partial matches are allowed. + description: Filter by description. Partial matches are allowed. required: false type: string - name: isActive @@ -947,16 +920,16 @@ paths: type: boolean - name: abbreviation in: query - description: Filter by abbreviation. Partial matches are allowed. + description: Filter by abbreviation. Partial matches are allowed. required: false type: string responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/ChallengeTrack' + $ref: "#/definitions/ChallengeTrack" headers: X-Next-Page: type: integer @@ -979,19 +952,18 @@ paths: Link: type: string description: Pagination link header. - '400': - description: Bad request. Request parameters were invalid. + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" post: tags: - ChallengeTracks - description: | - Create a new challenge track in the system. + description: Create a new challenge track in the system. security: - bearer: [] produces: @@ -1001,37 +973,33 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTrackData' + $ref: "#/definitions/ChallengeTrackData" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeTrack' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTrack" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the challenge track + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the challenge track schema: - $ref: '#/definitions/ErrorModel' - '409': - description: > - Conflict. Other challenge track has already used the same name, - abbreviation or legacyId. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge track has already used the same name or abbreviation. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/challenge-tracks/{challengeTrackId}': + $ref: "#/definitions/ErrorModel" + /challenge-tracks/{challengeTrackId}: get: tags: - ChallengeTracks @@ -1046,22 +1014,22 @@ paths: format: UUID description: The id of challenge track to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/ChallengeTrack' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTrack" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge track not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - ChallengeTracks @@ -1081,46 +1049,40 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTrackData' + $ref: "#/definitions/ChallengeTrackData" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeTrack' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTrack" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge track + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge track schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge track not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: > - Conflict. Other challenge track has already used the same name, - abbreviation or legacyId. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge track has already used the same name or abbreviation. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" patch: tags: - ChallengeTracks - description: > - Partially update the challenge track with specified id. Only the fields - that are provided will be updated. + description: Partially update the challenge track with specified id. Only the fields that are provided will be updated. security: - bearer: [] produces: @@ -1136,65 +1098,60 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTrackData' + $ref: "#/definitions/ChallengeTrackDataPatch" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeTrack' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTrack" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge track + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge track schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge track not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: > - Conflict. Other challenge track has already used the same name, - abbreviation or legacyId. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge track has already used the same name or abbreviation. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /challenge-phases: get: tags: - ChallengePhases - description: | - Retrieve challenge phases in the system. + description: Retrieve challenge phases in the system. security: - bearer: [] produces: - application/json parameters: - - $ref: '#/parameters/page' - - $ref: '#/parameters/perPage' + - $ref: "#/parameters/page" + - $ref: "#/parameters/perPage100" - name: name in: query - description: 'Filter by name, case-insensitive, partial matches are allowed.' + description: Filter by name, case-insensitive, partial matches are allowed. required: false type: string responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/Phase' + $ref: "#/definitions/Phase" headers: X-Next-Page: type: integer @@ -1217,30 +1174,18 @@ paths: Link: type: string description: Pagination link header. - '400': - description: Bad request. Request parameters were invalid. - schema: - $ref: '#/definitions/ErrorModel' - '401': - description: Unauthorized. Fail to authenticate the requester. - schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the challenge phases + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" post: tags: - ChallengePhases - description: > - Create a new challenge phase in the system. Only admins can access this - endpoint. + description: Create a new challenge phase in the system. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1250,36 +1195,33 @@ paths: name: body required: true schema: - $ref: '#/definitions/PhaseData' + $ref: "#/definitions/PhaseData" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Phase' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Phase" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the challenge phase + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the challenge phase schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other challenge phase has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge phase has already used the same name. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/challenge-phases/{challengePhaseId}': + $ref: "#/definitions/ErrorModel" + /challenge-phases/{challengePhaseId}: get: tags: - ChallengePhases @@ -1296,38 +1238,34 @@ paths: format: UUID description: The id of challenge phase to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/Phase' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Phase" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the challenge phase + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to access the challenge phase schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge phase not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - ChallengePhases - description: >- - Update the challenge phase with the specified id. Only admins can access - this endpoint. + description: Update the challenge phase with the specified id. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1343,46 +1281,40 @@ paths: name: body required: true schema: - $ref: '#/definitions/PhaseData' + $ref: "#/definitions/PhaseData" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Phase' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Phase" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge phase + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge phase schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge phase not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other challenge Phase has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge Phase has already used the same name. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" patch: tags: - ChallengePhases - description: > - Partially update the challenge phase with the provided id. Only the - fields that are provided in the body will be changed. Only admins can - access this endpoint. + description: Partially update the challenge phase with the provided id. Only the fields that are provided in the body will be changed. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1398,45 +1330,40 @@ paths: name: body required: true schema: - $ref: '#/definitions/PhaseData' + $ref: "#/definitions/PhaseDataPatch" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Phase' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Phase" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the challenge phase + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the challenge phase schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge phase not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other challenge Phase has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other challenge Phase has already used the same name. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" delete: tags: - ChallengePhases - description: >- - Delete the Challenge phase with provided challenge phase id. Only admins - can access this endpoint. + description: Delete the Challenge phase with provided challenge phase id. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1449,57 +1376,54 @@ paths: format: UUID description: The id of challenge phase to be deleted responses: - '200': + "200": description: Deleted - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Phase' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Phase" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - delete the challenge phase + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to delete the challenge phase schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge phase not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /timeline-templates: get: tags: - TimelineTemplates - description: | - Retrieve timeline templates in the system. + description: Retrieve timeline templates in the system. security: - bearer: [] produces: - application/json parameters: - - $ref: '#/parameters/page' - - $ref: '#/parameters/perPage' + - $ref: "#/parameters/page" + - $ref: "#/parameters/perPage" - name: name in: query - description: 'Filter by name, case-insensitive, partial matches are allowed.' + description: "Filter by name, case-insensitive, partial matches are allowed." required: false type: string responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/TimelineTemplate' + $ref: "#/definitions/TimelineTemplate" headers: X-Next-Page: type: integer @@ -1522,30 +1446,18 @@ paths: Link: type: string description: Pagination link header. - '400': - description: Bad request. Request parameters were invalid. - schema: - $ref: '#/definitions/ErrorModel' - '401': - description: Unauthorized. Fail to authenticate the requester. - schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the timeline templates + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" post: tags: - TimelineTemplates - description: > - Create a new timeline template in the system. Only admins can access - this endpoint. + description: Create a new timeline template in the system. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1555,36 +1467,33 @@ paths: name: body required: true schema: - $ref: '#/definitions/TimelineTemplateData' + $ref: "#/definitions/TimelineTemplateData" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/TimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/TimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the timeline template schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other timeline template has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other timeline template has already used the same name. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/timeline-templates/{timelineTemplateId}': + $ref: "#/definitions/ErrorModel" + /timeline-templates/{timelineTemplateId}: get: tags: - TimelineTemplates @@ -1601,38 +1510,34 @@ paths: format: UUID description: The id of timeline template to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/TimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/TimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to access the timeline template schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Timeline template not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - TimelineTemplates - description: >- - Update the timeline template with the specified id. Only admins can - access this endpoint. + description: Update the timeline template with the specified id. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1648,46 +1553,40 @@ paths: name: body required: true schema: - $ref: '#/definitions/TimelineTemplateData' + $ref: "#/definitions/TimelineTemplateData" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/TimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/TimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the timeline template schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Timeline template not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other timeline template has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other timeline template has already used the same name. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" patch: tags: - TimelineTemplates - description: > - Partially update the timeline template with the provided id. Only the - fields that are provided in the body will be changed. Only admins can - access this endpoint. + description: Partially update the timeline template with the provided id. Only the fields that are provided in the body will be changed. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1703,45 +1602,40 @@ paths: name: body required: true schema: - $ref: '#/definitions/TimelineTemplateData' + $ref: "#/definitions/TimelineTemplateDataPatch" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/TimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/TimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the timeline template. schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Timeline template not found schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other timeline template has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. Other timeline template has already used the same name. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" delete: tags: - TimelineTemplates - description: >- - Delete the timeline template with provided id. Only admins can access - this endpoint. + description: Delete the timeline template with provided id. Only admins can access this endpoint. security: - bearer: [] produces: @@ -1754,40 +1648,35 @@ paths: format: UUID description: The id of timeline template to be deleted responses: - '200': + "200": description: Deleted - The request was successful and the resource is returned. schema: - $ref: '#/definitions/TimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/TimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - delete the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to delete the timeline template. schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Timeline template not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /challenge-timelines: get: tags: - ChallengeTimelineTemplates - description: | - Retrieve challenge timeline templates in the system. - security: - - bearer: [] + description: Retrieve challenge timeline templates in the system. produces: - application/json parameters: @@ -1796,52 +1685,43 @@ paths: description: Filter by challenge type id required: false type: string + format: UUID - name: trackId in: query description: Filter by challenge track id required: false type: string + format: UUID - name: timelineTemplateId in: query description: Filter by timeline template id required: false type: string + format: UUID - name: isDefault in: query - description: Filter by is default flag + description: Filter by isDefault flag required: false type: boolean responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/ChallengeTimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. - schema: - $ref: '#/definitions/ErrorModel' - '401': - description: Unauthorized. Fail to authenticate the requester. - schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the timeline templates + $ref: "#/definitions/ChallengeTimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" post: tags: - ChallengeTimelineTemplates - description: > - Create a new challengetimeline template in the system. Only admins can - access this endpoint. + description: Create a new challengetimeline template in the system. security: - bearer: [] produces: @@ -1851,42 +1731,41 @@ paths: name: body required: true schema: - $ref: '#/definitions/ChallengeTimelineTemplateData' + $ref: "#/definitions/ChallengeTimelineTemplateData" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeTimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the timeline template + schema: + $ref: "#/definitions/ErrorModel" + "404": + description: Not Found. One of the parameter doesn't exist schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other timeline template has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. The challenge timeline template is already defined. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/challenge-timelines/{challengeTimelineTemplateId}': + $ref: "#/definitions/ErrorModel" + /challenge-timelines/{challengeTimelineTemplateId}: get: tags: - ChallengeTimelineTemplates description: Retrieve the challenge timeline template with provided id. - security: - - bearer: [] produces: - application/json parameters: @@ -1895,40 +1774,28 @@ paths: required: true type: string format: UUID - description: The id of challenge type timeline template to retrieve + description: The id of challenge timeline template to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/ChallengeTimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': - description: Unauthorized. Fail to authenticate the requester. + $ref: "#/definitions/ErrorModel" + "404": + description: Entity not found schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the timeline template + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '404': - description: Entity not found - schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error - schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - ChallengeTimelineTemplates - description: >- - Update the challenge timeline template with the specified id. Only - admins can access this endpoint. + description: Update the challenge timeline template with the specified id. security: - bearer: [] produces: @@ -1939,50 +1806,45 @@ paths: required: true type: string format: UUID - description: The id of challenge type timeline template to update + description: The id of challenge timeline template to update - in: body name: body required: true schema: - $ref: '#/definitions/ChallengeTimelineTemplateData' + $ref: "#/definitions/ChallengeTimelineTemplateData" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeTimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the timeline template. schema: - $ref: '#/definitions/ErrorModel' - '404': - description: Entity not found + $ref: "#/definitions/ErrorModel" + "404": + description: Not Found. One of the parameter doesn't exist schema: - $ref: '#/definitions/ErrorModel' - '409': - description: | - Conflict. Other timeline template has already used the same name. + $ref: "#/definitions/ErrorModel" + "409": + description: Conflict. The challenge timeline template is already defined. schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" delete: tags: - ChallengeTimelineTemplates - description: >- - Delete the challenge timeline template with provided id. Only admins can - access this endpoint. + description: Delete the challenge timeline template with provided id. security: - bearer: [] produces: @@ -1993,48 +1855,44 @@ paths: required: true type: string format: UUID - description: The id of challenge type timeline template to be deleted + description: The id of challenge timeline template to be deleted responses: - '200': + "200": description: Deleted - The request was successful and the resource is returned. schema: - $ref: '#/definitions/ChallengeTimelineTemplate' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/ChallengeTimelineTemplate" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - delete the timeline template + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to delete the timeline template schema: - $ref: '#/definitions/ErrorModel' - '404': - description: Entity not found + $ref: "#/definitions/ErrorModel" + "404": + description: Timeline template not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /challenge-auditLogs: get: tags: - AuditLog - description: | - Retrieve the auditLog for the specified filter parameters. - Only admins can access this endpoint. + description: Retrieve the auditLog for the specified filter parameters. Only admins can access this endpoint. security: - bearer: [] produces: - application/json parameters: - - $ref: '#/parameters/page' - - $ref: '#/parameters/perPage' + - $ref: "#/parameters/page" + - $ref: "#/parameters/perPage" - name: challengeId in: query description: Filter by challengeId. @@ -2050,23 +1908,25 @@ paths: description: Filter by created date (lower bound of date range) required: false type: string + format: date-time - name: createdDateEnd in: query description: Filter by created date (upper bound of date range) required: false type: string + format: date-time - name: createdBy in: query description: Filter by createdBy field. required: false type: string responses: - '200': + "200": description: OK schema: type: array items: - $ref: '#/definitions/AuditLogEntry' + $ref: "#/definitions/AuditLogEntry" headers: X-Next-Page: type: integer @@ -2089,30 +1949,27 @@ paths: Link: type: string description: Pagination link header. - '400': - description: Bad request. Request parameters were invalid. + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the audit log + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to access the audit log schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /challenges/{challengeId}/attachments: post: tags: - Attachments - description: > - Create a new attachment in the system. If you want to create multiple attachment, you can pass an array of objects instead of a single object. + description: Create a new attachment in the system. If you want to create multiple attachment, you can pass an array of objects instead of a single object. security: - bearer: [] produces: @@ -2128,35 +1985,33 @@ paths: name: body required: true schema: - $ref: '#/definitions/CreateAttachmentRequestBody' + $ref: "#/definitions/CreateUpdateAttachmentRequestBody" responses: - '201': + "201": description: Created - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Attachment' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Attachment" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - create the attachment + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to create the attachment schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/challenges/{challengeId}/attachments/{attachmentId}': + $ref: "#/definitions/ErrorModel" + /challenges/{challengeId}/attachments/{attachmentId}: get: tags: - Attachments @@ -2179,37 +2034,34 @@ paths: format: UUID description: The id of attachment to retrieve responses: - '200': + "200": description: OK schema: - $ref: '#/definitions/Attachment' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Attachment" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - access the attachment + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to access the attachment schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Attachment not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" put: tags: - Attachments - description: >- - Update the attachment with the specified id. + description: Update the attachment with the specified id. security: - bearer: [] produces: @@ -2231,40 +2083,36 @@ paths: name: body required: true schema: - $ref: '#/definitions/UpdateAttachmentRequestBody' + $ref: "#/definitions/CreateUpdateAttachmentRequestBody" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Attachment' - '400': + $ref: "#/definitions/Attachment" + "400": description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the attachment + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the attachment schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Attachment not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" patch: tags: - Attachments - description: > - Partially update the attachment with the provided id. Only the - fields that are provided in the body will be changed. + description: Partially update the attachment with the provided id. Only the fields that are provided in the body will be changed. security: - bearer: [] produces: @@ -2286,39 +2134,36 @@ paths: name: body required: true schema: - $ref: '#/definitions/PartiallyUpdateAttachmentRequestBody' + $ref: "#/definitions/PartiallyUpdateAttachmentRequestBody" responses: - '200': + "200": description: Updated - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Attachment' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Attachment" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - update the attachment + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to update the attachment schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Attachment not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" delete: tags: - Attachments - description: >- - Delete the Attachment with provided attachment id. + description: Delete the Attachment with provided attachment id. security: - bearer: [] produces: @@ -2337,37 +2182,37 @@ paths: format: UUID description: The id of attachment to be deleted responses: - '200': + "200": description: Deleted - The request was successful and the resource is returned. schema: - $ref: '#/definitions/Attachment' - '400': - description: Bad request. Request parameters were invalid. + $ref: "#/definitions/Attachment" + "400": + description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - delete the attachment + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to delete the attachment schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Attachment not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' - '/challenges/{challengeId}/attachments/{attachmentId}/download': + $ref: "#/definitions/ErrorModel" + /challenges/{challengeId}/attachments/{attachmentId}/download: get: tags: - Attachments description: Download attachment of challenge. + security: + - bearer: [] produces: - application/octet-stream parameters: @@ -2384,30 +2229,28 @@ paths: format: UUID description: The attachment id responses: - '200': - description: 'OK, attachment is downloaded' - '400': + "200": + description: "OK, attachment is downloaded" + "400": description: Bad request. Request parameters were invalid. schema: - $ref: '#/definitions/ErrorModel' - '401': + $ref: "#/definitions/ErrorModel" + "401": description: Unauthorized. Fail to authenticate the requester. schema: - $ref: '#/definitions/ErrorModel' - '403': - description: > - Forbidden. The requester does not have the correct permission to - download attachment + $ref: "#/definitions/ErrorModel" + "403": + description: Forbidden. The requester does not have the correct permission to download attachment schema: - $ref: '#/definitions/ErrorModel' - '404': + $ref: "#/definitions/ErrorModel" + "404": description: Challenge not found schema: - $ref: '#/definitions/ErrorModel' - '500': - description: Server error + $ref: "#/definitions/ErrorModel" + "500": + description: Internal Server Error schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" /health: get: tags: @@ -2417,7 +2260,7 @@ paths: produces: - application/json responses: - '200': + "200": description: OK schema: type: object @@ -2426,10 +2269,10 @@ paths: type: integer required: - checksRun - '503': + "503": description: Service unavailable schema: - $ref: '#/definitions/ErrorModel' + $ref: "#/definitions/ErrorModel" parameters: page: name: page @@ -2437,6 +2280,7 @@ parameters: description: The page number. required: false type: integer + minimum: 1 default: 1 perPage: name: perPage @@ -2444,8 +2288,18 @@ parameters: description: The number of items to list per page. required: false type: integer + minimum: 1 default: 20 maximum: 100 + perPage100: + name: perPage + in: query + description: The number of items to list per page. + required: false + type: integer + minimum: 1 + default: 100 + maximum: 100 definitions: Challenge: type: object @@ -2456,209 +2310,99 @@ definitions: type: string description: The challenge id. format: UUID - - $ref: '#/definitions/ChallengeData' - required: - - id - ChallengeType: - type: object - allOf: - - type: object - properties: - id: - type: string - description: The challenge type id. - format: UUID - - $ref: '#/definitions/ChallengeTypeData' - required: - - id - ChallengeTrack: - type: object - allOf: - - type: object - properties: - id: - type: string - description: The challenge track id. - format: UUID - - $ref: '#/definitions/ChallengeTrackData' - required: - - id - Phase: - type: object - allOf: - - type: object - properties: - id: - type: string - description: The challenge phase id. - format: UUID - - $ref: '#/definitions/PhaseData' + - $ref: "#/definitions/ChallengeData" required: - id - Event: - type: object - allOf: - - type: object - properties: - id: - type: number - description: Event Id - - $ref: '#/definitions/EventData' - required: - - id - Discussion: + ChallengeData: type: object properties: - id: + typeId: type: string format: UUID - name: - type: string - type: - type: string - enum: - - challenge - provider: - type: string - url: + trackId: type: string - description: Only M2M tokens can modify this - options: - type: array - description: Only M2M tokens can modify this - items: - type: object - TimelineTemplate: - type: object - allOf: - - type: object - properties: - id: - type: string - description: The timeline template id. - format: UUID - - $ref: '#/definitions/TimelineTemplateData' - required: - - id - ChallengeTimelineTemplate: - type: object - allOf: - - type: object - properties: - id: - type: string - description: The challenge type timeline template id. - format: UUID - - $ref: '#/definitions/ChallengeTimelineTemplateData' - required: - - id - - typeId - - timelineTemplateId - ChallengeData: - type: object - properties: - legacyId: - type: number + format: UUID legacy: type: object properties: track: type: string + subTrack: + type: string reviewType: type: string - description: the review type enum: - - 'INTERNAL' - - 'COMMUNITY' - default: 'INTERNAL' + - "INTERNAL" + - "COMMUNITY" + default: "INTERNAL" + confidentialityType: + type: string + default: public forumId: type: integer - description: the forum id directProjectId: type: integer - confidentialityType: - type: string - enum: - - public - - private - task: - type: object - properties: + screeningScorecardId: + type: integer + reviewScorecardId: + type: integer isTask: type: boolean - default: false - isAssigned: + useSchedulingAPI: type: boolean - default: false - memberId: + pureV5Task: + type: boolean + billing: + type: object + properties: + billingAccountId: type: string - default: null - description: the ID of the assigned member - type: - type: string - description: Auto-generated - example: Challenge - track: - type: string - description: Auto-generated - example: Development - typeId: - type: string - format: UUID - trackId: - type: string - format: UUID + markup: + type: number + minimum: 0 + maximum: 100 name: type: string description: type: string privateDescription: type: string - description: returned only if the user is registered on the challenge. + descriptionFormat: + type: string + default: markup metadata: type: array items: properties: name: type: string - description: The challenge setting type - example: sample metadata name + description: The sample metadata type value: type: string description: The sample metadata value + required: + - name + - value timelineTemplateId: type: string + description: Required if the selected typeId/trackId combination does not have a default timeline template ID format: UUID phases: type: array items: - $ref: '#/definitions/Phase' - events: + $ref: "#/definitions/ChallengePhase" + discussions: type: array items: - $ref: '#/definitions/Event' - prizeSets: + $ref: "#/definitions/Discussion" + events: type: array items: - properties: - type: - type: string - description: - type: string - prizes: - type: array - items: - properties: - description: - type: string - type: - type: string - value: - type: number - discussions: + $ref: "#/definitions/Event" + prizeSets: type: array items: - $ref: '#/definitions/Discussion' + $ref: "#/definitions/PrizeSets" tags: type: array items: @@ -2666,10 +2410,14 @@ definitions: projectId: type: integer description: the project id + minimum: 1 + legacyId: + type: integer + minimum: 1 startDate: type: string format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" status: type: string description: the status @@ -2679,14 +2427,23 @@ definitions: - Cancelled - Active - Completed + - Deleted + - Cancelled - Failed Review + - Cancelled - Failed Screening + - Cancelled - Zero Submissions + - Cancelled - Winner Unresponsive + - Cancelled - Client Request + - Cancelled - Requirements Infeasible + - Cancelled - Zero Registrations attachments: type: array items: - $ref: '#/definitions/Attachment' + $ref: "#/definitions/Attachment" groups: type: array items: type: string + format: UUID winners: type: array items: @@ -2699,305 +2456,145 @@ definitions: description: the user handle placement: type: integer + minimum: 1 description: the winner placement example: 1 + required: + - userId + - handle + - placement terms: type: array + description: The ids and roleId of the terms of use to add for the challenge items: - type: string - description: The terms of use id + type: object + properties: + id: + type: string + format: UUID + roleId: + type: string + format: UUID + required: + - id + - roleId numOfSubmissions: type: integer description: number of submissions numOfRegistrants: type: integer description: number of registrants + currentPhaseNames: + type: array + items: + type: string + registrationStartDate: + type: string + format: date-time + registrationEndDate: + type: string + format: date-time + submissionStartDate: + type: string + format: date-time + submissionEndDate: + type: string + format: date-time overview: description: the overview of the challenge type: object + properties: + totalPrizes: + type: integer created: type: string format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" createdBy: type: string example: topcoder user updated: type: string format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" updatedBy: type: string example: topcoder user + task: + type: object + properties: + isTask: + type: boolean + default: false + isAssigned: + type: boolean + default: false + memberId: + type: string + default: null + description: the ID of the assigned member + type: + type: string + description: Auto-generated + example: Challenge + track: + type: string + description: Auto-generated + example: Development required: - typeId - trackId - name - - description + - descriptionFormat - timelineTemplateId - phases - - prizeSets - created - createdBy - - tags - - status - Attachment: + - type + - track + ChallengeRequestBodyForCreate: type: object - allOf: - - type: object + properties: + typeId: + type: string + format: UUID + trackId: + type: string + format: UUID + legacy: + type: object properties: - id: + reviewType: type: string - description: The attachment id. - format: UUID - - $ref: '#/definitions/AttachmentData' - required: - - id - UpdateAttachmentRequestBody: - type: object - properties: - name: - type: string - fileSize: - type: integer - url: - type: string - example: "https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew" - description: - type: string - required: - - url - - name - PartiallyUpdateAttachmentRequestBody: - type: object - properties: - name: - type: string - fileSize: - type: integer - url: - type: string - example: "https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew" - description: - type: string - CreateAttachmentRequestBody: - type: object - properties: - name: - type: string - fileSize: - type: integer - url: - type: string - example: "https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew" - description: - type: string - required: - - url - - name - AttachmentData: - type: object - properties: - name: - type: string - fileSize: - type: integer - url: - type: string - example: "https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew" - description: - type: string - challengeId: - type: string - format: UUID - required: - - url - - name - - challengeId - ChallengeTypeData: - type: object - properties: - name: - type: string - description: - type: string - isActive: - type: boolean - abbreviation: - type: string - required: - - name - - isActive - - abbreviation - ChallengeTrackData: - type: object - properties: - name: - type: string - description: - type: string - isActive: - type: boolean - abbreviation: - type: string - required: - - name - - isActive - - abbreviation - PhaseData: - type: object - properties: - phaseId: - type: string - format: UUID - predecessor: - type: string - format: UUID - name: - type: string - description: - type: string - isOpen: - type: boolean - duration: - type: number - defaultDuration: - type: number - scheduledStartDate: - type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - scheduledEndDate: - type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - actualStartDate: - type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - actualEndDate: - type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - EventData: - type: object - properties: - id: - type: number - name: - type: string - key: - type: string - TimelineTemplateData: - type: object - properties: - name: - type: string - description: - type: string - isActive: - type: boolean - phases: - type: array - items: - properties: - phaseId: - type: string - format: UUID - predecessor: - type: string - format: UUID - defaultDuration: - type: number - required: - - phaseId - - defaultDuration - required: - - name - - isActive - - phases - ChallengeTimelineTemplateData: - type: object - properties: - typeId: - type: string - format: UUID - trackId: - type: string - format: UUID - timelineTemplateId: - type: string - format: UUID - isDefault: - type: boolean - default: false - required: - - typeId - - trackId - - timelineTemplateId - AuditLogEntry: - type: object - properties: - id: - type: string - format: UUID - challengeId: - type: string - fieldName: - type: string - oldValue: - type: string - newValue: - type: string - created: - type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - createdBy: - type: string - example: topcoder user - memberId: - type: string - description: The member ID - example: '12345678' - required: - - id - - challengeId - - fieldName - - oldValue - - newValue - - created - - createdBy - ChallengeRequestBody: - type: object - properties: - typeId: - type: string - format: UUID - example: challenge type id - legacy: - type: object - properties: - track: - type: string - reviewType: - type: string - enum: - - 'INTERNAL' - - 'COMMUNITY' - default: 'INTERNAL' - confidentialityType: - type: string - forumId: - type: number - required: - - track + enum: + - "INTERNAL" + - "COMMUNITY" + default: "INTERNAL" + confidentialityType: + type: string + default: public + useSchedulingAPI: + type: boolean + pureV5Task: + type: boolean + billing: + type: object + properties: + billingAccountId: + type: string + markup: + type: number + minimum: 0 + maximum: 100 name: type: string description: type: string privateDescription: type: string + descriptionFormat: + type: string + default: markup metadata: type: array items: @@ -3005,8 +2602,6 @@ definitions: name: type: string description: The sample metadata type - format: UUID - example: sample metadata id value: type: string description: The sample metadata value @@ -3015,17 +2610,12 @@ definitions: - value timelineTemplateId: type: string + description: Required if the selected typeId/trackId combination does not have a default timeline template ID format: UUID events: type: array items: - properties: - id: - type: number - name: - type: string - key: - type: string + $ref: "#/definitions/Event" phases: type: array items: @@ -3034,35 +2624,16 @@ definitions: type: string format: UUID duration: - type: number + type: integer + minimum: 0 discussions: type: array items: - $ref: '#/definitions/Discussion' + $ref: "#/definitions/Discussion" prizeSets: type: array items: - properties: - type: - type: string - description: - type: string - prizes: - type: array - items: - properties: - description: - type: string - type: - type: string - value: - type: number - required: - - type - - value - required: - - type - - prizes + $ref: "#/definitions/PrizeSets" tags: type: array items: @@ -3070,12 +2641,14 @@ definitions: projectId: type: integer description: the project id + minimum: 1 legacyId: - type: number + type: integer + minimum: 1 startDate: type: string format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" status: type: string description: the status @@ -3085,59 +2658,273 @@ definitions: - Cancelled - Active - Completed + - Deleted + - Cancelled - Failed Review + - Cancelled - Failed Screening + - Cancelled - Zero Submissions + - Cancelled - Winner Unresponsive + - Cancelled - Client Request + - Cancelled - Requirements Infeasible + - Cancelled - Zero Registrations groups: type: array items: type: string + format: UUID terms: type: array - description: The ids of the terms of use to add for the challenge + description: The ids and roleId of the terms of use to add for the challenge items: - type: string - format: UUID + type: object + properties: + id: + type: string + format: UUID + roleId: + type: string + format: UUID + required: + - id + - roleId required: + - typeId + - trackId - name - - tags - projectId - - status - SearchChallengeRequestBody: + ChallengeRequestBodyForFullyUpdate: type: object properties: - ids: - description: Array of challenge IDs - type: array - items: - type: string - format: UUID - minItems: 1 - uniqueItems: true + typeId: + type: string + format: UUID + trackId: + type: string + format: UUID + legacy: + type: object + properties: + reviewType: + type: string + enum: + - "INTERNAL" + - "COMMUNITY" + default: "INTERNAL" + confidentialityType: + type: string + default: public + useSchedulingAPI: + type: boolean + pureV5Task: + type: boolean + billing: + type: object + properties: + billingAccountId: + type: string + markup: + type: number + minimum: 0 + maximum: 100 + task: + type: object + properties: + isTask: + type: boolean + default: false + isAssigned: + type: boolean + default: false + memberId: + type: string + default: null + description: the ID of the assigned member + name: + type: string + description: + type: string + privateDescription: + type: string + descriptionFormat: + type: string + default: markup + metadata: + type: array + items: + properties: + name: + type: string + description: The sample metadata type + value: + type: string + description: The sample metadata value + required: + - name + - value + timelineTemplateId: + type: string + description: Required if the selected typeId/trackId combination does not have a default timeline template ID + format: UUID + events: + type: array + items: + $ref: "#/definitions/Event" + phases: + type: array + items: + properties: + phaseId: + type: string + format: UUID + duration: + type: integer + minimum: 0 + isOpen: + type: boolean + discussions: + type: array + items: + $ref: "#/definitions/Discussion" + prizeSets: + type: array + items: + $ref: "#/definitions/PrizeSets" + tags: + type: array + items: + type: string + projectId: + type: integer + description: the project id + minimum: 1 + legacyId: + type: integer + minimum: 1 + startDate: + type: string + format: date-time + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" + status: + type: string + description: the status + enum: + - New + - Draft + - Cancelled + - Active + - Completed + - Deleted + - Cancelled - Failed Review + - Cancelled - Failed Screening + - Cancelled - Zero Submissions + - Cancelled - Winner Unresponsive + - Cancelled - Client Request + - Cancelled - Requirements Infeasible + - Cancelled - Zero Registrations + attachments: + type: array + items: + $ref: "#/definitions/Attachment" groups: - description: Filter by group IDs type: array items: type: string format: UUID - minItems: 1 - uniqueItems: true - ChallengeResponseBodyForCreateOrUpdate: + winners: + type: array + items: + properties: + userId: + type: integer + description: The user id + handle: + type: string + description: the user handle + placement: + type: integer + minimum: 1 + description: the winner placement + example: 1 + required: + - userId + - handle + - placement + terms: + type: array + description: The ids and roleId of the terms of use to add for the challenge + items: + type: object + properties: + id: + type: string + format: UUID + roleId: + type: string + format: UUID + required: + - id + - roleId + required: + - typeId + - trackId + - name + - projectId + - status + ChallengeRequestBodyForPartiallyUpdate: type: object properties: - id: - type: string - format: UUID - description: The challenge id. typeId: type: string format: UUID - example: challenge type id - track: + trackId: type: string + format: UUID + legacy: + type: object + properties: + reviewType: + type: string + enum: + - "INTERNAL" + - "COMMUNITY" + default: "INTERNAL" + confidentialityType: + type: string + default: public + useSchedulingAPI: + type: boolean + pureV5Task: + type: boolean + billing: + type: object + properties: + billingAccountId: + type: string + markup: + type: number + minimum: 0 + maximum: 100 + task: + type: object + properties: + isTask: + type: boolean + default: false + isAssigned: + type: boolean + default: false + memberId: + type: string + default: null + description: the ID of the assigned member name: type: string description: type: string privateDescription: type: string + descriptionFormat: + type: string + default: markup metadata: type: array items: @@ -3145,46 +2932,40 @@ definitions: name: type: string description: The sample metadata type - format: UUID - example: challenge metadata id value: type: string - description: The challenge metadata value + description: The sample metadata value + required: + - name + - value timelineTemplateId: type: string - description: >- - Required if the selected typeId/track combination does not have a - default timeline template ID + description: Required if the selected typeId/trackId combination does not have a default timeline template ID format: UUID + events: + type: array + items: + $ref: "#/definitions/Event" phases: type: array items: - $ref: '#/definitions/Phase' - events: + properties: + phaseId: + type: string + format: UUID + duration: + type: integer + minimum: 0 + isOpen: + type: boolean + discussions: type: array items: - $ref: '#/definitions/Event' + $ref: "#/definitions/Discussion" prizeSets: type: array items: - properties: - type: - type: string - description: - type: string - prizes: - type: array - items: - properties: - description: - type: string - type: - type: string - value: - type: number - reviewType: - type: string - description: the review type + $ref: "#/definitions/PrizeSets" tags: type: array items: @@ -3192,13 +2973,14 @@ definitions: projectId: type: integer description: the project id - forumId: + minimum: 1 + legacyId: type: integer - description: the forum id + minimum: 1 startDate: type: string format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" status: type: string description: the status @@ -3208,14 +2990,23 @@ definitions: - Cancelled - Active - Completed + - Deleted + - Cancelled - Failed Review + - Cancelled - Failed Screening + - Cancelled - Zero Submissions + - Cancelled - Winner Unresponsive + - Cancelled - Client Request + - Cancelled - Requirements Infeasible + - Cancelled - Zero Registrations attachments: type: array items: - $ref: '#/definitions/Attachment' + $ref: "#/definitions/Attachment" groups: type: array items: type: string + format: UUID winners: type: array items: @@ -3228,51 +3019,444 @@ definitions: description: the user handle placement: type: integer + minimum: 1 description: the winner placement example: 1 + required: + - userId + - handle + - placement terms: + type: array + description: The ids and roleId of the terms of use to add for the challenge + items: + type: object + properties: + id: + type: string + format: UUID + roleId: + type: string + format: UUID + required: + - id + - roleId + SearchChallengeRequestBody: + type: object + properties: + ids: + description: Array of challenge IDs type: array items: type: string - description: The terms of use id format: UUID - numOfSubmissions: - type: integer - description: number of submissions - numOfRegistrants: - type: integer - description: number of registrants - overview: - description: the overview of the challenge - type: object - created: - type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - createdBy: - type: string - example: topcoder user - updated: + minItems: 1 + uniqueItems: true + groups: + description: Filter by group IDs + type: array + items: + type: string + format: UUID + minItems: 1 + uniqueItems: true + Event: + type: object + properties: + id: + type: number + name: type: string - format: date-time - description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)' - updatedBy: + key: type: string - example: topcoder user required: - id - - typeId - - track - - name - - description - - phases - - prizeSets - - created - - createdBy - - tags - - projectId - - forumId - - status + Discussion: + type: object + properties: + id: + type: string + format: UUID + name: + type: string + type: + type: string + enum: + - challenge + provider: + type: string + url: + type: string + format: url + description: Only M2M tokens can modify this + options: + type: array + description: Only M2M tokens can modify this + items: + type: object + required: + - name + - type + - provider + PrizeSets: + type: object + properties: + type: + type: string + description: + type: string + prizes: + type: array + items: + properties: + description: + type: string + type: + type: string + value: + type: integer + minimum: 0 + required: + - type + - value + required: + - type + ChallengePhase: + type: object + properties: + duration: + type: integer + minimum: 1 + scheduledStartDate: + type: string + format: date-time + actualStartDate: + type: string + format: date-time + scheduledEndDate: + type: string + format: date-time + actualEndDate: + type: string + format: date-time + isOpen: + type: boolean + phaseId: + type: string + format: UUID + name: + type: string + id: + type: string + format: UUID + ChallengeType: + type: object + allOf: + - type: object + properties: + id: + type: string + description: The challenge type id. + format: UUID + - $ref: "#/definitions/ChallengeTypeData" + required: + - id + ChallengeTypeData: + type: object + properties: + name: + type: string + description: + type: string + isActive: + type: boolean + isTask: + type: boolean + default: false + abbreviation: + type: string + required: + - name + - isActive + - isTask + - abbreviation + ChallengeTypeDataPatch: + type: object + properties: + name: + type: string + description: + type: string + isActive: + type: boolean + isTask: + type: boolean + default: false + abbreviation: + type: string + ChallengeTrack: + type: object + allOf: + - type: object + properties: + id: + type: string + description: The challenge track id. + format: UUID + - $ref: "#/definitions/ChallengeTrackData" + required: + - id + ChallengeTrackData: + type: object + properties: + name: + type: string + description: + type: string + isActive: + type: boolean + abbreviation: + type: string + required: + - name + - isActive + - abbreviation + ChallengeTrackDataPatch: + type: object + properties: + name: + type: string + description: + type: string + isActive: + type: boolean + abbreviation: + type: string + Phase: + type: object + allOf: + - type: object + properties: + id: + type: string + description: The challenge phase id. + format: UUID + - $ref: "#/definitions/PhaseData" + required: + - id + PhaseData: + type: object + properties: + name: + type: string + description: + type: string + isOpen: + type: boolean + duration: + type: integer + minimum: 1 + required: + - name + - isOpen + - duration + PhaseDataPatch: + type: object + properties: + name: + type: string + description: + type: string + isOpen: + type: boolean + duration: + type: integer + minimum: 1 + TimelineTemplate: + type: object + allOf: + - type: object + properties: + id: + type: string + description: The timeline template id. + format: UUID + - $ref: "#/definitions/TimelineTemplateData" + required: + - id + TimelineTemplateData: + type: object + properties: + name: + type: string + description: + type: string + isActive: + type: boolean + phases: + type: array + items: + properties: + phaseId: + type: string + format: UUID + predecessor: + type: string + format: UUID + defaultDuration: + type: number + minimum: 1 + required: + - phaseId + - defaultDuration + required: + - name + - isActive + - phases + TimelineTemplateDataPatch: + type: object + properties: + name: + type: string + description: + type: string + isActive: + type: boolean + phases: + type: array + items: + properties: + phaseId: + type: string + format: UUID + predecessor: + type: string + format: UUID + defaultDuration: + type: number + minimum: 1 + required: + - phaseId + - defaultDuration + ChallengeTimelineTemplate: + type: object + allOf: + - type: object + properties: + id: + type: string + description: The challenge timeline template id. + format: UUID + - $ref: "#/definitions/ChallengeTimelineTemplateData" + required: + - id + ChallengeTimelineTemplateData: + type: object + properties: + typeId: + type: string + format: UUID + trackId: + type: string + format: UUID + timelineTemplateId: + type: string + format: UUID + isDefault: + type: boolean + default: false + required: + - typeId + - trackId + - timelineTemplateId + Attachment: + type: object + allOf: + - type: object + properties: + id: + type: string + description: The attachment id. + format: UUID + - $ref: "#/definitions/AttachmentData" + required: + - id + AttachmentData: + type: object + allOf: + - type: object + properties: + challengeId: + type: string + format: UUID + - $ref: "#/definitions/CreateUpdateAttachmentRequestBody" + required: + - challengeId + PartiallyUpdateAttachmentRequestBody: + type: object + properties: + name: + type: string + fileSize: + type: integer + minimum: 0 + default: 0 + url: + type: string + example: "https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew" + description: + type: string + CreateUpdateAttachmentRequestBody: + type: object + properties: + name: + type: string + fileSize: + type: integer + minimum: 0 + default: 0 + url: + type: string + format: url + example: "https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew" + description: + type: string + required: + - url + - name + AuditLogEntry: + type: object + properties: + id: + type: string + format: UUID + challengeId: + type: string + fieldName: + type: string + oldValue: + type: string + newValue: + type: string + created: + type: string + format: date-time + description: "ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)" + createdBy: + type: string + example: topcoder user + memberId: + type: string + description: The member ID + example: "12345678" + required: + - id + - challengeId + - fieldName + - oldValue + - newValue + - created + - createdBy ErrorModel: type: object properties: diff --git a/docs/topcoder-challenge-api.postman_collection.json b/docs/topcoder-challenge-api.postman_collection.json index 865c609e..559db55b 100644 --- a/docs/topcoder-challenge-api.postman_collection.json +++ b/docs/topcoder-challenge-api.postman_collection.json @@ -1,19688 +1,3491 @@ { "info": { - "_postman_id": "8db71ecf-092b-4a7e-a9ea-d37d0ee52682", - "name": "topcoder-challenge-api", + "_postman_id": "76b5f465-ec2b-493e-b489-7a7ecaf47926", + "name": "E2E Tests", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { - "name": "ChallengeTypes", + "name": "READ MY Pre-request Script", + "item": [], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "/*", + "Open Runner", + "Put E2E Test Folder inside Runner", + "Set \"Delay\" to 2000ms", + "Check \"Save Responses\"", + "Start Run", + "*/" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Process a payment for a task", "item": [ { - "name": "create challenge type", - "item": [ - { - "name": "create test data", - "item": [ - { - "name": "test data - create type 1", - "event": [ - { - "listen": "test", - "script": { - "id": "a9ba7c1e-ad35-49dd-a340-1bbe2a4cf338", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TYPE_ID1\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"type-name-1\",\n\t\"description\": \"descritpion1\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb1\",\n\t\"legacyId\": 111\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, - { - "name": "test data - create type 2", - "event": [ - { - "listen": "test", - "script": { - "id": "2139cf4c-cbe4-4a62-bf3a-3a8fa27f458d", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TYPE_ID2\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"type-name-2\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb2\",\n\t\"legacyId\": 222\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, - { - "name": "test data - create type 3", - "event": [ - { - "listen": "test", - "script": { - "id": "34cb9d36-5c43-4285-a40c-d5ee37b004ae", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TYPE_ID3\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"type-name-3\",\n\t\"description\": \"descritpion3\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb3\",\n\t\"legacyId\": 333\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, - { - "name": "test data - create type 4", - "event": [ - { - "listen": "test", - "script": { - "id": "01f4bdd4-4f5b-4e23-b629-f9a7c41f966e", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TYPE_ID4\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"type-name-4\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb4\",\n\t\"legacyId\": 444\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, - { - "name": "test data - create type 5", - "event": [ - { - "listen": "test", - "script": { - "id": "df6c8b60-1c11-465e-bb4a-1f8a9c3eb84e", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TYPE_ID5\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"type-name-5\",\n\t\"description\": \"descritpion5\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb5\",\n\t\"legacyId\": 555\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, + "name": "Create Task", + "event": [ { - "name": "create by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "ed202b1e-43a8-4a62-96e6-d8c823381811", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TYPEA_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{copilot1_token}}", - "type": "text" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "if(pm.response.status === 'Created') {", + " const response = pm.response.json();", + " pm.environment.set('CHALLENGE_UUID_PAYMENT', response.id);", + " pm.expect(response).to.have.property('created')", + " pm.expect(response.createdBy).to.eq('tcwebservice')", + " pm.expect(response).to.have.property('updated')", + " pm.expect(response.updatedBy).to.eq('tcwebservice')", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')", + " pm.expect(response.name).to.eq('Postman Task Test 1')", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")", + " pm.expect(response.privateDescription).to.eq('private description')", + " pm.expect(response.descriptionFormat).to.eq('markdown')", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')", + " pm.expect(response.prizeSets[0].type).to.eq('placement')", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')", + " pm.expect(response.tags[0]).to.eq('Other')", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))", + " pm.expect(response).to.have.property('startDate')", + " pm.expect(response.status).to.eq('Draft')", + " pm.expect(response).to.have.property('billing')", + " pm.expect(response.task.isTask).to.be.true", + " pm.expect(response.task.isAssigned).to.be.false", + " pm.expect(response.task.memberId).to.be.null", + " pm.expect(response.phases[0].name).to.eq('Submission')", + " pm.expect(response.phases[1].name).to.eq('Iterative Review')", + " pm.expect(response.phases[2].name).to.eq('Approval')", + " pm.expect(response).to.have.property('endDate')", + " pm.expect(response.overview.totalPrizes).to.eq(1)", + " pm.expect(response.numOfSubmissions).to.eq(0)", + " pm.expect(response.numOfRegistrants).to.eq(0)", + " pm.expect(response).to.have.property('currentPhaseNames')", + " pm.expect(response).to.have.property('submissionStartDate')", + " pm.expect(response).to.have.property('submissionEndDate')", + " pm.expect(response.track).to.eq('Development')", + " pm.expect(response.type).to.eq('Task')", + "}", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-copilot\",\n\t\"description\": \"test-value\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb123\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "create by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "54c44cb3-6a09-4230-8136-60b8b4ead965", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TYPEB_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "prerequest", + "script": { + "exec": [ + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-admin\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb456\",\n\t\"legacyId\": 456\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"typeId\": \"{{TYPE_TASK}}\",\n \"trackId\": \"{{TRACK_DEVELOPMENT}}\",\n \"legacy\": {\n \"reviewType\": \"INTERNAL\"\n },\n \"name\": \"Postman Task Test 1\",\n \"description\": \"Here's a large description with **markdown**\",\n \"privateDescription\": \"private description\",\n \"descriptionFormat\": \"markdown\",\n \"timelineTemplateId\": \"{{TIMELINE_TEMPLATE_TASK}}\",\n \"prizeSets\": [\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Challenge Prizes\",\n \"type\": \"placement\"\n },\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Copilot Payment\",\n \"type\": \"copilot\"\n }\n ],\n \"tags\": [\n \"Other\"\n ],\n \"projectId\": {{PROJECT_ID}},\n \"startDate\": \"{{tenMinFromNow}}\",\n \"status\": \"Draft\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "create without optional properties by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "0dccc43b-e57a-40a7-8695-40999cada3e7", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TYPEB_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges", + "host": [ + "{{URL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-without-optional-properties\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"cwoop\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, + "path": [ + "challenges" + ] + } + }, + "response": [] + }, + { + "name": "Get Created Task", + "event": [ { - "name": "failure create missing parameter name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "7edda07b-db33-47a7-946b-413ada2fed42", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')\r", + " pm.expect(response.name).to.eq('Postman Task Test 1')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Draft')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.task.isTask).to.be.true\r", + " pm.expect(response.task.isAssigned).to.be.false\r", + " pm.expect(response.task.memberId).to.be.null\r", + " pm.expect(response.phases[0].name).to.eq('Submission')\r", + " pm.expect(response.phases[1].name).to.eq('Iterative Review')\r", + " pm.expect(response.phases[2].name).to.eq('Approval')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(0)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Task')\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"failure\",\n\t\"isActive\": true,\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "failure create missing parameter isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "8366ea39-237a-499c-9a8b-f183c1e3705d", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"failure\",\n\t\"name\": \"create-for-400\",\n\t\"abbreviation\": \"cf4\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure create missing parameter abbreviation 400", - "event": [ - { - "listen": "test", - "script": { - "id": "cedf3458-2122-4616-ab6e-399234e4a529", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_PAYMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"failure\",\n\t\"name\": \"create-for-400\",\n\t\"isActive\": false,\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, + "path": [ + "challenges", + "{{CHALLENGE_UUID_PAYMENT}}" + ] + } + }, + "response": [] + }, + { + "name": "Assign Member", + "event": [ { - "name": "failure create without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "c7670adb-561c-467e-a3d9-df01f00b9d89", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_PAYMENT_MEMBER_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_PAYMENT_MEMBER_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-copilot\",\n\t\"description\": \"test-value\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_PAYMENT}}\",\n \"memberHandle\": \"{{MEMBER_HANDLE}}\",\n \"roleId\": \"{{ROLE_SUBMITTER}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure create with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "322e6746-4af8-45a2-aa9f-e2bd8707e416", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-copilot\",\n\t\"description\": \"test-value\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Assign Copilot", + "event": [ { - "name": "failure create with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "6158be51-9376-489f-b8d3-258720990999", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_PAYMENT_COPILOT_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_PAYMENT_COPILOT_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-copilot\",\n\t\"description\": \"test-value\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_PAYMENT}}\",\n \"memberHandle\": \"{{COPILOT_HANDLE}}\",\n \"roleId\": \"{{ROLE_COPILOT}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure create via user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "bd232125-fde7-41ea-919b-38fd92f296c8", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-copilot\",\n\t\"description\": \"test-value\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Get Resources on Challenge", + "event": [ { - "name": "failure create duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "1a860845-a887-47a4-8f65-29fcc9ab4e40", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " const member = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_PAYMENT_MEMBER_UUID')})\r", + " pm.expect(member).to.have.length(1)\r", + " pm.expect(member[0].memberId).to.eq(pm.environment.get('CHALLENGE_PAYMENT_MEMBER_ID'))\r", + " pm.expect(member[0].memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(member[0].roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + " const copilot = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_PAYMENT_COPILOT_UUID')})\r", + " pm.expect(copilot).to.have.length(1)\r", + " pm.expect(copilot[0].memberId).to.eq(pm.environment.get('CHALLENGE_PAYMENT_COPILOT_ID'))\r", + " pm.expect(copilot[0].memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(copilot[0].roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"type-NAME-1\",\n\t\"description\": \"test-value\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abb121212\",\n\t\"legacyId\": 123121212\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "create using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "33d3f280-2508-4ba3-8209-477f1a74e8c4", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TYPE_M2M_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources?challengeId={{CHALLENGE_UUID_PAYMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_types_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-m2m\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb565656\",\n\t\"legacyId\": 123565656\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] - }, - { - "name": "failure create using forbidden m2m 403", - "event": [ + "path": [ + "resources" + ], + "query": [ { - "listen": "test", - "script": { - "id": "7091b689-3c7a-4f31-a9e7-d7dd27dc837f", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } + "key": "challengeId", + "value": "{{CHALLENGE_UUID_PAYMENT}}" } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"create-by-m2m\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ] - } - }, - "response": [] + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "search challenge types", - "item": [ - { - "name": "search challenge types 1", - "event": [ - { - "listen": "test", - "script": { - "id": "fb366992-5730-4af8-980a-a331df48247c", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/Challenge-types?name=-name-&description=cri&isActive=true&abbreviation=abb&legacyId=123", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ], - "query": [ - { - "key": "name", - "value": "-name-" - }, - { - "key": "description", - "value": "cri" - }, - { - "key": "isActive", - "value": "true" - }, - { - "key": "abbreviation", - "value": "abb" - }, - { - "key": "legacyId", - "value": "123" - } - ] - } - }, - "response": [] - }, - { - "name": "search challenge types 2", - "event": [ - { - "listen": "test", - "script": { - "id": "4f9a4d7b-49c7-4c12-9711-146153feb51a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/Challenge-types?isActive=true&page=2&perPage=2", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ], - "query": [ - { - "key": "isActive", - "value": "true" - }, - { - "key": "page", - "value": "2" - }, - { - "key": "perPage", - "value": "2" - } - ] - } - }, - "response": [] - }, + "name": "Activate challenge", + "event": [ { - "name": "search challenge types invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "8f937b24-df04-49a7-8745-7c0abdbff68c", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "prerequest", + "script": { + "exec": [ + "var url = `${pm.environment.get('URL')}/challenges/${pm.environment.get('CHALLENGE_UUID_PAYMENT')}`\r", + "var retryDelay = 5000;\r", + "var retryLimit = 5;\r", + "var awaken = false\r", + "// wait for legacy challenge processor to finish it's work\r", + "function isProcessingComplete(retryCount) {\r", + " pm.sendRequest({url: url,\r", + " method: \"GET\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " }}, function (err, response) {\r", + " if(err) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " }\r", + " } else {\r", + " if(!response.json().legacyId) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " } else if (!awaken) {\r", + " wakeLegacyProcessor()\r", + " retryLimit *= 2\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay)\r", + " }\r", + " }\r", + " }\r", + " });\r", + "}\r", + "\r", + "function wakeLegacyProcessor() {\r", + " pm.sendRequest({url: url,\r", + " method: \"PATCH\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " },\r", + " body: {status: \"Draft\"}\r", + " }, function () {\r", + " awaken= true\r", + " });\r", + "}\r", + "\r", + "isProcessingComplete(1);" ], - "url": { - "raw": "{{URL}}/Challenge-types?invalid=test", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ], - "query": [ - { - "key": "invalid", - "value": "test" - } - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "search challenge types invalid parameter isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "4dec026f-9d73-4daa-ad0f-451c5ff45e9a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')\r", + " pm.expect(response.legacy.subTrack).to.eq('FIRST_2_FINISH')\r", + " pm.expect(response.name).to.eq('Postman Task Test 1')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.task.isTask).to.be.true\r", + " pm.expect(response.task.isAssigned).to.be.true\r", + " pm.expect(Number(response.task.memberId)).to.eq(Number(pm.environment.get('CHALLENGE_PAYMENT_MEMBER_ID')))\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Task')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/Challenge-types?isActive=test", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ], - "query": [ - { - "key": "isActive", - "value": "test" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Active\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "search challenge types invalid parameter legacyId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "032f11a8-adce-4823-8b02-feae01e78f1c", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_PAYMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/Challenge-types?legacyId=-5678", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types" - ], - "query": [ - { - "key": "legacyId", - "value": "-5678" - } - ] - } - }, - "response": [] + "path": [ + "challenges", + "{{CHALLENGE_UUID_PAYMENT}}" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "get challenge type", - "item": [ + "name": "Close task", + "event": [ { - "name": "get challenge type 1", - "event": [ - { - "listen": "test", - "script": { - "id": "448148d3-0c07-4941-a7d6-e723065ac7c8", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')\r", + " pm.expect(response.legacy.subTrack).to.eq('FIRST_2_FINISH')\r", + " pm.expect(response.name).to.eq('Postman Task Test 1')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Completed')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.task.isTask).to.be.true\r", + " pm.expect(response.task.isAssigned).to.be.true\r", + " pm.expect(Number(response.task.memberId)).to.eq(Number(pm.environment.get('CHALLENGE_PAYMENT_MEMBER_ID')))\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Task')\r", + " pm.expect(response).to.have.property('legacyId')\r", + " pm.expect(Number(response.winners[0].userId)).to.eq(Number(pm.environment.get('CHALLENGE_PAYMENT_MEMBER_ID')))\r", + " pm.expect(response.winners[0].handle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.winners[0].placement).to.eq(1)\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Completed\",\n \"winners\": [\n {\n \"userId\": {{CHALLENGE_PAYMENT_MEMBER_ID}},\n \"handle\": \"{{MEMBER_HANDLE}}\",\n \"placement\": 1\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "get challenge type 2", - "event": [ - { - "listen": "test", - "script": { - "id": "7a5dd57a-15dd-4cc2-90d9-9e6d789b8886", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_PAYMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_PAYMENT}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Process a payment for a task with the \"pureV5Task\" set to true", + "item": [ + { + "name": "Create Task", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "if(pm.response.status === 'Created') {", + " const response = pm.response.json();", + " pm.environment.set('CHALLENGE_UUID_PAYMENT_V5', response.id);", + " pm.expect(response).to.have.property('created')", + " pm.expect(response.createdBy).to.eq('tcwebservice')", + " pm.expect(response).to.have.property('updated')", + " pm.expect(response.updatedBy).to.eq('tcwebservice')", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')", + " pm.expect(response.legacy.pureV5Task).to.be.true", + " pm.expect(response.legacy).to.have.property('directProjectId')", + " pm.expect(response.name).to.eq('Postman Pure V5 Task Test 2')", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")", + " pm.expect(response.privateDescription).to.eq('private description')", + " pm.expect(response.descriptionFormat).to.eq('markdown')", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')", + " pm.expect(response.prizeSets[0].type).to.eq('placement')", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')", + " pm.expect(response.tags[0]).to.eq('Other')", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))", + " pm.expect(response).to.have.property('startDate')", + " pm.expect(response.status).to.eq('Draft')", + " pm.expect(response).to.have.property('billing')", + " pm.expect(response.task.isTask).to.be.true", + " pm.expect(response.task.isAssigned).to.be.false", + " pm.expect(response.task.memberId).to.be.null", + " pm.expect(response.phases[0].name).to.eq('Submission')", + " pm.expect(response.phases[1].name).to.eq('Iterative Review')", + " pm.expect(response.phases[2].name).to.eq('Approval')", + " pm.expect(response).to.have.property('endDate')", + " pm.expect(response.overview.totalPrizes).to.eq(1)", + " pm.expect(response.numOfSubmissions).to.eq(0)", + " pm.expect(response.numOfRegistrants).to.eq(0)", + " pm.expect(response).to.have.property('currentPhaseNames')", + " pm.expect(response).to.have.property('submissionStartDate')", + " pm.expect(response).to.have.property('submissionEndDate')", + " pm.expect(response.track).to.eq('Development')", + " pm.expect(response.type).to.eq('Task')", + "}", + "" ], - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "failure get challenge type invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "62699556-141e-4dc2-b29b-da5cf2aa4142", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "prerequest", + "script": { + "exec": [ + "" ], - "url": { - "raw": "{{URL}}/Challenge-types/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "invalid-id" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"typeId\": \"{{TYPE_TASK}}\",\n \"trackId\": \"{{TRACK_DEVELOPMENT}}\",\n \"legacy\": {\n \"pureV5Task\": true,\n \"reviewType\": \"INTERNAL\"\n },\n \"name\": \"Postman Pure V5 Task Test 2\",\n \"description\": \"Here's a large description with **markdown**\",\n \"privateDescription\": \"private description\",\n \"descriptionFormat\": \"markdown\",\n \"timelineTemplateId\": \"{{TIMELINE_TEMPLATE_TASK}}\",\n \"prizeSets\": [\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Challenge Prizes\",\n \"type\": \"placement\"\n },\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Copilot Payment\",\n \"type\": \"copilot\"\n }\n ],\n \"tags\": [\n \"Other\"\n ],\n \"projectId\": {{PROJECT_ID}},\n \"startDate\": \"{{tenMinFromNow}}\",\n \"status\": \"Draft\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure get challenge type not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "feedb455-6ceb-4272-adce-1018e4428179", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/Challenge-types/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] + "path": [ + "challenges" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "partial update challenge type", - "item": [ + "name": "Get Created Task", + "event": [ { - "name": "partial update challenge type 1", - "event": [ - { - "listen": "test", - "script": { - "id": "e70bb7ac-f4e1-4da3-a3b4-1d2fb5347216", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT_V5'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')\r", + " pm.expect(response.legacy.pureV5Task).to.be.true\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.name).to.eq('Postman Pure V5 Task Test 2')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Draft')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.task.isTask).to.be.true\r", + " pm.expect(response.task.isAssigned).to.be.false\r", + " pm.expect(response.task.memberId).to.be.null\r", + " pm.expect(response.phases[0].name).to.eq('Submission')\r", + " pm.expect(response.phases[1].name).to.eq('Iterative Review')\r", + " pm.expect(response.phases[2].name).to.eq('Approval')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(0)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Task')\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\",\n\t\"legacyId\": 123787811\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "partial update challenge type 2", - "event": [ - { - "listen": "test", - "script": { - "id": "db97c7e9-1e8f-4332-97e7-c97e22aa6e93", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{copilot1_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"add-description\",\n\t\"isActive\": true,\n\t\"abbreviation\": \"abbxxxyyzz11\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge type invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "6271e96f-7b9b-4394-9850-b549c7778e03", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_PAYMENT_V5}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_PAYMENT_V5}}" + ] + } + }, + "response": [] + }, + { + "name": "Assign Member", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_PAYMENT_V5_MEMBER_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_PAYMENT_V5_MEMBER_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT_V5'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "invalid-id" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_PAYMENT_V5}}\",\n \"memberHandle\": \"{{MEMBER_HANDLE}}\",\n \"roleId\": \"{{ROLE_SUBMITTER}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge type invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "9f1bde9f-4e85-42cc-9479-7f70948e0167", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Assign Copilot", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_PAYMENT_V5_COPILOT_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_PAYMENT_V5_COPILOT_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT_V5'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 1234,\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_PAYMENT_V5}}\",\n \"memberHandle\": \"{{COPILOT_HANDLE}}\",\n \"roleId\": \"{{ROLE_COPILOT}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge type invalid parameter description 400", - "event": [ - { - "listen": "test", - "script": { - "id": "30409a09-601f-4446-ac3d-a7cbbcf13e6d", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"1234\",\n\t\"description\": 1234\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type invalid parameter isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "d871dabc-495b-43d2-8174-41b7107aded2", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"1234\",\n\t\"isActive\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type invalid parameter abbreviation 400", - "event": [ - { - "listen": "test", - "script": { - "id": "8422a94a-2916-41ff-9d8d-2ff8e4f233ea", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"abbreviation\": 1234\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type invalid parameter legacyId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "5afe42e9-fee2-490f-87f9-69ab75d4271c", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"legacyId\": -1234\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "ff624a83-a885-45f3-ba9b-bcae15a63558", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "9442df3a-8921-47f5-9600-3bf81a6441cf", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "0551e2b6-207e-4489-9c77-061c658f6977", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type via user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "cd321a09-5d85-474a-a7c0-d34da4c1ee0c", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "2dc0d8e7-865b-4645-b7f5-e64a7f50ea57", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "91fce390-b336-40b4-9674-25efb9343e24", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"TYPE-name-1\",\n\t\"description\": \"update-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type duplicate abbreviation 409", - "event": [ - { - "listen": "test", - "script": { - "id": "72978839-536b-480b-b7b6-ba9d207baf24", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"abbreviation\": \"abbxxxyyzz11\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type duplicate legacyId 409", - "event": [ - { - "listen": "test", - "script": { - "id": "134c4cf9-bdab-48e1-85f2-048404899705", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"legacyId\": 222\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge type using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "cfb7a35f-5d47-44b8-9122-9817d9dd14ed", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_types_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"patch-by-m2m\",\n\t\"description\": \"patch-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TEST_TYPE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TEST_TYPE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge type using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "7df16d18-e0ec-4b82-9212-f66557bd7f55", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"patch-by-m2m\",\n\t\"description\": \"patch-description\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TEST_TYPE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TEST_TYPE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "update challenge type", - "item": [ - { - "name": "update challenge type 1", - "event": [ - { - "listen": "test", - "script": { - "id": "7c889e29-f72f-4719-bd11-188bf0237e28", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-1789\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb789\",\n\t\"legacyId\": 789\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge type 2", - "event": [ - { - "listen": "test", - "script": { - "id": "c637ec2a-20e7-4ccf-ada6-a5b778472e88", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot2_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb56756\",\n\t\"legacyId\": 12356756\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "4f795220-5ac6-40cf-821d-cb9400cb2ef1", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "00746bd2-ceaf-498b-9768-dda74fdb115e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"test-name\",\n\t\"description\": 12345,\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": \"abc\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type invalid parameter name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "30a634ca-5fe2-42b3-aee5-f22e6572056a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 123,\n\t\"description\": \"12345\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": \"abc\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type invalid parameter inactive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "0e43972a-d39f-4436-8a19-d11ac9613cbf", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"test-name\",\n\t\"description\": \"12345\",\n\t\"isActive\": 123,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": \"abc\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type invalid parameter abbreviation 400", - "event": [ - { - "listen": "test", - "script": { - "id": "636091e8-95e1-4ff9-ba10-5f80b4c7b6b5", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"test-name\",\n\t\"description\": \"12345\",\n\t\"isActive\": false,\n\t\"abbreviation\": 123445,\n\t\"legacyId\": \"abc\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type invalid parameter legacyId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "bd84a6db-bb35-4b39-8e26-c8c84e6cf129", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"test-name\",\n\t\"description\": \"12345\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"123445\",\n\t\"legacyId\": \"abc\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type missing parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "a14d1893-b3ad-46f8-9e3c-f93cadbb4dae", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"update-description2\",\n\t\"isActive\": false\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type missing parameter isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "b389fe7e-b776-448a-8a6a-54f090a77c66", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update\",\n\t\"abbreviation\": \"123\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type missing parameter abbreviation 400", - "event": [ - { - "listen": "test", - "script": { - "id": "7e02cb85-0295-4d30-8598-ae85700eade7", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update\",\n\t\"isActive\": false\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "99e0f142-231d-45d3-9d82-1cb0a16fbcac", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "c17c43b1-723e-41d2-a172-9c9fb5028deb", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "491ad2c1-6c70-42e3-888e-00a3713335dd", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{expire_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type via user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "7ea6fdb0-02ae-42e4-a5b3-99fde1d9f6e1", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{user_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "47eb4874-ffe7-4378-9b16-d16d5f02e7d4", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-name-2\",\n\t\"description\": \"update-description2\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb\",\n\t\"legacyId\": 123\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "706585f5-0455-4c76-89d6-9d990a22929f", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"TYPE-name-2\",\n\t\"description\": \"description\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abbaaabb34342\",\n\t\"legacyId\": 12322338899\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type duplicate legacyId 409", - "event": [ - { - "listen": "test", - "script": { - "id": "768bfd1c-48ec-498f-aed2-592d49d53277", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"TYPE-name-2-aaaa-bb\",\n\t\"description\": \"description\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abbaxxabb34342\",\n\t\"legacyId\": 789\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type duplicate abbreviation 409", - "event": [ - { - "listen": "test", - "script": { - "id": "d0f7ab9f-0368-4d23-be73-08aaf8395703", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"TYPE-name-2-aaaa-bb\",\n\t\"description\": \"description\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb1\"\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TYPEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TYPEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge type using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "7cd4997d-873b-4f68-8f5e-e03cbc0662b6", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_types_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-by-m2m-aabbcc\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb29293939\",\n\t\"legacyId\": 12329293939\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TEST_TYPE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TEST_TYPE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "505f7eda-0477-4726-b7dd-bb10ef2e413e", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-by-m2m-aabbcc\",\n\t\"isActive\": false,\n\t\"abbreviation\": \"abb29293939\",\n\t\"legacyId\": 12329293939\n}" - }, - "url": { - "raw": "{{URL}}/Challenge-types/{{TEST_TYPE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "Challenge-types", - "{{TEST_TYPE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "ChallengePhases", - "item": [ - { - "name": "create challenge phase", - "item": [ - { - "name": "create phase 1", - "event": [ - { - "listen": "test", - "script": { - "id": "42e2c954-6908-4188-97d0-a0be4bf45c43", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"PHASEA_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-1\",\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase 2", - "event": [ - { - "listen": "test", - "script": { - "id": "c128c1a5-5ab8-4a21-b9fa-23341d47d0c2", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"PHASEB_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-2\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase 3", - "event": [ - { - "listen": "test", - "script": { - "id": "69c8a7f3-2538-4160-ac9c-5595bf175b82", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"PHASEC_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-3\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create inactive phase", - "event": [ - { - "listen": "test", - "script": { - "id": "314b01fd-63c7-4334-aa10-403fd95dede4", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"PHASED_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-4\",\n\t\"isOpen\": false,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase with invalid description 400", - "event": [ - { - "listen": "test", - "script": { - "id": "50207ea1-d4d1-4fb0-9e05-9a7044af69d8", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - " pm.environment.set(\"PHASED_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"4444\",\n\t\"description\": 1111,\n\t\"isOpen\": false,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase with invalid name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "da40043e-f868-43c4-a006-885a574b1d0d", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - " pm.environment.set(\"PHASED_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 4444,\n\t\"isOpen\": false,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase with invalid isOpen 400", - "event": [ - { - "listen": "test", - "script": { - "id": "1984b50c-b3da-40be-a9ce-9e4057ac1d3e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - " pm.environment.set(\"PHASED_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"4444\",\n\t\"isOpen\": 10000,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase with invalid duration 400", - "event": [ - { - "listen": "test", - "script": { - "id": "33793796-e2dd-4df2-bb7e-45ef7ccb7b61", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - " pm.environment.set(\"PHASED_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"4444\",\n\t\"isOpen\": true,\n\t\"duration\": \"invalid\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase missing parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "0fe0a8e6-aff1-47fa-805a-2ca5f1b4afaa", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase missing parameter isOpen 400", - "event": [ - { - "listen": "test", - "script": { - "id": "5ee00d82-699d-42f4-913a-e3e815c2c4d7", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-5\",\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase missing parameter duration 400", - "event": [ - { - "listen": "test", - "script": { - "id": "13700b83-83c3-4db7-b461-52d3ed398f6e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-5\",\n\t\"isOpen\": true\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "a8276566-98d9-4045-bbac-29122f12cf58", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-1\",\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "2fd3586b-70a7-47f9-a513-c85347ce199e", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-1\",\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "37bbaf56-d208-40bf-9a34-1ad34cfce354", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-1\",\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase via copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "b4393b42-3f5f-4243-8e16-b9084e54dba7", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-1\",\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "0fa2571a-6094-457d-9d24-acd13a798523", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"PHASE-1\",\n\t\"description\": \"has-description\",\n\t\"isOpen\": true,\n\t\"duration\": 100000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "create phase using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "7da88439-b9de-424f-8b8d-ed5227386fed", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_PHASE_M2M_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_phases_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-by-m2m\",\n\t\"description\": \"m2m-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "failure create phase using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "a80aca3a-bf82-49f1-b76c-121db0f9edd2", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phase-by-m2m\",\n\t\"description\": \"m2m-description\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "search challenge phases", - "item": [ - { - "name": "search challenge phases by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "736f1543-818a-4842-91a1-99480778fdca", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases?name=ph", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ], - "query": [ - { - "key": "name", - "value": "ph" - } - ] - } - }, - "response": [] - }, - { - "name": "search challenge phases with page parameter by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "aca66791-5edf-436d-b96e-774912587b53", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases?name=ph&page=1&perPage=2", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ], - "query": [ - { - "key": "name", - "value": "ph" - }, - { - "key": "page", - "value": "1" - }, - { - "key": "perPage", - "value": "2" - } - ] - } - }, - "response": [] - }, - { - "name": "search challenge phases by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "1665fddf-ad8b-4706-a8cc-d7dae3f69a38", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "search challenge phases without token", - "event": [ - { - "listen": "test", - "script": { - "id": "5283415b-f0d4-442e-98f2-6c1f3fb37ed6", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ] - } - }, - "response": [] - }, - { - "name": "search challenge phases using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "0a27bc70-d2d6-4296-98a4-f0fc16a0628b", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_phases_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases?name=ph", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ], - "query": [ - { - "key": "name", - "value": "ph" - } - ] - } - }, - "response": [] - }, - { - "name": "search challenge phases invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "572f68b3-7787-43ff-8008-b9ec9ce23b01", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases?invalid=test", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases" - ], - "query": [ - { - "key": "invalid", - "value": "test" - } - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "get challenge phase", - "item": [ - { - "name": "get challenge phase by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "ea0ac618-a9ca-4968-9d15-104ed7d8f4be", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{copilot1_token}}", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "7332eb5e-1056-40de-a464-5e5a64ebb9d3", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "54528572-6e46-469d-a7f8-95865caa4356", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "31236c3c-25b5-4a27-8b74-16960ea33abb", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "99386bd3-af20-44d2-8469-fccc132572f1", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "c8a85b2f-e57d-4d4b-8007-953236208b54", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase by user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "687e62aa-94a8-426c-b2e2-f3bc6bae8c3f", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "fb5fd957-f235-4683-9b91-1b7705571b74", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge phase using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "70ec2ee8-6524-4cd4-af2c-54b38f903b77", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_phases_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge phase using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "16ed7228-0575-4a96-89cd-e5fb90b57f84", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "partial update challenge phase", - "item": [ - { - "name": "partial update challenge phase 1", - "event": [ - { - "listen": "test", - "script": { - "id": "2ab1d827-f127-450c-ab95-53cb1cf45f97", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge phase 2", - "event": [ - { - "listen": "test", - "script": { - "id": "ebd0dbb3-57d3-49ce-9f62-04701e92a487", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-2\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "fd4ec411-d473-4476-9140-de9f6f3a8142", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase invalid name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "e8f7b033-9595-43fd-8887-71d42fb23e0f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 199,\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase invalid description 400", - "event": [ - { - "listen": "test", - "script": { - "id": "c236da2c-7e75-487f-baf8-cef3a0223c24", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"description\": 5000,\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase invalid isOpen 400", - "event": [ - { - "listen": "test", - "script": { - "id": "b713b3f4-2c7b-4c03-a7b1-eaecebad9f47", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": 1,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase invalid duration 400", - "event": [ - { - "listen": "test", - "script": { - "id": "d4b6a909-9850-4030-920c-68509e825773", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": \"1day\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "4b3f7d32-4f89-4978-8732-7746a940a7b6", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "ef9f4b08-d6aa-4887-932d-beb81c66cb67", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "735939a3-7115-434a-845c-8c1fe09e1ede", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase by copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "4d3cc0b8-4c65-4189-bf0f-fbd3527c177e", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "926336b2-dd56-4a44-b675-b2872a798432", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge phase duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "926c422b-6102-414d-900d-aaf8e4ee1e06", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-PHASE-2\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge phase using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "cd97002a-9c0f-4d41-9b0e-c865b0871dea", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_phases_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-by-m2m\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge phase using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "e9211a91-36ff-4c63-8c14-a9d2a6ffe094", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-phase-by-m2m\",\n\t\"isOpen\": true,\n\t\"duration\": 50000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "update challenge phase", - "item": [ - { - "name": "update challenge phase 1", - "event": [ - { - "listen": "test", - "script": { - "id": "b7dcdef6-ed6e-43cf-a10c-ee8c48a3a4fc", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase 2", - "event": [ - { - "listen": "test", - "script": { - "id": "0baac82c-f7e2-4fb7-8eac-6fa6750e1d29", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-PHASE-2\",\n\t\"description\": \"add-description-in-put\",\n\t\"isOpen\": true,\n\t\"duration\": 10000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "922efa1d-5e41-4714-879d-78dc9a628502", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "a0d47ae6-3907-41d5-9d82-e7094a376ebe", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 12345,\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "c9edb08f-c47d-4aa5-887f-f68bca7648b5", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "fb45eb42-48e5-47d6-ab54-3544e36fc85f", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "ecb4488e-de95-4254-813a-a941ae0cb7ca", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "78ad1685-a94d-4e76-a071-9ddb71ddde65", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-1\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "db77c955-84cb-4ae7-8e80-e9cc1dbc9183", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"phAse-3\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge phase using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "7d4fe552-68f9-4a7c-b371-8d8c42b3f837", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_phases_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-by-m2m\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge phase using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "2f218d71-d267-4d35-afe6-2c47e7833de3", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-phase-by-m2m\",\n\t\"isOpen\": true,\n\t\"duration\": 20000\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "delete challenge phase", - "item": [ - { - "name": "delete challenge phase", - "event": [ - { - "listen": "test", - "script": { - "id": "f284f8a9-b228-47bc-9b21-958f940eafde", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "1583e9a2-20e7-49a8-ab4a-9bc18dcf811e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "ff46a670-db93-41a3-b651-e5051152238d", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "6269ffa0-ff8a-4294-9cc1-b50cbdb9ca92", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "a5c1eeea-205e-4a18-af5b-5f2357f56b14", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{expire_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase by copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "1779e3b9-3e6e-47c1-9e51-c445cb67daac", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{PHASEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{PHASEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "c268908d-c872-4aa7-bf49-f1cdbbf316ff", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "delete challenge phase using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "2a02b071-1484-4648-9d7d-4493a099374b", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_phases_delete}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge phase using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "22d1f7b9-227b-47ad-970e-38ec032dd80d", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-phases/{{TEST_PHASE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-phases", - "{{TEST_PHASE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "TimelineTemplates", - "item": [ - { - "name": "create timeline template", - "item": [ - { - "name": "create timeline template", - "event": [ - { - "listen": "test", - "script": { - "id": "8444cc8c-3712-4791-acf6-7a346fbf9c38", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEMPLATEA_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "create inactive timeline template", - "event": [ - { - "listen": "test", - "script": { - "id": "543c9db7-462e-4861-9f18-9c7a554c076a", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEMPLATEB_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-2\",\n \"isActive\": false,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "create timeline template for delete testing later", - "event": [ - { - "listen": "test", - "script": { - "id": "9184dd19-ee9d-460c-968a-029b4dc27857", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEMPLATEC_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-3\",\n \"description\": \"desc-3\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template contain invalid phase 400", - "event": [ - { - "listen": "test", - "script": { - "id": "12945376-af52-4b1e-9f46-0d9fe663309a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-4\",\n \"description\": \"desc-4\",\n \"isActive\": true,\n \"phases\": [\n {\n \"id\": \"{{PHASED_ID}}\",\n \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template invalid name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "f1d4afb6-227f-418c-a32d-8002a0a2699c", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 1234,\n \"description\": \"desc-4\",\n \"isActive\": true,\n \"phases\": [\n {\n \"id\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template invalid description 400", - "event": [ - { - "listen": "test", - "script": { - "id": "441be53b-63ee-4c40-8152-d73979259902", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-4\",\n \"description\": 1234,\n \"isActive\": true,\n \"phases\": [\n {\n \"id\": \"{{PHASED_ID}}\",\n \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template invalid isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "dbf9a89f-16b0-4a26-b28a-57aad7d70f08", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-4\",\n \"isActive\": \"active\",\n \"phases\": [\n {\n \"id\": \"{{PHASED_ID}}\",\n \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template missing name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "819ff68f-3466-472e-ac0f-f477bf6dd501", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"isActive\": true,\n \"phases\": [\n {\n \"id\": \"{{PHASED_ID}}\",\n \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template missing isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "852af32c-1fc2-4dd9-b74e-0bc4ef1ba96e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-4\",\n \"phases\": [\n {\n \"id\": \"{{PHASED_ID}}\",\n \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template invalid phases 400", - "event": [ - { - "listen": "test", - "script": { - "id": "87e207c2-913b-4eb4-9497-556765fa9fa9", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-4\",\n \"isActive\": true\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "9d2aee02-56f4-466b-9223-a7f31a0e8273", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "35753365-fe17-488a-869d-b64cbcbfa1fb", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "9312480b-0e55-4070-aaf4-0f9ea8f224d5", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template by copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "1607f7e4-cb2e-4e23-80af-3b8d8ccc85e8", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "82c25bcb-1adc-42cf-9f13-615b11531f89", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"tempLATE-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "create timeline template using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "ea797522-7ea8-4176-9bea-89ff0517f943", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_TEMPLATE_M2M_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_timeline_templates_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-by-m2m\",\n \"description\": \"desc-by-m2m\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - }, - { - "name": "failure create timeline template using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "946c9828-7ccf-4a07-949f-17193fa032d5", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-by-m2m\",\n \"description\": \"desc-by-m2m\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "search timeline templates", - "item": [ - { - "name": "search timeline template by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "0a961028-2e48-448b-a156-3324a1aa4f22", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates?name=1", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ], - "query": [ - { - "key": "name", - "value": "1" - } - ] - } - }, - "response": [] - }, - { - "name": "search timeline template with page by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "2d20cd24-8679-422f-8ac4-e3cb418abe34", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates?page=1&perPage=2", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "perPage", - "value": "2" - } - ] - } - }, - "response": [] - }, - { - "name": "search timeline template by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "dfce59c9-c675-474d-8c1c-ba03f3bb9285", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates?name=LA", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ], - "query": [ - { - "key": "name", - "value": "LA" - } - ] - } - }, - "response": [] - }, - { - "name": "failure search timeline template invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "5f619fdc-d92e-4f18-8fba-d40905020103", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates?invalid=test", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates" - ], - "query": [ - { - "key": "invalid", - "value": "test" - } - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "get timeline template", - "item": [ - { - "name": "get timeline template by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "2c1dcb4c-aca9-4380-80ff-b941bd76e5ad", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get timeline template by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "0bcc598d-2100-4a54-8236-c06c754f906a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "d599168f-864e-4c01-bcdb-209baa035a69", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "178b3fe4-d7d9-4aff-921c-ccba77d027db", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "63dc7e78-ffa4-455f-9123-a056120640b1", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "9b8785c0-02c5-4059-90e3-cc4b0bf34751", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template by user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "b29c7626-585a-4c64-8ee3-39755776b80a", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "d3b52ffd-2f2d-47e7-9d20-d4597d9e253b", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get timeline template using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "167354ff-1e8d-42fc-8946-1faad8288a79", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_timeline_templates_read}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get timeline template using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "1b0a4547-d48b-4e1f-902f-7fdd9e2ba387", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "partial update timeline template", - "item": [ - { - "name": "partial update timeline template 1", - "event": [ - { - "listen": "test", - "script": { - "id": "34e63305-05c8-4ef6-b5f1-b7386541dbb6", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update timeline template 2", - "event": [ - { - "listen": "test", - "script": { - "id": "3fe3d397-9d83-4beb-91d2-26f4f69cc4b9", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-2\",\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template phases can't be empty 400", - "event": [ - { - "listen": "test", - "script": { - "id": "bd0622a0-e1f6-45ad-a69a-14b2a0f32314", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\",\n \"phases\": []\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template invalid name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "db7d4aa4-97f4-4586-abf8-bce9ead6b016", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 1234\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template invalid description 400", - "event": [ - { - "listen": "test", - "script": { - "id": "d746d0e7-0440-481a-8bf0-ca0065392033", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": 111111\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template invalid isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "b71292dc-c5fc-4008-80d6-94994aafc618", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"isActive\": 111111\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "1e59592e-1cd4-4ca4-b0a5-7650a742dd6c", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "cc240788-dfe5-4dd6-9e85-7cf3e2e3a3df", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "5f6700c5-9df9-49d6-bf34-c758929ddfae", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template by copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "5fc77a04-7c43-44bc-baab-e97e97c682e4", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "82501a37-0afc-49db-a9b9-55508ebd95ce", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "1489f235-cb54-4847-a328-1fb189173669", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-2\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update timeline template using m2m token", - "event": [ - { - "listen": "test", - "script": { - "id": "7237cf0b-1f2e-4784-a9c1-5ea79ee27f40", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_timeline_templates_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-m2m\",\n \"description\": \"new-desc-m2m\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update timeline template using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "36a1792d-0855-43a9-80ff-389a8dc73bdb", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"new-template-1\",\n \"description\": \"new-desc-1\"\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "update timeline template", - "item": [ - { - "name": "update timeline template 1", - "event": [ - { - "listen": "test", - "script": { - "id": "b9f2b4d1-53d6-45e8-a418-ad147c167f38", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update timeline template 2", - "event": [ - { - "listen": "test", - "script": { - "id": "9788b5b3-9cca-407b-9d99-58dde83e86df", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-2\",\n \"isActive\": false,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEB_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEB_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template incorrect phase 400", - "event": [ - { - "listen": "test", - "script": { - "id": "538a5834-af0c-496e-bf85-eb6b3b715517", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-3\",\n \"isActive\": false,\n \"phases\": [\n {\n \"id\": \"{{SETTINGA_ID}}\",\n \"name\": \"new-PHASE-2\",\n \"description\": \"add-description-in-put\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n \t\"isActive\": true,\n\t \"duration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template invalid id", - "event": [ - { - "listen": "test", - "script": { - "id": "e432c7ab-6d07-4449-9af9-eca16451a39b", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template invalid name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "cbbfa465-1126-4d58-8caa-dbc215aaeaca", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": 1221,\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template invalid description 400", - "event": [ - { - "listen": "test", - "script": { - "id": "20a7dcd2-38b1-4f77-a263-506a4425f3f2", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": 11121,\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template invalid isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "44afcc60-7c52-438e-a97d-a434f08f23c8", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": 123,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template missing name 400", - "event": [ - { - "listen": "test", - "script": { - "id": "97b5de89-ab8f-4374-8cbe-acc14528114a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template missing isActive 400", - "event": [ - { - "listen": "test", - "script": { - "id": "045b394b-9640-450b-ba70-a96c26060bcd", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template missing phases 400", - "event": [ - { - "listen": "test", - "script": { - "id": "39b406cb-8701-4636-a82c-25e43cb74742", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "9acc6d2a-3c20-471b-8a75-971e5af211cd", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "0444594e-55bd-4af8-8b5f-77e35d498066", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "2ae99635-299e-4918-bdd1-7d4f4e281953", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template by copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "7ae52fd9-0a10-436d-ab2b-861ced62562d", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "da632e94-accf-45a0-92b4-637aed84cc15", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"template-1\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template duplicate name 409", - "event": [ - { - "listen": "test", - "script": { - "id": "2f175dc8-bf40-4576-8920-c71601e88b03", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"TEMPlate-2\",\n \"description\": \"desc-1\",\n \"isActive\": true,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update timeline template using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "c7b0d926-46c3-4edd-9dcd-46c2b27b2edf", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_timeline_templates_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-template-by-m2m\",\n \"description\": \"update-desc-by-m2m\",\n \"isActive\": false,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n\t \"predecessor\": \"{{PHASEA_ID}}\",\n\t \"defaultDuration\": 10000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update timeline template using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "e5002a83-40d7-4d2c-b37c-b11abf356f5b", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-template-by-m2m\",\n \"description\": \"update-desc-by-m2m\",\n \"isActive\": false,\n \"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"defaultDuration\": 20000\n }\n ]\n}\n" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "delete timeline template", - "item": [ - { - "name": "delete timeline template", - "event": [ - { - "listen": "test", - "script": { - "id": "f9db53dd-ead1-4154-90d4-9f90a98a3d4d", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "0bad30b0-eb84-4920-92aa-d4ca6322e552", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "invalid-id" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "0bb897c1-df3d-4757-a5fb-7110a3dbb25c", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "0ce6b225-3f40-447e-a608-70223b63031c", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "191fdcc1-1f6d-4488-b663-7081e6aa74e1", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template by copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "f1d0f348-9eaa-47f8-9e03-29e3133ecd80", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEMPLATEC_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEMPLATEC_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "4727554b-35b4-4283-8560-99d7a8dfe55b", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{SETTINGA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{SETTINGA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "delete timeline template using m2m token", - "event": [ - { - "listen": "test", - "script": { - "id": "de96788b-ddc1-4ed7-a698-b9a3d3212242", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_timeline_templates_delete}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete timeline template using forbidden m2m token 403", - "event": [ - { - "listen": "test", - "script": { - "id": "aca62e68-2905-4c00-ae3c-f9f18568a98c", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/timeline-templates/{{TEST_TEMPLATE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "timeline-templates", - "{{TEST_TEMPLATE_M2M_ID}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "ChallengeTimelineTemplates", - "item": [ - { - "name": "create challenge type timeline template", - "item": [ - { - "name": "create challenge type timeline template", - "event": [ - { - "listen": "test", - "script": { - "id": "62ae9c18-cc9b-4c34-97bc-bff07430794b", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TYPE_TEMPLATEA_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 409 conflict", - "event": [ - { - "listen": "test", - "script": { - "id": "4aa4de30-bccd-4418-84d7-74c0c1aa3e7d", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 400 missing typeId", - "event": [ - { - "listen": "test", - "script": { - "id": "259daf91-fe52-40d0-817e-d5011770796a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 400 missing timelineTemplateId", - "event": [ - { - "listen": "test", - "script": { - "id": "2a4193c6-f97f-4f00-a595-477ce2f26590", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\"\n}" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 400 invalid timelineTemplateId", - "event": [ - { - "listen": "test", - "script": { - "id": "580c5a98-c8c3-4b94-834a-ba08e8660dae", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"invalid\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 400 invalid typeId", - "event": [ - { - "listen": "test", - "script": { - "id": "1c077934-9768-4656-b7fa-7020897b94f3", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"invalid\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 404 with timelineTemplateId does not exist", - "event": [ - { - "listen": "test", - "script": { - "id": "a79d437b-503c-4a46-bfb4-6d505143079a", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"a69033a4-4f18-4765-addc-f48cf61176d9\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 404 with typeId does not exist", - "event": [ - { - "listen": "test", - "script": { - "id": "bf0a1e42-c0ea-4d16-9b30-1dfc2bdd7977", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"a69033a4-4f18-4765-addc-f48cf61176d9\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 401 expired token", - "event": [ - { - "listen": "test", - "script": { - "id": "bdc706a1-2462-44c3-9c84-a7287e6bb838", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 401 without token", - "event": [ - { - "listen": "test", - "script": { - "id": "ba207451-dbb9-4a84-a766-c89e05d2e735", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 401 invalid token", - "event": [ - { - "listen": "test", - "script": { - "id": "669ca84f-74b7-4528-8ecc-6c71af4a1af8", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template - 403 by user", - "event": [ - { - "listen": "test", - "script": { - "id": "9eccd265-27f4-446f-b229-fd6a8fbccb68", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "create challenge type timeline template using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "8710274a-c6db-4b7b-a492-c13eb31a79cb", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_full}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge type timeline template using forbidden m2m 403", - "event": [ - { - "listen": "test", - "script": { - "id": "b732158c-6025-448c-b4f9-aded5f889a06", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "7e6c7de2-ad32-45e7-9881-e0b1be0dcc80", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "314a0724-d45e-4341-bd8d-55214178ed51", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "search challenge type timeline templates", - "item": [ - { - "name": "search challenge type timeline templates by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "45f42bae-45a0-4330-a089-807bed1638ba", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines?typeId={{TYPEA_ID}}&timelineTemplateId={{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ], - "query": [ - { - "key": "typeId", - "value": "{{TYPEA_ID}}" - }, - { - "key": "timelineTemplateId", - "value": "{{TEMPLATEA_ID}}" - } - ] - } - }, - "response": [] - }, - { - "name": "search challenge type timeline templates by m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "dc565125-7eb6-44c6-8e64-1b9ce0a50772", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines?typeId={{TYPEA_ID}}&timelineTemplateId={{TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ], - "query": [ - { - "key": "typeId", - "value": "{{TYPEA_ID}}" - }, - { - "key": "timelineTemplateId", - "value": "{{TEMPLATEA_ID}}" - } - ] - } - }, - "response": [] - }, - { - "name": "failure search challenge type timeline templates - 400 invalid param", - "event": [ - { - "listen": "test", - "script": { - "id": "68b64974-bfa5-423d-9001-12a7b6c3805a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines?other={{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ], - "query": [ - { - "key": "other", - "value": "{{TYPEA_ID}}" - }, - { - "key": "timelineTemplateId", - "value": "{{TEMPLATEA_ID}}", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "failure search challenge type timeline templates - 400 invalid typeId", - "event": [ - { - "listen": "test", - "script": { - "id": "120089e8-2000-4702-b296-f7656ed55b3c", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines?typeId=123", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ], - "query": [ - { - "key": "typeId", - "value": "123" - } - ] - } - }, - "response": [] - }, - { - "name": "failure search challenge type timeline templates - 400 invalid timelineTemplateId", - "event": [ - { - "listen": "test", - "script": { - "id": "e36e2e9f-33b1-4fe2-8253-221cf774f124", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines?timelineTemplateId=12321", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines" - ], - "query": [ - { - "key": "timelineTemplateId", - "value": "12321" - } - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "667c981b-7880-4908-bbb4-d8cccbc4055a", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "c56dffd3-f7b9-4a9f-a40a-c2c82324fa3a", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "get challenge type timeline template", - "item": [ - { - "name": "get challenge type timeline template by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "91206067-e8a7-4153-ac21-4eaeced039a9", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge type timeline template by m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "22dcf98f-7c7b-4000-9ff0-b39c0403f46b", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 403 using user token", - "event": [ - { - "listen": "test", - "script": { - "id": "c36e22ed-f1f4-467d-add2-fcdbe465051a", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 403 using forbidden m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "65c5bbbe-5dac-4fa2-b581-1bf56b0d5051", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 401 expired token", - "event": [ - { - "listen": "test", - "script": { - "id": "5ce9a2ae-9ba4-4065-bb91-2849abe38de3", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 401 invalid token", - "event": [ - { - "listen": "test", - "script": { - "id": "5ced5df5-e5bc-4bcd-9b96-4a62465b4b37", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 401 without token", - "event": [ - { - "listen": "test", - "script": { - "id": "a3026c83-0229-4dc4-b148-0d24bfb5dde6", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 404 not found", - "event": [ - { - "listen": "test", - "script": { - "id": "31fdbec0-43d8-4f9c-883e-2b81a59143e8", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/{{PHASEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{PHASEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get challenge type timeline template 400 invalid id", - "event": [ - { - "listen": "test", - "script": { - "id": "64b71853-0c21-4dfc-ac3e-e496e5de1230", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenge-timelines/invalid", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "invalid" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0d2fbb46-e0a5-48da-8d0d-b481795dc417", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "597c212a-ef8b-405f-94c1-5065dfe918dd", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "update challenge type timeline template", - "item": [ - { - "name": "update challenge type timeline template by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "9a1b70a2-203f-4e14-9a0d-d859bcb30592", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge type timeline template by m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "4850dba6-fbfd-4256-b054-2816cd69a8bf", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "4c1c1b10-985b-4f76-a68f-f949e62b67de", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "1331865c-5932-4761-acda-eef9cc9900d8", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "88498ef3-7098-49a4-9416-a83f5fd078a9", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge type timeline template by m2m Copy Copy Copy", - "event": [ - { - "listen": "test", - "script": { - "id": "f237d2a5-b2b0-4f78-8ffe-0c8591d2d405", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 400 unexpected field", - "event": [ - { - "listen": "test", - "script": { - "id": "aba68557-f417-4f99-816e-1a0288734001", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\",\n \"other\": 123\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 400 missing timelineTemplateId", - "event": [ - { - "listen": "test", - "script": { - "id": "f7a13799-6070-4d5f-b8a2-d0cb222bb62f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 400 missing typeId", - "event": [ - { - "listen": "test", - "script": { - "id": "f6ef3ba1-a20f-4b51-831c-e707334de878", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 400 invalid typeId", - "event": [ - { - "listen": "test", - "script": { - "id": "77dad107-b0ae-41d7-b4c1-999eec0d66a3", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": [\"abc\"],\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 400 invalid timelineTemplateId", - "event": [ - { - "listen": "test", - "script": { - "id": "8e857cff-8a20-430c-9cb0-1663d688c540", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": [\"abc\"]\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 404 timelineTemplateId doesn't exist", - "event": [ - { - "listen": "test", - "script": { - "id": "775ce4be-7b38-4fbe-90ff-de311b4fbaf5", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"a69033a4-4f18-4765-addc-f48cf61176d9\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 404 typeId doesn't exist Copy", - "event": [ - { - "listen": "test", - "script": { - "id": "981c3728-2aa1-4b97-ab07-bff1b3c2bac9", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"typeId\": \"a69033a4-4f18-4765-addc-f48cf61176d9\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template by user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "5134c653-aba4-4e88-9bc6-f5ede8036cf5", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template by forbidden m2m token 403", - "event": [ - { - "listen": "test", - "script": { - "id": "5c969b63-ae9f-42c2-8b18-eca59f5f3961", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 404 not found", - "event": [ - { - "listen": "test", - "script": { - "id": "4aeba237-8e57-491f-b08e-4cfc64ea4372", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEB_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge type timeline template 409 conflict", - "event": [ - { - "listen": "test", - "script": { - "id": "9b2d0ffb-7964-4e17-878b-9dbd115139dd", - "exec": [ - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n \"timelineTemplateId\": \"{{TEMPLATEA_ID}}\"\n}\n" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "76ce88e7-0a2f-4824-9ce3-f22d1885470d", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "2cc50bb9-bb8b-4e8e-8a59-bf1a5e879cc3", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "delete challenge type timeline template", - "item": [ - { - "name": "delete challenge type timeline template", - "event": [ - { - "listen": "test", - "script": { - "id": "16f285b8-c1f8-41d3-b3c3-a966e8aa2902", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "}); " - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 401 missing token", - "event": [ - { - "listen": "test", - "script": { - "id": "e4064ae3-c487-41f6-9f32-742d2bc85d5e", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "}); " - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 401 invalid token", - "event": [ - { - "listen": "test", - "script": { - "id": "4beac016-48ec-4c73-8620-03eec43c6298", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "}); " - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 401 expire token", - "event": [ - { - "listen": "test", - "script": { - "id": "ca2c81f5-b050-4f32-b61a-b444c48aac12", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "}); " - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{expire_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 403 forbidden", - "event": [ - { - "listen": "test", - "script": { - "id": "96f462a7-8a44-4170-8a85-802ff05912c0", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 403 using user token", - "event": [ - { - "listen": "test", - "script": { - "id": "37594e65-dd7b-4c95-8a68-e1bca01e544c", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPE_TEMPLATEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPE_TEMPLATEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 400 invalid id", - "event": [ - { - "listen": "test", - "script": { - "id": "fb32faa4-fac7-4995-abd0-52236ab51f84", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "}); " - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/invalid", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "invalid" - ] - } - }, - "response": [] - }, - { - "name": "failure delete challenge type timeline template 404 not found", - "event": [ - { - "listen": "test", - "script": { - "id": "f96f583e-0ef5-474f-b8af-398cca28ebe8", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "}); " - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{URL}}/challenge-timelines/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenge-timelines", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "93d5abe2-c21a-4770-97cc-1c943231dc8c", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "3f9e216c-de59-46e7-9635-d86fbba10eeb", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "7f7cd79e-8b5c-4934-838b-7bafdcbaec3c", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "7a94d330-f82e-4fe6-af7b-3ef927a1a0e4", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Challenges", - "item": [ - { - "name": "create challenge", - "item": [ - { - "name": "create challenge by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "1fe92312-4778-4c94-ac53-315b5c8ebd80", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"CHALLENGE_ID1\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"privateDescription\": \"private test description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n \"discussions\": [{\n \"name\": \"name1\",\n \"type\": \"challenge\",\n \"provider\": \"provider1\",\n \"url\": \"url1\",\n \"options\": [{\"key1\":\"value1\"}, {\"key2\":\"value2\"}]\n }],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "create challenge by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "f147cec6-ee27-4ec4-a434-9feedc127128", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"CHALLENGE_ID2\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create-copilot\",\n\t\"description\": \"test-description\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value3\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"sampleMetadata2\",\n\t\t\t\"value\": \"value4\"\n\t\t}\n\t],\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n \"discussions\": [{\n \"name\": \"name1\",\n \"type\": \"challenge\",\n \"provider\": \"provider1\",\n \"url\": \"url1\",\n \"options\": [{\"key1\":\"value1\"}, {\"key2\":\"value2\"}]\n }],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"groups\": [\"group1\", \"group2\"],\n\t\"gitRepoURLs\": [\"https://github.com/topcoder-platform/community-app\"],\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge - duplicate terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "c3fc1c19-9a72-4e1a-8c0b-e7480263f257", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"privateDescription\": \"private test description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"termsIds\": [\"13bbb3cb-6779-4dc8-9787-26411dfb7925\", \"13bbb3cb-6779-4dc8-9787-26411dfb7925\", \"fb7e4a66-03d3-4918-b328-b1f277b0590b\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge - non-existing terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "b111cb2b-db52-4ea0-b915-6ba1213c248e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"privateDescription\": \"private test description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"termsIds\": [\"13bbb3cb-6779-4dc8-9787-26411dfb7925\", \"fb7e4a66-03d3-4918-b328-b1f277b0590b\", \"fb7e4a66-03d3-4918-b328-b1f288b0590b\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge - negative terms ids - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "2d61ea4b-6162-40cd-8d75-b3bdb8da2607", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"privateDescription\": \"private test description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"termsIds\": [-20653, -20646]\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge - invalid terms ids - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "f5d3de0b-c048-4a72-a108-e9d14c59ec28", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"privateDescription\": \"private test description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"termsIds\": [\"Invalid20653\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge invalid tags", - "event": [ - { - "listen": "test", - "script": { - "id": "028c9189-289c-4319-bf53-f9d321a46787", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": {\"tag1\": \"tag2\"},\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge invalid status", - "event": [ - { - "listen": "test", - "script": { - "id": "1b7a34cc-45d1-4d6c-afe2-e1a2b556a275", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"status\": \"invalid\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge using invactive time template 400", - "event": [ - { - "listen": "test", - "script": { - "id": "765f6d71-d256-49e7-8a64-bb59af62e1b4", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEB_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge using empty prizeSets 400", - "event": [ - { - "listen": "test", - "script": { - "id": "ffb83e96-dc8e-46d5-bac9-a343535cbb74", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge using empty prizes array 400", - "event": [ - { - "listen": "test", - "script": { - "id": "bf4a5b1a-fdff-46bd-8009-81eae877daaa", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": []\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "fa6fc28c-2387-4a87-b4f0-d69c67c97ad5", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": 12345,\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge using empty phases 400", - "event": [ - { - "listen": "test", - "script": { - "id": "a1806750-3a79-4da6-a0c5-eebae8dae31f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Code\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge missing parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "c85fbc45-536e-4d03-8c02-5ad62e583798", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Code\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge invalid phases 400", - "event": [ - { - "listen": "test", - "script": { - "id": "0d5c6e51-a1f2-4eab-9abf-50e3130d5a36", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"id\": \"{{PHASEA_ID}}\",\n \t\"name\": \"inconsistent\",\n \t\"isActive\": true,\n \t\"duration\": 1000000\n },\n {\n \t\"id\": \"{{PHASED_ID}}\",\n \t\"name\": \"phase-4\",\n \t\t\"isActive\": false,\n\t \t\"duration\": 2000000\n },\n {\n \t\"id\": \"{{TYPEA_ID}}\",\n \t\"name\": \"not-found\",\n \t\"isActive\": true,\n \t\"duration\": 1000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Code\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge invalid prizeSet type 400", - "event": [ - { - "listen": "test", - "script": { - "id": "4bc916cd-e6d9-41ba-bb2e-7164a2721900", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"invalid\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "faiclure reate challenge invalid prize type", - "event": [ - { - "listen": "test", - "script": { - "id": "5d2da387-c112-4f67-bca9-035d49f06a5f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": 1234321,\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\",\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge by user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "836ff41c-2a5a-42f0-9d48-2e0113d516b0", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge using forbidden m2m token 403", - "event": [ - { - "listen": "test", - "script": { - "id": "f78dbe83-b580-450a-952a-1cdce9f4ab65", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "6c22de38-d51c-4ff8-8d08-1d9acdd4d55b", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "bd1cbf7a-d321-4da4-8a7c-979fe81f7b44", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "5b5a4975-4124-477c-ad9f-65444d1fa7de", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "create challenge using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "735657d0-935c-4081-9049-f8f6fe89b078", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"TEST_CHALLENGE_M2M_ID\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create-m2m\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge project not found 400", - "event": [ - { - "listen": "test", - "script": { - "id": "7a09a570-dd33-4aaf-96ed-07574a974985", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create-copilot\",\n\t\"description\": \"test-description\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value3\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"sampleMetadata2\",\n\t\t\t\"value\": \"value4\"\n\t\t}\n\t],\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 10000,\n\t\"status\": \"Draft\",\n\t\"groups\": [\"group1\", \"group2\"],\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - }, - { - "name": "failure create challenge user can't access specific project", - "event": [ - { - "listen": "test", - "script": { - "id": "6b4f75c0-1ebe-40b9-808d-29486467f85c", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create-copilot\",\n\t\"description\": \"test-description\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata2\",\n\t\t\t\"value\": \"value3\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"sampleMetadata2\",\n\t\t\t\"value\": \"value4\"\n\t\t}\n\t],\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 200,\n\t\"status\": \"Draft\",\n\t\"groups\": [\"group1\", \"group2\"],\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "update challenge", - "item": [ - { - "name": "update challenge 1 by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "2e0c9077-22e4-4335-932e-c6aabd526760", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n \"discussions\": [{\n \"name\": \"name1\",\n \"type\": \"challenge\",\n \"provider\": \"provider1\",\n \"url\": \"url1\",\n \"options\": [{\"key1\":\"value1\"}, {\"key2\":\"value2\"}]\n }],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge 1 with attachment by M2M", - "event": [ - { - "listen": "test", - "script": { - "id": "9d2671eb-8af7-46a4-b5db-5594e6ccb0d1", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID1}}\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge 1 with winners by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "288f9e4f-6aa8-423f-9d30-e192a590a5a8", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n \"discussions\": [{\n \"name\": \"name1\",\n \"type\": \"challenge\",\n \"provider\": \"provider1\",\n \"url\": \"url1\",\n \"options\": [{\"key1\":\"value1\"}, {\"key2\":\"value2\"}]\n }],\n\t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 3456789,\n\t\t\t\"handle\": \"tonyj\",\n\t\t\t\"placement\": 2\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Completed\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge 2 by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "c9317588-fc22-4b1a-82b1-b8c316f266c0", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEB_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n \"discussions\": [{\n \"name\": \"name1\",\n \"type\": \"challenge\",\n \"provider\": \"provider1\",\n \"url\": \"url1\",\n \"options\": [{\"key1\":\"value1\"}, {\"key2\":\"value2\"}]\n }],\n \"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 3456789,\n\t\t\t\"handle\": \"tonyj\",\n\t\t\t\"placement\": 4\n\t\t}\n\t],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"status\": \"Completed\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"groups\": [\"group1\", \"group2\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge remove default terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "2bfc316d-5d15-4046-bf4f-f6da60c1843b", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"terms\": [\"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge duplicate terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "4c23aa08-3a78-450d-84cc-f2952d609273", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge terms does not exist - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "147c1c78-6d57-4ca2-a05b-83fb54ed0072", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\", \"28841de8-2f42-486f-beac-21d46a823ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge invalid groups 400", - "event": [ - { - "listen": "test", - "script": { - "id": "ea931ff2-1ceb-43cd-ab4c-a4988efab65e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID1}}\"],\n\t\"groups\": \"group1 group2\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge attachment not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "e535302e-610a-41bc-b0b7-ac89d026e611", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{TYPEA_ID}}\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "e7b004c5-c903-4f1b-8012-cb86a5cdaa2f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"invalid\": 123,\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID1}}\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge by different copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "f6f7da5a-000d-4fc4-8a4e-28dc84fb9857", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot2_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge by user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "c3dcae2f-3e36-4886-93f2-c2aef14cedfc", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "f0f9b987-42f3-4eb6-be37-5c5d4ebcdebc", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "b0eafd18-60fc-411e-afcd-6a5e682fba86", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "ef159409-8991-44a5-a5ae-36b94785e3f7", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "bd8d0650-1cdf-415a-b772-53826f110427", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n \"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name-1\",\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge using m2m token", - "event": [ - { - "listen": "test", - "script": { - "id": "4257d7c9-3be9-465e-82fc-d61c34523cc2", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-update-m2m\",\n\t\"description\": \"test-update-m2m\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{TEST_CHALLENGE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{TEST_CHALLENGE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge using forbidden m2m token 403", - "event": [ - { - "listen": "test", - "script": { - "id": "d8588293-e2b8-4421-9252-12416f1247c7", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_attachments_read}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-update-m2m\",\n\t\"description\": \"test-update-m2m\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{TEST_CHALLENGE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{TEST_CHALLENGE_M2M_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge project not found 400", - "event": [ - { - "listen": "test", - "script": { - "id": "7b2d91d1-f808-4b7f-b1dd-4ad9194d18f0", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 10000,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge user can't access the project 403", - "event": [ - { - "listen": "test", - "script": { - "id": "9b146732-e0bf-42de-a335-a31c6358a6d5", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"name\": \"update-name-1\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"description\": \"update-description-1\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"phaseId\": \"{{PHASEA_ID}}\",\n \"duration\": 1000000\n },\n {\n \"phaseId\": \"{{PHASEB_ID}}\",\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"tags\": [\"tag3\", \"tag4\"],\n\t\"projectId\": 200,\n\t\"status\": \"Active\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"groups\": [\"group1\", \"group2\", \"group3\"],\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "update challenge 1 with winners by admin Copy", - "event": [ - { - "listen": "test", - "script": { - "id": "cc385813-2542-48c4-b203-05aec542b722", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 3456789,\n\t\t\t\"handle\": \"tonyj\",\n\t\t\t\"placement\": 2\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Completed\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge from active to completed status", - "event": [ - { - "listen": "test", - "script": { - "id": "e9aae871-6825-439b-886a-c3d5605d2387", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 3456789,\n\t\t\t\"handle\": \"tonyj\",\n\t\t\t\"placement\": 2\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Active\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge with winners - Duplicate member with placement", - "event": [ - { - "listen": "test", - "script": { - "id": "8e67f148-7bd9-4fa5-b19e-eaf295770881", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Completed\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge with winners array - same member with multiple placements", + "path": [ + "resources" + ] } - ], + }, + "response": [] + }, + { + "name": "Get Resources on Challenge", "event": [ - { - "listen": "prerequest", - "script": { - "id": "4da50c05-788c-46d9-bb78-1832285e97de", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, { "listen": "test", "script": { - "id": "b94eeda7-a239-494d-b0f8-ee39b2f55541", - "type": "text/javascript", "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " const member = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_PAYMENT_V5_MEMBER_UUID')})\r", + " pm.expect(member).to.have.length(1)\r", + " pm.expect(member[0].memberId).to.eq(pm.environment.get('CHALLENGE_PAYMENT_V5_MEMBER_ID'))\r", + " pm.expect(member[0].memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(member[0].roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + " const copilot = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_PAYMENT_V5_COPILOT_UUID')})\r", + " pm.expect(copilot).to.have.length(1)\r", + " pm.expect(copilot[0].memberId).to.eq(pm.environment.get('CHALLENGE_PAYMENT_V5_COPILOT_ID'))\r", + " pm.expect(copilot[0].memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(copilot[0].roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", "" - ] + ], + "type": "text/javascript" } } ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "update challenge", - "item": [ - { - "name": "update challenge 1 by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "ea8038f1-6b24-4ce7-8b3b-084a3020617a", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 2\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Completed\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure update challenge with winners array - multiple members with one placement", - "event": [ - { - "listen": "test", - "script": { - "id": "b1fe95fa-9110-44ca-afd3-239cb833fea2", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources?challengeId={{CHALLENGE_UUID_PAYMENT_V5}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 3456789,\n\t\t\t\"handle\": \"tonyj\",\n\t\t\t\"placement\": 1\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Completed\",\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update challenge with empty winners array", - "event": [ - { - "listen": "test", - "script": { - "id": "cb31fba8-2159-4af7-9f7e-afd9fe111b1b", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "path": [ + "resources" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 600\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 300\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"winners\": [],\n\t\"tags\": [\"tag1\", \"tag3\", \"tag4\"],\n\t\"projectId\": 123,\n\t\"legacyId\": 112233,\n\t\"status\": \"Completed\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] + "query": [ + { + "key": "challengeId", + "value": "{{CHALLENGE_UUID_PAYMENT_V5}}" } - }, - "response": [] + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "partial update challenge", - "item": [ - { - "name": "partial update challenge 1 by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "3f166bf2-0d16-4bd3-b580-cfe146ec1d56", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"legacyId\": 789789\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge 1 terms by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "d7b9ba32-3e0b-4a28-b80f-0a1b48537478", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge 1 with winners by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "cdb2779c-8673-4e54-9038-bc71a860b07b", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t \"winners\": [\n {\n \"userId\": 12345678,\n \"handle\": \"thomaskranitsas\",\n \"placement\": 1\n },\n {\n \"userId\": 3456789,\n \"handle\": \"tonyy\",\n \"placement\": 2\n }\n ]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update challenge 2 by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "93a90ff9-8930-43eb-b3c3-39c1d9f689f8", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t],\n\t\"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 100\n }\n ]\n }\n ],\n\t\"status\": \"Completed\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"groups\": [\"group1\", \"group2\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update to endDate", - "event": [ - { - "listen": "test", - "script": { - "id": "3169630b-4847-4203-93d1-7f1592adcdbe", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 2000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 10000\n }\n ]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure - remove default terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "8ef7724a-00d2-42f6-b265-7d6078056aa1", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"terms\": [\"13bbb3cb-6779-4dc8-9787-26411dfb7925\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure - add non-existing terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "0eae56ac-ea0c-4170-a525-98ba5da3426e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\", \"28841de8-2f42-486f-beac-21d46a732ab6\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure - add duplicate terms - 400", - "event": [ - { - "listen": "test", - "script": { - "id": "d18726c8-eb97-4dc0-a173-5fd25364894f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"terms\": [\"0fcb41d1-ec7c-44bb-8f3b-f017a61cd708\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\", \"28841de8-2f42-486f-beac-21d46a832ab6\", \"be0652ae-8b28-4e91-9b42-8ad00b31e9cb\"]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge duplicate groups 400", - "event": [ - { - "listen": "test", - "script": { - "id": "a38d4dc2-5d3f-4340-8fff-d7dfe2ed673d", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n \"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 5000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 6000000\n }\n\t],\n\t\"tags\": [\"tag1\"],\n\t\"status\": \"Completed\",\n\t\"groups\": [\"g1\", \"g1\"],\n\t\"attachmentIds\": []\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge null group 400", - "event": [ - { - "listen": "test", - "script": { - "id": "47835164-f7eb-4a42-8776-4e485cf3b39c", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 5000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 6000000\n }\n\t],\n\t\"tags\": [\"tag1\"],\n\t\"status\": \"Completed\",\n\t\"groups\": [null],\n\t\"attachmentIds\": []\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge by different copilot 403", - "event": [ - { - "listen": "test", - "script": { - "id": "9c6877fc-3f7e-4215-86a0-59184e1f5f03", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot2_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "168fb3b6-acf4-447a-8f41-31f1fb5deeed", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "883669a3-f1c0-48e7-a6ba-5063c49e6fc4", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"invalid\": \"{{TEST_TYPE_ID4}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"update-name\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge by user 403", - "event": [ - { - "listen": "test", - "script": { - "id": "ee2064c6-29be-4d08-9d06-c4e53e6a6b1c", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update challenge without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "356236b6-7da5-40fa-bebe-1a8639893ab9", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, + "name": "Activate challenge", + "event": [ { - "name": "failure partial update challenge with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "88774793-248c-44aa-8099-dd19b15fd865", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT_V5'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')\r", + " pm.expect(response.legacy.pureV5Task).to.be.true\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.name).to.eq('Postman Pure V5 Task Test 2')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.task.isTask).to.be.true\r", + " pm.expect(response.task.isAssigned).to.be.true\r", + " pm.expect(Number(response.task.memberId)).to.eq(Number(pm.environment.get('CHALLENGE_PAYMENT_V5_MEMBER_ID')))\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Task')\r", + " pm.expect(response).to.not.have.property('legacyId')\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Active\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge with expire token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "1991699f-da1f-4415-9677-7f87d6dbb682", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_PAYMENT_V5}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, + "path": [ + "challenges", + "{{CHALLENGE_UUID_PAYMENT_V5}}" + ] + } + }, + "response": [] + }, + { + "name": "Close task", + "event": [ { - "name": "failure partial update challenge using forbidden m2m token 403", - "event": [ - { - "listen": "test", - "script": { - "id": "13578f98-0ec9-4dab-9c65-9f1ce5bd492f", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_attachments_read}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_PAYMENT_V5'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_TASK'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('INTERNAL')\r", + " pm.expect(response.legacy.pureV5Task).to.be.true\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.name).to.eq('Postman Pure V5 Task Test 2')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_TASK'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Completed')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.task.isTask).to.be.true\r", + " pm.expect(response.task.isAssigned).to.be.true\r", + " pm.expect(Number(response.task.memberId)).to.eq(Number(pm.environment.get('CHALLENGE_PAYMENT_V5_MEMBER_ID')))\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Task')\r", + " pm.expect(response).to.not.have.property('legacyId')\r", + " pm.expect(Number(response.winners[0].userId)).to.eq(Number(pm.environment.get('CHALLENGE_PAYMENT_V5_MEMBER_ID')))\r", + " pm.expect(response.winners[0].handle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.winners[0].placement).to.eq(1)\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"typeId\": \"{{TYPEA_ID}}\",\n\t\"legacy\": {\n\t\t\"track\": \"test-track\",\n\t\t\"reviewType\": \"review type\",\n\t\t\"forumId\": 456,\n\t\t\"confidentialityType\": \"public\"\n\t},\n\t\"name\": \"new-update-m2m\",\n\t\"description\": \"patch-update-m2m\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"phaseId\": \"{{PHASEA_ID}}\",\n \t\"duration\": 1000000\n },\n {\n \t\"phaseId\": \"{{PHASEB_ID}}\",\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"status\": \"Draft\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{TEST_CHALLENGE_M2M_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{TEST_CHALLENGE_M2M_ID}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Completed\",\n \"winners\": [\n {\n \"userId\": {{CHALLENGE_PAYMENT_V5_MEMBER_ID}},\n \"handle\": \"{{MEMBER_HANDLE}}\",\n \"placement\": 1\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge project not found", - "event": [ - { - "listen": "test", - "script": { - "id": "02a0b043-c9e5-4e45-ac45-28b658cbf6de", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_PAYMENT_V5}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t],\n\t\"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 100\n }\n ]\n }\n ],\n\t\"status\": \"Completed\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"groups\": [\"group1\", \"group2\", \"group3\", \"group4\"],\n\t\"projectId\": 1000\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, + "path": [ + "challenges", + "{{CHALLENGE_UUID_PAYMENT_V5}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Create and activate a challenge for development", + "item": [ + { + "name": "Create Challenge", + "event": [ { - "name": "failure partial update challenge user can't access specific project", - "event": [ - { - "listen": "test", - "script": { - "id": "592c44fa-df55-47da-9866-15cf6e7ed4ec", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "if(pm.response.status === 'Created') {", + " const response = pm.response.json();", + " pm.environment.set('CHALLENGE_UUID_DEVELOPMENT', response.id);", + " pm.expect(response).to.have.property('created')", + " pm.expect(response.createdBy).to.eq('tcwebservice')", + " pm.expect(response).to.have.property('updated')", + " pm.expect(response.updatedBy).to.eq('tcwebservice')", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')", + " pm.expect(response.name).to.eq('Postman Development Challenge Test 3')", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")", + " pm.expect(response.privateDescription).to.eq('private description')", + " pm.expect(response.descriptionFormat).to.eq('markdown')", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')", + " pm.expect(response.prizeSets[0].type).to.eq('placement')", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')", + " pm.expect(response.tags[0]).to.eq('Other')", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))", + " pm.expect(response).to.have.property('startDate')", + " pm.expect(response.status).to.eq('Draft')", + " pm.expect(response).to.have.property('billing')", + " pm.expect(response.phases[0].name).to.eq('Registration')", + " pm.expect(response.phases[1].name).to.eq('Submission')", + " pm.expect(response.phases[2].name).to.eq('Review')", + " pm.expect(response.phases[3].name).to.eq('Appeals')", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')", + " pm.expect(response).to.have.property('endDate')", + " pm.expect(response.overview.totalPrizes).to.eq(1)", + " pm.expect(response.numOfSubmissions).to.eq(0)", + " pm.expect(response.numOfRegistrants).to.eq(0)", + " pm.expect(response).to.have.property('currentPhaseNames')", + " pm.expect(response).to.have.property('registrationStartDate')", + " pm.expect(response).to.have.property('registrationEndDate')", + " pm.expect(response).to.have.property('submissionStartDate')", + " pm.expect(response).to.have.property('submissionEndDate')", + " pm.expect(response.track).to.eq('Development')", + " pm.expect(response.type).to.eq('Challenge')", + "}", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"update-new-name-1\",\n\t\"metadata\": [\n\t\t{\n\t\t\t\"name\": \"sampleMetadata1\",\n\t\t\t\"value\": \"value5\"\n\t\t}\n\t],\n\t\"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 100\n }\n ]\n }\n ],\n\t\"status\": \"Completed\",\n\t\"attachmentIds\": [\"{{ATTACHMENT_ID2}}\"],\n\t\"groups\": [\"group1\", \"group2\", \"group3\", \"group4\"],\n\t\"projectId\": 200\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "failure partial update challenge from active to completed status", - "event": [ - { - "listen": "test", - "script": { - "id": "c7b857fc-761b-4684-b58c-fe1a16d8d41f", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "prerequest", + "script": { + "exec": [ + "" ], - "body": { - "mode": "raw", - "raw": "{\n \"status\": \"Active\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"typeId\": \"{{TYPE_CHALLENGE}}\",\n \"trackId\": \"{{TRACK_DEVELOPMENT}}\",\n \"legacy\": {\n \"reviewType\": \"COMMUNITY\"\n },\n \"name\": \"Postman Development Challenge Test 3\",\n \"description\": \"Here's a large description with **markdown**\",\n \"privateDescription\": \"private description\",\n \"descriptionFormat\": \"markdown\",\n \"timelineTemplateId\": \"{{TIMELINE_TEMPLATE_CHALLENGE}}\",\n \"prizeSets\": [\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Challenge Prizes\",\n \"type\": \"placement\"\n },\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Copilot Payment\",\n \"type\": \"copilot\"\n }\n ],\n \"tags\": [\n \"Other\"\n ],\n \"projectId\": {{PROJECT_ID}},\n \"startDate\": \"{{tenMinFromNow}}\",\n \"status\": \"Draft\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge - Duplicate member with placement", - "event": [ - { - "listen": "test", - "script": { - "id": "234943c8-b641-4ad3-9439-743219af78a8", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] - }, + "path": [ + "challenges" + ] + } + }, + "response": [] + }, + { + "name": "Get Created Challenge", + "event": [ { - "name": "failure partial update challenge - same member with multiple placements", - "event": [ - { - "listen": "test", - "script": { - "id": "406482d5-c2e1-4076-aa67-79c67a5d81a7", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DEVELOPMENT'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.name).to.eq('Postman Development Challenge Test 3')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Draft')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(0)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + "}\r", + "" ], - "body": { - "mode": "raw", - "raw": "{\n \"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 2\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "failure partial update challenge - multiple members with one placement", - "event": [ - { - "listen": "test", - "script": { - "id": "42f26e17-73ba-4756-a281-444fa9e76991", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \t\"winners\": [\n\t\t{\n\t\t\t\"userId\": 12345678,\n\t\t\t\"handle\": \"thomaskranitsas\",\n\t\t\t\"placement\": 1\n\t\t},\n\t\t{\n\t\t\t\"userId\": 3456789,\n\t\t\t\"handle\": \"tonyj\",\n\t\t\t\"placement\": 1\n\t\t}\n\t]\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure partial update challenge - with empty winners array", - "event": [ - { - "listen": "test", - "script": { - "id": "ab563cc7-af8a-44ef-9f1b-1c6c59923050", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DEVELOPMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"winners\": []\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] - } - }, - "response": [] + "path": [ + "challenges", + "{{CHALLENGE_UUID_DEVELOPMENT}}" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "get challenge", - "item": [ + "name": "Assign Member", + "event": [ { - "name": "get challenge 1 by anonymous user", - "event": [ - { - "listen": "test", - "script": { - "id": "7f2d6d0a-c9a5-4fc5-a4f9-e44b48228055", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_DEVELOPMENT_MEMBER_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_DEVELOPMENT_MEMBER_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_DEVELOPMENT'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_DEVELOPMENT}}\",\n \"memberHandle\": \"{{MEMBER_HANDLE}}\",\n \"roleId\": \"{{ROLE_SUBMITTER}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "get challenge 2 by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "5cf7de49-a253-4446-808a-099ca396a7ba", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{copilot1_token}}", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Assign Copilot", + "event": [ { - "name": "get challenge 2 by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "2e22521d-d374-48f4-a6b9-9f60529e1295", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_DEVELOPMENT_COPILOT_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_DEVELOPMENT_COPILOT_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_DEVELOPMENT'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_DEVELOPMENT}}\",\n \"memberHandle\": \"{{COPILOT_HANDLE}}\",\n \"roleId\": \"{{ROLE_COPILOT}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "get challenge 2 by user without group access 403", - "event": [ - { - "listen": "test", - "script": { - "id": "a5a14d4b-9414-4f94-808d-1dcb2d82aa4f", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] - }, + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Get Resources on Challenge", + "event": [ { - "name": "failure get challenge invalid id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "150cacdc-ebb7-42b5-ac8d-d08edc3dfcc7", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " const member = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_DEVELOPMENT_MEMBER_UUID')})\r", + " pm.expect(member).to.have.length(1)\r", + " pm.expect(member[0].memberId).to.eq(pm.environment.get('CHALLENGE_DEVELOPMENT_MEMBER_ID'))\r", + " pm.expect(member[0].memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(member[0].roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + " const copilot = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_DEVELOPMENT_COPILOT_UUID')})\r", + " pm.expect(copilot).to.have.length(1)\r", + " pm.expect(copilot[0].memberId).to.eq(pm.environment.get('CHALLENGE_DEVELOPMENT_COPILOT_ID'))\r", + " pm.expect(copilot[0].memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(copilot[0].roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges/invalid-id", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "invalid-id" - ] + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure get challenge not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "90b37b00-6ffe-4280-bd2d-1a319488effb", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources?challengeId={{CHALLENGE_UUID_DEVELOPMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{TYPEA_ID}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{TYPEA_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "get challenge using m2m token with read scope", - "event": [ + "path": [ + "resources" + ], + "query": [ { - "listen": "test", - "script": { - "id": "440bba88-0073-4c6b-9c53-1357d4c0b30c", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } + "key": "challengeId", + "value": "{{CHALLENGE_UUID_DEVELOPMENT}}" } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } + ] + } + }, + "response": [] + }, + { + "name": "Activate challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DEVELOPMENT'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.subTrack).to.eq('CODE')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.name).to.eq('Postman Development Challenge Test 3')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "get challenge 2 using m2m token without scope", - "event": [ - { - "listen": "test", - "script": { - "id": "7c206694-504a-4bab-8ad6-1bb8bb357ae9", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200)", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_attachments_read}}" - } + "listen": "prerequest", + "script": { + "exec": [ + "var url = `${pm.environment.get('URL')}/challenges/${pm.environment.get('CHALLENGE_UUID_DEVELOPMENT')}`\r", + "var retryDelay = 5000;\r", + "var retryLimit = 5;\r", + "var awaken = false\r", + "// wait for legacy challenge processor to finish it's work\r", + "function isProcessingComplete(retryCount) {\r", + " pm.sendRequest({url: url,\r", + " method: \"GET\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " }}, function (err, response) {\r", + " if(err) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " }\r", + " } else {\r", + " if(!response.json().legacyId) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " } else if (!awaken) {\r", + " wakeLegacyProcessor()\r", + " retryLimit *= 2\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay)\r", + " }\r", + " }\r", + " }\r", + " });\r", + "}\r", + "\r", + "function wakeLegacyProcessor() {\r", + " pm.sendRequest({url: url,\r", + " method: \"PATCH\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " },\r", + " body: {status: \"Draft\"}\r", + " }, function () {\r", + " awaken= true\r", + " });\r", + "}\r", + "\r", + "isProcessingComplete(1);" ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Active\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "get challenge 2 using invalid token", - "event": [ - { - "listen": "test", - "script": { - "id": "1b35c58a-f50d-401b-967c-aa867afb574b", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DEVELOPMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}" - ] - }, - "description": "it will be consided as anonymous user" - }, - "response": [] + "path": [ + "challenges", + "{{CHALLENGE_UUID_DEVELOPMENT}}" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "search challenge", - "item": [ + "name": "Get Activated Challenge", + "event": [ { - "name": "search challenge by admin", - "event": [ - { - "listen": "test", - "script": { - "id": "67f64c9e-30ff-4ded-9023-d5cad7f25bbe", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DEVELOPMENT'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DEVELOPMENT'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.legacy.subTrack).to.eq('CODE')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.name).to.eq('Postman Development Challenge Test 3')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('terms')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Development')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?page=1&perPage=10&id={{CHALLENGE_ID1}}&track=track&name=TEST&description=test&reviewType=review type&tag=tag3&projectId=123&createdDateStart=2017-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z&updatedDateStart=2017-02-22T00:00:00Z&updatedDateEnd=2028-02-22T00:00:00Z&createdBy=Tonyj&updatedBy=Tonyj&memberId=40309246&confidentialityType=public", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "perPage", - "value": "10" - }, - { - "key": "id", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "track", - "value": "track" - }, - { - "key": "name", - "value": "TEST" - }, - { - "key": "description", - "value": "test" - }, - { - "key": "reviewType", - "value": "review type" - }, - { - "key": "tag", - "value": "tag3" - }, - { - "key": "projectId", - "value": "123" - }, - { - "key": "createdDateStart", - "value": "2017-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - }, - { - "key": "updatedDateStart", - "value": "2017-02-22T00:00:00Z" - }, - { - "key": "updatedDateEnd", - "value": "2028-02-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "Tonyj" - }, - { - "key": "updatedBy", - "value": "Tonyj" - }, - { - "key": "memberId", - "value": "40309246" - }, - { - "key": "confidentialityType", - "value": "public" - } - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "search challenge by copilot", - "event": [ - { - "listen": "test", - "script": { - "id": "9a0edfa4-eaf8-4fb8-b73d-784b65c2ddbd", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges?perPage=10&createdDateStart=2017-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z&memberId=40309246", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "perPage", - "value": "10" - }, - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2017-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - }, - { - "key": "memberId", - "value": "40309246" - } - ] + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "search challenge by copilot using another memberId", - "event": [ - { - "listen": "test", - "script": { - "id": "8759dab6-2fa3-453a-8f69-2b4e5b86e138", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DEVELOPMENT}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges?perPage=10&createdDateStart=2017-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z&memberId=151743", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "perPage", - "value": "10" - }, - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2017-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - }, - { - "key": "memberId", - "value": "151743" - } - ] - } - }, - "response": [] - }, + "path": [ + "challenges", + "{{CHALLENGE_UUID_DEVELOPMENT}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Create and activate a challenge for design", + "item": [ + { + "name": "Create Challenge", + "event": [ { - "name": "search challenge by normal user", - "event": [ - { - "listen": "test", - "script": { - "id": "cf9a0f01-624f-4003-ba2d-9a81c7091033", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "if(pm.response.status === 'Created') {", + " const response = pm.response.json();", + " pm.environment.set('CHALLENGE_UUID_DESIGN', response.id);", + " pm.expect(response).to.have.property('created')", + " pm.expect(response.createdBy).to.eq('tcwebservice')", + " pm.expect(response).to.have.property('updated')", + " pm.expect(response.updatedBy).to.eq('tcwebservice')", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DESIGN'))", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')", + " pm.expect(response.name).to.eq('Postman Design Challenge Test 4')", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")", + " pm.expect(response.privateDescription).to.eq('private description')", + " pm.expect(response.descriptionFormat).to.eq('markdown')", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')", + " pm.expect(response.prizeSets[0].type).to.eq('placement')", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')", + " pm.expect(response.tags[0]).to.eq('Other')", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))", + " pm.expect(response).to.have.property('startDate')", + " pm.expect(response.status).to.eq('Draft')", + " pm.expect(response).to.have.property('billing')", + " pm.expect(response.phases[0].name).to.eq('Registration')", + " pm.expect(response.phases[1].name).to.eq('Submission')", + " pm.expect(response.phases[2].name).to.eq('Review')", + " pm.expect(response.phases[3].name).to.eq('Appeals')", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')", + " pm.expect(response).to.have.property('endDate')", + " pm.expect(response.overview.totalPrizes).to.eq(1)", + " pm.expect(response.numOfSubmissions).to.eq(0)", + " pm.expect(response.numOfRegistrants).to.eq(0)", + " pm.expect(response).to.have.property('currentPhaseNames')", + " pm.expect(response).to.have.property('registrationStartDate')", + " pm.expect(response).to.have.property('registrationEndDate')", + " pm.expect(response).to.have.property('submissionStartDate')", + " pm.expect(response).to.have.property('submissionEndDate')", + " pm.expect(response.track).to.eq('Design')", + " pm.expect(response.type).to.eq('Challenge')", + "}", + "" ], - "url": { - "raw": "{{URL}}/challenges?perPage=10&createdDateStart=2017-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "perPage", - "value": "10" - }, - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2017-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - } - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "search challenge by anonymous user", - "event": [ - { - "listen": "test", - "script": { - "id": "9d55da0a-f636-430f-b873-572091b78d8e", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "prerequest", + "script": { + "exec": [ + "" ], - "url": { - "raw": "{{URL}}/challenges?perPage=100", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2017-02-22T00:00:00Z", - "disabled": true - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z", - "disabled": true - }, - { - "key": "perPage", - "value": "100" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"typeId\": \"{{TYPE_CHALLENGE}}\",\n \"trackId\": \"{{TRACK_DESIGN}}\",\n \"legacy\": {\n \"reviewType\": \"COMMUNITY\"\n },\n \"name\": \"Postman Design Challenge Test 4\",\n \"description\": \"Here's a large description with **markdown**\",\n \"privateDescription\": \"private description\",\n \"descriptionFormat\": \"markdown\",\n \"timelineTemplateId\": \"{{TIMELINE_TEMPLATE_CHALLENGE}}\",\n \"prizeSets\": [\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Challenge Prizes\",\n \"type\": \"placement\"\n },\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Copilot Payment\",\n \"type\": \"copilot\"\n }\n ],\n \"tags\": [\n \"Other\"\n ],\n \"projectId\": {{PROJECT_ID}},\n \"startDate\": \"{{tenMinFromNow}}\",\n \"status\": \"Draft\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure search challenge invalid date 400", - "event": [ - { - "listen": "test", - "script": { - "id": "e736fd39-16c9-496c-8b77-0f9669c4beeb", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/challenges?perPage=10&createdDateStart=abc&createdDateEnd=2022-03-22T00:00:00Z", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "perPage", - "value": "10" - }, - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "abc" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - } - ] - } - }, - "response": [] - }, + "path": [ + "challenges" + ] + } + }, + "response": [] + }, + { + "name": "Get Created Challenge", + "event": [ { - "name": "failure search challenge invalid parameter 400", - "event": [ - { - "listen": "test", - "script": { - "id": "4cf3b43e-fc5f-41ca-a5a3-1305ecbadd87", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DESIGN'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DESIGN'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.name).to.eq('Postman Design Challenge Test 4')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Draft')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(0)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Design')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?invalid=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "invalid", - "value": "test-" - } - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "failure search challenge invalid parameter typeId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "c8c2a2b1-2e1b-4237-a643-999c494e819e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DESIGN}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_DESIGN}}" + ] + } + }, + "response": [] + }, + { + "name": "Assign Member", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_DESIGN_MEMBER_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_DESIGN_MEMBER_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_DESIGN'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?typeId=111", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "typeId", - "value": "111" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_DESIGN}}\",\n \"memberHandle\": \"{{MEMBER_HANDLE}}\",\n \"roleId\": \"{{ROLE_SUBMITTER}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure search challenge invalid parameter id 400", - "event": [ - { - "listen": "test", - "script": { - "id": "220c65d5-6dda-44d3-8cc4-164ae271a0b9", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Assign Copilot", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_DESIGN_COPILOT_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_DESIGN_COPILOT_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_DESIGN'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?id=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "id", - "value": "test-" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_DESIGN}}\",\n \"memberHandle\": \"{{COPILOT_HANDLE}}\",\n \"roleId\": \"{{ROLE_COPILOT}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure search challenge invalid parameter timelineTemplateId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "d8c5f457-18a4-4780-a8a3-a4474470bfe4", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Get Resources on Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " const member = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_DESIGN_MEMBER_UUID')})\r", + " pm.expect(member).to.have.length(1)\r", + " pm.expect(member[0].memberId).to.eq(pm.environment.get('CHALLENGE_DESIGN_MEMBER_ID'))\r", + " pm.expect(member[0].memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(member[0].roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + " const copilot = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_DESIGN_COPILOT_UUID')})\r", + " pm.expect(copilot).to.have.length(1)\r", + " pm.expect(copilot[0].memberId).to.eq(pm.environment.get('CHALLENGE_DESIGN_COPILOT_ID'))\r", + " pm.expect(copilot[0].memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(copilot[0].roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?timelineTemplateId=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "timelineTemplateId", - "value": "test-" - } - ] + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure search challenge invalid parameter projectId 400", - "event": [ + "url": { + "raw": "{{URL}}/resources?challengeId={{CHALLENGE_UUID_DESIGN}}", + "host": [ + "{{URL}}" + ], + "path": [ + "resources" + ], + "query": [ { - "listen": "test", - "script": { - "id": "95899e59-0f3a-4db5-af7e-c9a5ec1473de", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } + "key": "challengeId", + "value": "{{CHALLENGE_UUID_DESIGN}}" } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + ] + } + }, + "response": [] + }, + { + "name": "Activate challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DESIGN'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DESIGN'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.subTrack).to.eq('WEB_DESIGNS')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.name).to.eq('Postman Design Challenge Test 4')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Design')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?projectId=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "projectId", - "value": "test-" - } - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "failure search challenge invalid parameter forumId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "ac34be41-d495-4cf6-9a30-bfc935051ac9", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "prerequest", + "script": { + "exec": [ + "var url = `${pm.environment.get('URL')}/challenges/${pm.environment.get('CHALLENGE_UUID_DESIGN')}`\r", + "var retryDelay = 5000;\r", + "var retryLimit = 5;\r", + "var awaken = false\r", + "// wait for legacy challenge processor to finish it's work\r", + "function isProcessingComplete(retryCount) {\r", + " pm.sendRequest({url: url,\r", + " method: \"GET\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " }}, function (err, response) {\r", + " if(err) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " }\r", + " } else {\r", + " if(!response.json().legacyId) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " } else if (!awaken) {\r", + " wakeLegacyProcessor()\r", + " retryLimit *= 2\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay)\r", + " }\r", + " }\r", + " }\r", + " });\r", + "}\r", + "\r", + "function wakeLegacyProcessor() {\r", + " pm.sendRequest({url: url,\r", + " method: \"PATCH\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " },\r", + " body: {status: \"Draft\"}\r", + " }, function () {\r", + " awaken= true\r", + " });\r", + "}\r", + "\r", + "isProcessingComplete(1);" ], - "url": { - "raw": "{{URL}}/challenges?forumId=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "forumId", - "value": "test-" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Active\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure search challenge invalid parameter legacyId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "5d90a6d2-3956-45af-a98e-7502e2924e45", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DESIGN}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_DESIGN}}" + ] + } + }, + "response": [] + }, + { + "name": "Get Activated Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DESIGN'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DESIGN'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.legacy.subTrack).to.eq('WEB_DESIGNS')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.name).to.eq('Postman Design Challenge Test 4')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('terms')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Design')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?legacyId=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "legacyId", - "value": "test-" - } - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "failure search challenge invalid parameter status 400", - "event": [ - { - "listen": "test", - "script": { - "id": "a4075458-d6fb-466b-b151-ce9c6c12b3f6", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DESIGN}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_DESIGN}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Create and activate a challenge for qa", + "item": [ + { + "name": "Create Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "if(pm.response.status === 'Created') {", + " const response = pm.response.json();", + " pm.environment.set('CHALLENGE_UUID_QA', response.id);", + " pm.expect(response).to.have.property('created')", + " pm.expect(response.createdBy).to.eq('tcwebservice')", + " pm.expect(response).to.have.property('updated')", + " pm.expect(response.updatedBy).to.eq('tcwebservice')", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_QA'))", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')", + " pm.expect(response.name).to.eq('Postman QA Challenge Test 5')", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")", + " pm.expect(response.privateDescription).to.eq('private description')", + " pm.expect(response.descriptionFormat).to.eq('markdown')", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')", + " pm.expect(response.prizeSets[0].type).to.eq('placement')", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')", + " pm.expect(response.tags[0]).to.eq('Other')", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))", + " pm.expect(response).to.have.property('startDate')", + " pm.expect(response.status).to.eq('Draft')", + " pm.expect(response).to.have.property('billing')", + " pm.expect(response.phases[0].name).to.eq('Registration')", + " pm.expect(response.phases[1].name).to.eq('Submission')", + " pm.expect(response.phases[2].name).to.eq('Review')", + " pm.expect(response.phases[3].name).to.eq('Appeals')", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')", + " pm.expect(response).to.have.property('endDate')", + " pm.expect(response.overview.totalPrizes).to.eq(1)", + " pm.expect(response.numOfSubmissions).to.eq(0)", + " pm.expect(response.numOfRegistrants).to.eq(0)", + " pm.expect(response).to.have.property('currentPhaseNames')", + " pm.expect(response).to.have.property('registrationStartDate')", + " pm.expect(response).to.have.property('registrationEndDate')", + " pm.expect(response).to.have.property('submissionStartDate')", + " pm.expect(response).to.have.property('submissionEndDate')", + " pm.expect(response.track).to.eq('Quality Assurance')", + " pm.expect(response.type).to.eq('Challenge')", + "}", + "" ], - "url": { - "raw": "{{URL}}/challenges?status=status-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "status", - "value": "status-" - } - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "failure search challenge invalid parameter gitRepoURL 400", - "event": [ - { - "listen": "test", - "script": { - "id": "0fe982b8-c52a-420a-a476-8e56d088f57e", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "prerequest", + "script": { + "exec": [ + "" ], - "url": { - "raw": "{{URL}}/challenges?gitRepoURL=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "gitRepoURL", - "value": "test-" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"typeId\": \"{{TYPE_CHALLENGE}}\",\n \"trackId\": \"{{TRACK_QA}}\",\n \"legacy\": {\n \"reviewType\": \"COMMUNITY\"\n },\n \"name\": \"Postman QA Challenge Test 5\",\n \"description\": \"Here's a large description with **markdown**\",\n \"privateDescription\": \"private description\",\n \"descriptionFormat\": \"markdown\",\n \"timelineTemplateId\": \"{{TIMELINE_TEMPLATE_CHALLENGE}}\",\n \"prizeSets\": [\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Challenge Prizes\",\n \"type\": \"placement\"\n },\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Copilot Payment\",\n \"type\": \"copilot\"\n }\n ],\n \"tags\": [\n \"Other\"\n ],\n \"projectId\": {{PROJECT_ID}},\n \"startDate\": \"{{tenMinFromNow}}\",\n \"status\": \"Draft\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure search challenge invalid parameter currentPhaseId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "34a93bfa-77e1-4970-92c4-92c5d76fa335", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "challenges" + ] + } + }, + "response": [] + }, + { + "name": "Get Created Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_QA'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_QA'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.name).to.eq('Postman QA Challenge Test 5')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Draft')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(0)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Quality Assurance')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?currentPhaseId=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "currentPhaseId", - "value": "test-" - } - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "failure search challenge invalid parameter memberId 400", - "event": [ - { - "listen": "test", - "script": { - "id": "3cf6b33a-862b-494c-a8a2-c5c3aacb8a15", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_QA}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_QA}}" + ] + } + }, + "response": [] + }, + { + "name": "Assign Member", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_QA_MEMBER_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_QA_MEMBER_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_QA'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?memberId=test-", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "memberId", - "value": "test-" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_QA}}\",\n \"memberHandle\": \"{{MEMBER_HANDLE}}\",\n \"roleId\": \"{{ROLE_SUBMITTER}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "search challenge using m2m with read scope", - "event": [ - { - "listen": "test", - "script": { - "id": "4eb00b6f-1558-4b6b-95d6-663c1d47b463", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Assign Copilot", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_QA_COPILOT_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_QA_COPILOT_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_QA'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?perPage=10&createdDateStart=2016-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "perPage", - "value": "10" - }, - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2016-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_QA}}\",\n \"memberHandle\": \"{{COPILOT_HANDLE}}\",\n \"roleId\": \"{{ROLE_COPILOT}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "search challenge using m2m without read scope(same as anonymous user)", - "event": [ - { - "listen": "test", - "script": { - "id": "2bb945f3-692f-4ddb-8a40-a917e7595a6f", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_attachments_read}}" - } + "path": [ + "resources" + ] + } + }, + "response": [] + }, + { + "name": "Get Resources on Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " const member = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_QA_MEMBER_UUID')})\r", + " pm.expect(member).to.have.length(1)\r", + " pm.expect(member[0].memberId).to.eq(pm.environment.get('CHALLENGE_QA_MEMBER_ID'))\r", + " pm.expect(member[0].memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(member[0].roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + " const copilot = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_QA_COPILOT_UUID')})\r", + " pm.expect(copilot).to.have.length(1)\r", + " pm.expect(copilot[0].memberId).to.eq(pm.environment.get('CHALLENGE_QA_COPILOT_ID'))\r", + " pm.expect(copilot[0].memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(copilot[0].roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?perPage=10&createdDateStart=2017-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "perPage", - "value": "10" - }, - { - "key": "createdBy", - "value": "TonyJ", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2017-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - } - ] + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{TOKEN}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "search startData & endDate", - "event": [ + "url": { + "raw": "{{URL}}/resources?challengeId={{CHALLENGE_UUID_QA}}", + "host": [ + "{{URL}}" + ], + "path": [ + "resources" + ], + "query": [ { - "listen": "test", - "script": { - "id": "924fdf13-686b-4dff-9d3e-f500b3f63def", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } + "key": "challengeId", + "value": "{{CHALLENGE_UUID_QA}}" } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } + ] + } + }, + "response": [] + }, + { + "name": "Activate challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_QA'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_QA'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.subTrack).to.eq('BUG_HUNT')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.name).to.eq('Postman QA Challenge Test 5')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Quality Assurance')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?page=1&perPage=10&startDateStart=2019-06-01T00:00:00Z&startDateEnd=2019-06-30T23:59:59Z&endDateStart=2361-01-01T00:00:00Z&endDateEnd=2361-12-31T23:59:59Z", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "perPage", - "value": "10" - }, - { - "key": "startDateStart", - "value": "2019-06-01T00:00:00Z" - }, - { - "key": "startDateEnd", - "value": "2019-06-30T23:59:59Z" - }, - { - "key": "endDateStart", - "value": "2361-01-01T00:00:00Z" - }, - { - "key": "endDateEnd", - "value": "2361-12-31T23:59:59Z" - } - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "search by search param", - "event": [ - { - "listen": "test", - "script": { - "id": "819af1a8-8d5e-41b7-bd97-f0b4b9dfc7db", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "prerequest", + "script": { + "exec": [ + "var url = `${pm.environment.get('URL')}/challenges/${pm.environment.get('CHALLENGE_UUID_QA')}`\r", + "var retryDelay = 5000;\r", + "var retryLimit = 5;\r", + "var awaken = false\r", + "// wait for legacy challenge processor to finish it's work\r", + "function isProcessingComplete(retryCount) {\r", + " pm.sendRequest({url: url,\r", + " method: \"GET\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " }}, function (err, response) {\r", + " if(err) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " }\r", + " } else {\r", + " if(!response.json().legacyId) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " } else if (!awaken) {\r", + " wakeLegacyProcessor()\r", + " retryLimit *= 2\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay)\r", + " }\r", + " }\r", + " }\r", + " });\r", + "}\r", + "\r", + "function wakeLegacyProcessor() {\r", + " pm.sendRequest({url: url,\r", + " method: \"PATCH\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " },\r", + " body: {status: \"Draft\"}\r", + " }, function () {\r", + " awaken= true\r", + " });\r", + "}\r", + "\r", + "isProcessingComplete(1);" ], - "url": { - "raw": "{{URL}}/challenges?search={{SEARCH_TAG}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "search", - "value": "{{SEARCH_TAG}}" - } - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Active\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "search by name", - "event": [ - { - "listen": "test", - "script": { - "id": "9d0603f1-5ead-4bb3-8068-5c6e2ef1d39a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_QA}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "path": [ + "challenges", + "{{CHALLENGE_UUID_QA}}" + ] + } + }, + "response": [] + }, + { + "name": "Get Activated Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_QA'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_QA'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.legacy.subTrack).to.eq('BUG_HUNT')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.name).to.eq('Postman QA Challenge Test 5')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('terms')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Quality Assurance')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], - "url": { - "raw": "{{URL}}/challenges?name={{SEARCH_NAME}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "name", - "value": "{{SEARCH_NAME}}" - } - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "search by description", - "event": [ - { - "listen": "test", - "script": { - "id": "0c929c99-ab84-483d-8fe8-c0ce66671949", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_QA}}", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges?description={{SEARCH_DESCRIPTION}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges" - ], - "query": [ - { - "key": "description", - "value": "{{SEARCH_DESCRIPTION}}" - } - ] - } - }, - "response": [] + "path": [ + "challenges", + "{{CHALLENGE_UUID_QA}}" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] } - ], - "protocolProfileBehavior": {} + ] }, { - "name": "AuditLogs", + "name": "Create and activate a challenge for ds", "item": [ { - "name": "search 1", + "name": "Create Challenge", "event": [ { "listen": "test", "script": { - "id": "b218474d-21bf-44ca-a52e-11c08ca122f9", "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "if(pm.response.status === 'Created') {", + " const response = pm.response.json();", + " pm.environment.set('CHALLENGE_UUID_DS', response.id);", + " pm.expect(response).to.have.property('created')", + " pm.expect(response.createdBy).to.eq('tcwebservice')", + " pm.expect(response).to.have.property('updated')", + " pm.expect(response.updatedBy).to.eq('tcwebservice')", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DS'))", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')", + " pm.expect(response.name).to.eq('Postman DS Challenge Test 6')", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")", + " pm.expect(response.privateDescription).to.eq('private description')", + " pm.expect(response.descriptionFormat).to.eq('markdown')", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')", + " pm.expect(response.prizeSets[0].type).to.eq('placement')", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')", + " pm.expect(response.tags[0]).to.eq('Other')", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))", + " pm.expect(response).to.have.property('startDate')", + " pm.expect(response.status).to.eq('Draft')", + " pm.expect(response).to.have.property('billing')", + " pm.expect(response.phases[0].name).to.eq('Registration')", + " pm.expect(response.phases[1].name).to.eq('Submission')", + " pm.expect(response.phases[2].name).to.eq('Review')", + " pm.expect(response.phases[3].name).to.eq('Appeals')", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')", + " pm.expect(response).to.have.property('endDate')", + " pm.expect(response.overview.totalPrizes).to.eq(1)", + " pm.expect(response.numOfSubmissions).to.eq(0)", + " pm.expect(response.numOfRegistrants).to.eq(0)", + " pm.expect(response).to.have.property('currentPhaseNames')", + " pm.expect(response).to.have.property('registrationStartDate')", + " pm.expect(response).to.have.property('registrationEndDate')", + " pm.expect(response).to.have.property('submissionStartDate')", + " pm.expect(response).to.have.property('submissionEndDate')", + " pm.expect(response.track).to.eq('Data Science')", + " pm.expect(response.type).to.eq('Challenge')", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "POST", "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, { "key": "Authorization", "type": "text", - "value": "Bearer {{admin_token}}" + "value": "Bearer {{TOKEN}}" } ], + "body": { + "mode": "raw", + "raw": "{\n \"typeId\": \"{{TYPE_CHALLENGE}}\",\n \"trackId\": \"{{TRACK_DS}}\",\n \"legacy\": {\n \"reviewType\": \"COMMUNITY\"\n },\n \"name\": \"Postman DS Challenge Test 6\",\n \"description\": \"Here's a large description with **markdown**\",\n \"privateDescription\": \"private description\",\n \"descriptionFormat\": \"markdown\",\n \"timelineTemplateId\": \"{{TIMELINE_TEMPLATE_CHALLENGE}}\",\n \"prizeSets\": [\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Challenge Prizes\",\n \"type\": \"placement\"\n },\n {\n \"prizes\": [\n {\n \"type\": \"USD\",\n \"value\": 1\n }\n ],\n \"description\": \"Copilot Payment\",\n \"type\": \"copilot\"\n }\n ],\n \"tags\": [\n \"Other\"\n ],\n \"projectId\": {{PROJECT_ID}},\n \"startDate\": \"{{tenMinFromNow}}\",\n \"status\": \"Draft\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z", + "raw": "{{URL}}/challenges", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" - ], - "query": [ - { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "fieldName", - "value": "n", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj", - "disabled": true - }, - { - "key": "perPage", - "value": "2", - "disabled": true - }, - { - "key": "page", - "value": "2", - "disabled": true - } + "challenges" ] } }, "response": [] }, { - "name": "search 2", + "name": "Get Created Challenge", "event": [ { "listen": "test", "script": { - "id": "44a23f59-76bd-4e0c-9abd-da4274b6cadd", "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DS'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DS'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.name).to.eq('Postman DS Challenge Test 6')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Draft')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(0)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Data Science')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + "}\r", + "" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ { - "key": "Accept", - "type": "text", - "value": "application/json" + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, { "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" + "name": "Content-Type", + "value": "application/json", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID2}}&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z&createdBy=ghostar", + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DS}}", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" - ], - "query": [ - { - "key": "challengeId", - "value": "{{CHALLENGE_ID2}}" - }, - { - "key": "fieldName", - "value": "n", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "ghostar" - } + "challenges", + "{{CHALLENGE_UUID_DS}}" ] } }, "response": [] }, { - "name": "failure search by user 403", + "name": "Assign Member", "event": [ { "listen": "test", "script": { - "id": "0ef608e0-f56f-497b-a85b-910f90ea9f91", "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_DS_MEMBER_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_DS_MEMBER_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_DS'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + "}\r", + "" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "POST", "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, { "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" + "value": "Bearer {{TOKEN}}", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_DS}}\",\n \"memberHandle\": \"{{MEMBER_HANDLE}}\",\n \"roleId\": \"{{ROLE_SUBMITTER}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&fieldName=n&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2019-03-22T00:00:00Z&createdBy=tonyj", + "raw": "{{URL}}/resources", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" - ], - "query": [ - { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "fieldName", - "value": "n" - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2019-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj" - } + "resources" ] } }, "response": [] }, { - "name": "failure search with expired token 401", + "name": "Assign Copilot", "event": [ { "listen": "test", "script": { - "id": "0cd2f68f-a7ed-43d3-bc63-a31b6d5d3eb9", "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('CHALLENGE_DS_COPILOT_UUID', response.id);\r", + " pm.environment.set('CHALLENGE_DS_COPILOT_ID', response.memberId);\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response).to.have.property('createdBy')\r", + " pm.expect(response.challengeId).to.eq(pm.environment.get('CHALLENGE_UUID_DS'))\r", + " pm.expect(response.memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(response.roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "POST", "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, { "key": "Authorization", "type": "text", - "value": "Bearer {{expire_token}}" + "value": "Bearer {{TOKEN}}" } ], + "body": { + "mode": "raw", + "raw": "{\n \"challengeId\": \"{{CHALLENGE_UUID_DS}}\",\n \"memberHandle\": \"{{COPILOT_HANDLE}}\",\n \"roleId\": \"{{ROLE_COPILOT}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&fieldName=n&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2019-03-22T00:00:00Z&createdBy=tonyj", + "raw": "{{URL}}/resources", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" - ], - "query": [ - { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "fieldName", - "value": "n" - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2019-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj" - } + "resources" ] } }, "response": [] }, { - "name": "failure search without token 401", + "name": "Get Resources on Challenge", "event": [ { "listen": "test", "script": { - "id": "45e452dc-30d1-4184-83ab-ee9e849fa503", "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " const member = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_DS_MEMBER_UUID')})\r", + " pm.expect(member).to.have.length(1)\r", + " pm.expect(member[0].memberId).to.eq(pm.environment.get('CHALLENGE_DS_MEMBER_ID'))\r", + " pm.expect(member[0].memberHandle).to.eq(pm.collectionVariables.get('MEMBER_HANDLE'))\r", + " pm.expect(member[0].roleId).to.eq(pm.collectionVariables.get('ROLE_SUBMITTER'))\r", + " const copilot = _.filter(response, o => { return o.id === pm.environment.get('CHALLENGE_DS_COPILOT_UUID')})\r", + " pm.expect(copilot).to.have.length(1)\r", + " pm.expect(copilot[0].memberId).to.eq(pm.environment.get('CHALLENGE_DS_COPILOT_ID'))\r", + " pm.expect(copilot[0].memberHandle).to.eq(pm.collectionVariables.get('COPILOT_HANDLE'))\r", + " pm.expect(copilot[0].roleId).to.eq(pm.collectionVariables.get('ROLE_COPILOT'))\r", + "}\r", + "" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", + "key": "Authorization", "type": "text", - "value": "application/json" + "value": "Bearer {{TOKEN}}" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&fieldName=n&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2019-03-22T00:00:00Z&createdBy=tonyj", + "raw": "{{URL}}/resources?challengeId={{CHALLENGE_UUID_DS}}", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" + "resources" ], "query": [ { "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "fieldName", - "value": "n" - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2019-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj" + "value": "{{CHALLENGE_UUID_DS}}" } ] } @@ -19690,2572 +3493,1181 @@ "response": [] }, { - "name": "failure search with invalid token 401", + "name": "Activate challenge", "event": [ { "listen": "test", "script": { - "id": "a3b93c2b-0b8d-48d0-8087-33acf87e5334", "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DS'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DS'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.subTrack).to.eq('CODE')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.name).to.eq('Postman DS Challenge Test 6')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.prizeSets[0].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[0].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[0].description).to.eq('Challenge Prizes')\r", + " pm.expect(response.prizeSets[0].type).to.eq('placement')\r", + " pm.expect(response.prizeSets[1].prizes[0].type).to.eq('USD')\r", + " pm.expect(response.prizeSets[1].prizes[0].value).to.eq(1)\r", + " pm.expect(response.prizeSets[1].description).to.eq('Copilot Payment')\r", + " pm.expect(response.prizeSets[1].type).to.eq('copilot')\r", + " pm.expect(response.tags[0]).to.eq('Other')\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Data Science')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var url = `${pm.environment.get('URL')}/challenges/${pm.environment.get('CHALLENGE_UUID_DS')}`\r", + "var retryDelay = 5000;\r", + "var retryLimit = 5;\r", + "var awaken = false\r", + "// wait for legacy challenge processor to finish it's work\r", + "function isProcessingComplete(retryCount) {\r", + " pm.sendRequest({url: url,\r", + " method: \"GET\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " }}, function (err, response) {\r", + " if(err) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " }\r", + " } else {\r", + " if(!response.json().legacyId) {\r", + " if (retryCount < retryLimit) {\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay);\r", + " } else if (!awaken) {\r", + " wakeLegacyProcessor()\r", + " retryLimit *= 2\r", + " setTimeout(function() {\r", + " isProcessingComplete(++retryCount);\r", + " }, retryDelay)\r", + " }\r", + " }\r", + " }\r", + " });\r", + "}\r", + "\r", + "function wakeLegacyProcessor() {\r", + " pm.sendRequest({url: url,\r", + " method: \"PATCH\",\r", + " header: {\r", + " \"content-type\": \"application/json\",\r", + " \"accept\": \"application/json\",\r", + " \"authorization\": `Bearer ${pm.environment.get(\"TOKEN\")}`\r", + " },\r", + " body: {status: \"Draft\"}\r", + " }, function () {\r", + " awaken= true\r", + " });\r", + "}\r", + "\r", + "isProcessingComplete(1);" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "PATCH", "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, { "key": "Authorization", - "type": "text", - "value": "Bearer invalid" + "value": "Bearer {{TOKEN}}", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "{\n \"status\": \"Active\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&fieldName=n&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2019-03-22T00:00:00Z&createdBy=tonyj", + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DS}}", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" - ], - "query": [ - { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "fieldName", - "value": "n" - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2019-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj" - } + "challenges", + "{{CHALLENGE_UUID_DS}}" ] } }, "response": [] }, { - "name": "failure search invalid parameter 400", + "name": "Get Activated Challenge", "event": [ { "listen": "test", "script": { - "id": "17ab3730-5225-4167-be06-a97f613bad9f", "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.expect(response.id).to.eq(pm.environment.get('CHALLENGE_UUID_DS'))\r", + " pm.expect(response).to.have.property('created')\r", + " pm.expect(response.createdBy).to.eq('tcwebservice')\r", + " pm.expect(response).to.have.property('updated')\r", + " pm.expect(response.updatedBy).to.eq('tcwebservice')\r", + " pm.expect(response.typeId).to.eq(pm.collectionVariables.get('TYPE_CHALLENGE'))\r", + " pm.expect(response.trackId).to.eq(pm.collectionVariables.get('TRACK_DS'))\r", + " pm.expect(response.legacy.reviewType).to.eq('COMMUNITY')\r", + " pm.expect(response.legacy.isTask).to.be.false\r", + " pm.expect(response.legacy.subTrack).to.eq('CODE')\r", + " pm.expect(response.legacy).to.have.property('directProjectId')\r", + " pm.expect(response.legacy).to.have.property('forumId')\r", + " pm.expect(response.name).to.eq('Postman DS Challenge Test 6')\r", + " pm.expect(response.description).to.eq(\"Here's a large description with **markdown**\")\r", + " pm.expect(response.privateDescription).to.eq('private description')\r", + " pm.expect(response.descriptionFormat).to.eq('markdown')\r", + " pm.expect(response.timelineTemplateId).to.eq(pm.collectionVariables.get('TIMELINE_TEMPLATE_CHALLENGE'))\r", + " pm.expect(response.projectId).to.eq(Number(pm.collectionVariables.get('PROJECT_ID')))\r", + " pm.expect(response).to.have.property('startDate')\r", + " pm.expect(response.status).to.eq('Active')\r", + " pm.expect(response).to.have.property('billing')\r", + " pm.expect(response.phases[0].name).to.eq('Registration')\r", + " pm.expect(response.phases[1].name).to.eq('Submission')\r", + " pm.expect(response.phases[2].name).to.eq('Review')\r", + " pm.expect(response.phases[3].name).to.eq('Appeals')\r", + " pm.expect(response.phases[4].name).to.eq('Appeals Response')\r", + " pm.expect(response).to.have.property('terms')\r", + " pm.expect(response).to.have.property('endDate')\r", + " pm.expect(response.overview.totalPrizes).to.eq(1)\r", + " pm.expect(response.numOfSubmissions).to.eq(0)\r", + " pm.expect(response.numOfRegistrants).to.eq(1)\r", + " pm.expect(response).to.have.property('currentPhaseNames')\r", + " pm.expect(response).to.have.property('registrationStartDate')\r", + " pm.expect(response).to.have.property('registrationEndDate')\r", + " pm.expect(response).to.have.property('submissionStartDate')\r", + " pm.expect(response).to.have.property('submissionEndDate')\r", + " pm.expect(response.track).to.eq('Data Science')\r", + " pm.expect(response.type).to.eq('Challenge')\r", + " pm.expect(response).to.have.property('legacyId')\r", + "}\r", + "" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ { - "key": "Accept", - "type": "text", - "value": "application/json" + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, { "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" + "name": "Content-Type", + "value": "application/json", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&invalid=n&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2019-03-22T00:00:00Z&createdBy=tonyj", + "raw": "{{URL}}/challenges/{{CHALLENGE_UUID_DS}}", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" - ], - "query": [ - { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "invalid", - "value": "n" - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2019-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj" - } + "challenges", + "{{CHALLENGE_UUID_DS}}" ] } }, "response": [] - }, + } + ] + }, + { + "name": "All challenges", + "item": [ { - "name": "search using m2m token", + "name": "Get Challenges", "event": [ { "listen": "test", "script": { - "id": "3d2250dc-20ba-4edb-9bf1-d5c5d7471cd6", "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ { - "key": "Accept", - "type": "text", - "value": "application/json" + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, { "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenge_audit_logs_read}}" + "name": "Content-Type", + "value": "application/json", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z", + "raw": "{{URL}}/challenges?status=Active&tracks=DS&tracks=QA&tracks=Des&tracks=Dev&types=CH&types=F2F&types=TSK", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" + "challenges" ], "query": [ { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" + "key": "status", + "value": "Active" }, { - "key": "fieldName", - "value": "n", - "disabled": true + "key": "tracks", + "value": "DS" }, { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" + "key": "tracks", + "value": "QA" }, { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" + "key": "tracks", + "value": "Des" }, { - "key": "createdBy", - "value": "tonyj", - "disabled": true + "key": "tracks", + "value": "Dev" }, { - "key": "perPage", - "value": "2", - "disabled": true + "key": "types", + "value": "CH" + }, + { + "key": "types", + "value": "F2F" }, { - "key": "page", - "value": "2", + "key": "types", + "value": "TSK" + }, + { + "key": "events", + "value": "tco21", "disabled": true } ] } }, "response": [] - }, + } + ] + }, + { + "name": "My active challenges", + "item": [ { - "name": "failure search using forbidden m2m token 403", + "name": "Get Member Id", "event": [ { "listen": "test", "script": { - "id": "4b00e36a-cbad-40d6-8bba-3218f1d81040", "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('MEMBER_ID', response[0].userId);\r", + "}\r", + "" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ { - "key": "Accept", - "type": "text", - "value": "application/json" + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, { "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" + "name": "Content-Type", + "value": "application/json", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenge-audit-logs?challengeId={{CHALLENGE_ID1}}&createdDateStart=2019-02-22T00:00:00Z&createdDateEnd=2022-03-22T00:00:00Z", + "raw": "{{URL}}/members?handle={{MEMBER_HANDLE}}", "host": [ "{{URL}}" ], "path": [ - "challenge-audit-logs" + "members" ], "query": [ { - "key": "challengeId", - "value": "{{CHALLENGE_ID1}}" - }, - { - "key": "fieldName", - "value": "n", - "disabled": true - }, - { - "key": "createdDateStart", - "value": "2019-02-22T00:00:00Z" - }, - { - "key": "createdDateEnd", - "value": "2022-03-22T00:00:00Z" - }, - { - "key": "createdBy", - "value": "tonyj", - "disabled": true - }, - { - "key": "perPage", - "value": "2", - "disabled": true - }, - { - "key": "page", - "value": "2", - "disabled": true + "key": "handle", + "value": "{{MEMBER_HANDLE}}" } ] } }, "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Attachments", - "item": [ + }, { - "name": "create attachment", - "item": [ - { - "name": "create attachment success", - "event": [ - { - "listen": "test", - "script": { - "id": "8b1f09a8-5974-421e-9fef-afb399a0dfdc", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"ATTACHMENT_ID1\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ], - "variable": [ - { - "key": "challengeId", - "value": "" - } - ] - } - }, - "response": [] - }, - { - "name": "create attachment using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "5b1d0616-2308-433a-b869-51e81d3c6a68", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"ATTACHMENT_ID2\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_create}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_02\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ] - } - }, - "response": [] - }, - { - "name": "create attachment for challenge with groups", - "event": [ - { - "listen": "test", - "script": { - "id": "675290da-28f4-4968-83d0-fc962e2c8ffc", - "exec": [ - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - " pm.environment.set(\"ATTACHMENT_ID3\", pm.response.json().id);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments" - ] - } - }, - "response": [] - }, - { - "name": "failure create attachment bucket not in whitelist", - "event": [ - { - "listen": "test", - "script": { - "id": "1ceb6e41-6342-4a8e-a2a2-e4db1e313079", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01\",\n \"fileSize\": 100,\n \"url\": \"http://test_bucket.s3.amazonaws.com/key1/key2\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ], - "variable": [ - { - "key": "challengeId", - "value": "" - } - ] - } - }, - "response": [] - }, - { - "name": "failure create attachment user can't access specific project", - "event": [ - { - "listen": "test", - "script": { - "id": "5c6bfa0c-085c-45fc-92f4-41894ffaf5de", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ] - } - }, - "response": [] - }, - { - "name": "failure create attachment without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "67ef6ff1-5768-438f-9f4b-9445f721186c", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_03\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ] - } - }, - "response": [] - }, - { - "name": "failure create attachment with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "8902e28e-25e3-4177-aa17-5bdd0996337b", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_04\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ] - } - }, - "response": [] - }, + "name": "Get Challenges of Member", + "event": [ { - "name": "failure create attachment with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "a9658760-e01e-41f3-81ad-32fd3ba7fdbe", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } + "listen": "test", + "script": { + "exec": [ + "const response = pm.response.json();\r", + "pm.environment.set('MEMBER_CHALLENGES', response);" ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_04\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments" - ] - } - }, - "response": [] + "type": "text/javascript" + } } ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "get attachment", - "item": [ - { - "name": "get attachment success", - "event": [ - { - "listen": "test", - "script": { - "id": "baecd0d5-d63b-4528-97c4-fc4dc9ded34a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "get attachment using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "9ebbea16-a303-4b6a-b13b-6f121dc92964", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_read}}" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get attachment by user without group access 403", - "event": [ - { - "listen": "test", - "script": { - "id": "597a1765-db8e-4509-8896-f8f4d66f0773", - "exec": [ - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments/{{ATTACHMENT_ID3}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments", - "{{ATTACHMENT_ID3}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get attachment not found 404", - "event": [ - { - "listen": "test", - "script": { - "id": "61fefc56-4e48-4759-9651-cfee57d0a920", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure get attachment without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "0b86a7dd-b9e9-4073-87e2-e9ffcc166b75", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "failure get attachment with invalid token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "0f828754-062b-46cc-a082-1e30ab28caed", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "failure get attachment with expired token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "475076f0-e284-4e01-b8a8-e9e92dd91f81", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{URL}}/resources/{{MEMBER_ID}}/challenges", + "host": [ + "{{URL}}" ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] + "path": [ + "resources", + "{{MEMBER_ID}}", + "challenges" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "download attachment", - "item": [ + "name": "Get Challenges", + "event": [ { - "name": "download attachment success", - "event": [ - { - "listen": "test", - "script": { - "id": "87628a74-d4f9-4322-8e6a-6a43f3f181d5", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}/download", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}", - "download" - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "failure download attachment by user without group access 403", - "event": [ - { - "listen": "test", - "script": { - "id": "6511d0b0-8847-46f0-8732-11e80ade9ff0", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{user_token}}" - } + "listen": "prerequest", + "script": { + "exec": [ + "_.forEach(pm.environment.get('MEMBER_CHALLENGES').slice(0, 10), challange => {\r", + "pm.request.addQueryParams(`ids[]=${challange}`)\r", + "})" ], - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments/{{ATTACHMENT_ID3}}/download", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments", - "{{ATTACHMENT_ID3}}", - "download" - ] - } - }, - "response": [] + "type": "text/javascript" + } } ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "partial update attachment", - "item": [ - { - "name": "partial update attachment success", - "event": [ - { - "listen": "test", - "script": { - "id": "a4c976b4-8a1a-43e7-93fd-37de6531e5f8", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + }, + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges?status=Active", + "host": [ + "{{URL}}" ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "path": [ + "challenges" + ], + "query": [ + { + "key": "status", + "value": "Active" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update attachment using m2m", - "event": [ { - "listen": "test", - "script": { - "id": "472aeefb-5c5e-4711-b4e8-79b928ce95af", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_update}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update_02\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "key": "tracks", + "value": "DS", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update attachment bucket not in whitelist", - "event": [ { - "listen": "test", - "script": { - "id": "d28075dd-c795-44b5-879c-f727228a5128", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update\",\n \"fileSize\": 125,\n \"url\": \"http://test_bucket.s3.amazonaws.com/key1/key2\"\n}" + "key": "tracks", + "value": "QA", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "partial update attachment user can't access specific project", - "event": [ { - "listen": "test", - "script": { - "id": "f802582a-a2ab-4d8e-885b-6afa5fa6cb83", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "key": "tracks", + "value": "Des", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update attachment not found 404", - "event": [ { - "listen": "test", - "script": { - "id": "75fd8370-c1da-40fe-bae6-cfa7adf61d2b", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update_03\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "key": "tracks", + "value": "Dev", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update attachment without token 401", - "event": [ { - "listen": "test", - "script": { - "id": "a400870f-5907-465b-a48f-bc9da4777f4e", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update_04\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "key": "types", + "value": "CH", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update attachment with invalid token 401", - "event": [ { - "listen": "test", - "script": { - "id": "50bf8952-0461-4ffd-9636-5bb650defc69", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update_05\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "key": "types", + "value": "F2F", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure partial update attachment with expired token 401", - "event": [ { - "listen": "test", - "script": { - "id": "31abe160-998a-48d7-86ae-41380a91efb7", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PATCH", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_partially_update_06\",\n \"fileSize\": 125,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\"\n}" + "key": "types", + "value": "TSK", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] + { + "key": "events", + "value": "tco21", + "disabled": true } - }, - "response": [] + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, + }, + "response": [] + } + ] + }, + { + "name": "Open for registration challenges", + "item": [ { - "name": "update attachment", - "item": [ + "name": "Get Challenges", + "event": [ { - "name": "update attachment success", - "event": [ - { - "listen": "test", - "script": { - "id": "72bc5eeb-be44-44d4-b44d-fa4ae0de1889", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] + "type": "text/javascript" + } }, { - "name": "update attachment using m2m", - "event": [ - { - "listen": "test", - "script": { - "id": "de023c73-f39f-415f-8479-2e305a7b9cc5", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_update}}" - } + "listen": "prerequest", + "script": { + "exec": [ + "" ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update_02\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" - }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, - "response": [] - }, - { - "name": "duplicate update attachment bucket no in whtelist", - "event": [ - { - "listen": "test", - "script": { - "id": "42514f8f-f9dd-4e4b-87fd-2296ad89b6d8", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges?status=Active¤tPhaseName=Registration&tracks=DS&tracks=QA&tracks=Des&tracks=Dev&types=CH&types=F2F&types=TSK", + "host": [ + "{{URL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update\",\n \"fileSize\": 100,\n \"url\": \"http://test_bucket.s3.amazonaws.com/key1/key2\",\n \"description\": \"description\"\n}" + "path": [ + "challenges" + ], + "query": [ + { + "key": "status", + "value": "Active" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update attachment user can't access specific project", - "event": [ { - "listen": "test", - "script": { - "id": "797a9487-1ece-44d9-8a5a-e40f81c9224a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" + "key": "currentPhaseName", + "value": "Registration" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update attachment not found 404", - "event": [ { - "listen": "test", - "script": { - "id": "6857e08e-abc8-4063-9f97-808565716240", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update_03\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" + "key": "tracks", + "value": "DS" + }, + { + "key": "tracks", + "value": "QA" + }, + { + "key": "tracks", + "value": "Des" + }, + { + "key": "tracks", + "value": "Dev" + }, + { + "key": "types", + "value": "CH" + }, + { + "key": "types", + "value": "F2F" + }, + { + "key": "types", + "value": "TSK" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] + { + "key": "events", + "value": "tco21", + "disabled": true } - }, - "response": [] + ] + } + }, + "response": [] + } + ] + }, + { + "name": "All past challenges", + "item": [ + { + "name": "Get Challenges", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } }, { - "name": "failure update attachment without token 401", - "event": [ - { - "listen": "test", - "script": { - "id": "e7399d79-4527-4123-9249-d49077db2576", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + }, + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{URL}}/challenges?status=Completed&tracks=DS&tracks=QA&tracks=Des&tracks=Dev&types=CH&types=F2F&types=TSK", + "host": [ + "{{URL}}" + ], + "path": [ + "challenges" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update_04\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" + "query": [ + { + "key": "status", + "value": "Completed" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update attachment with invalid token 401", - "event": [ { - "listen": "test", - "script": { - "id": "9e3a038a-7ba6-45d6-9b98-4bb5f6a35df7", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer invalid" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update_05\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" + "key": "tracks", + "value": "DS" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure update attachment with expired token 401", - "event": [ { - "listen": "test", - "script": { - "id": "bd54409a-87de-4403-9ccc-6c062f7f348b", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{expire_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"attachement_01_fully_update_06\",\n \"fileSize\": 100,\n \"url\": \"https://cdn.filestackcontent.com/6NQ4A9nRUWLYY1Z4raew\",\n \"description\": \"description\"\n}" + "key": "tracks", + "value": "QA" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "delete attachment", - "item": [ - { - "name": "delete attachment success", - "event": [ { - "listen": "test", - "script": { - "id": "9296c089-972e-4f8c-9138-50852069c855", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer {{admin_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "tracks", + "value": "Des" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "delete attachment using m2m", - "event": [ { - "listen": "test", - "script": { - "id": "8461006e-acef-4273-b220-1ffc885892ce", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{m2m_challenges_delete}}" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "tracks", + "value": "Dev" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete attachment user can't access specific project", - "event": [ { - "listen": "test", - "script": { - "id": "ef765d66-dca3-4992-8978-b61ac87de918", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{copilot1_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "types", + "value": "CH" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete attachment not found 404", - "event": [ { - "listen": "test", - "script": { - "id": "5bc563b1-2645-4000-af1f-9b472a45af21", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{admin_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "types", + "value": "F2F" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID2}}/attachments/{{ATTACHMENT_ID2}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID2}}", - "attachments", - "{{ATTACHMENT_ID2}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete attachment without token 401", - "event": [ { - "listen": "test", - "script": { - "id": "a7417210-f2f3-4dcf-ac7b-bde2209e08d0", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "types", + "value": "TSK" }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete attachment with invalid token 401", - "event": [ { - "listen": "test", - "script": { - "id": "fb444bdf-2eae-4787-b032-001f6e13609f", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer invalid", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "events", + "value": "tco21", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] - } - }, - "response": [] - }, - { - "name": "failure delete attachment with expired token 401", - "event": [ { - "listen": "test", - "script": { - "id": "62f91231-d89d-4c7e-8c28-4a6d5566603c", - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - }, - { - "key": "Authorization", - "value": "Bearer {{expire_token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" + "key": "endDateStart", + "value": "2020-04-05T00:00:00.000Z", + "disabled": true }, - "url": { - "raw": "{{URL}}/challenges/{{CHALLENGE_ID1}}/attachments/{{ATTACHMENT_ID1}}", - "host": [ - "{{URL}}" - ], - "path": [ - "challenges", - "{{CHALLENGE_ID1}}", - "attachments", - "{{ATTACHMENT_ID1}}" - ] + { + "key": "startDateEnd", + "value": "2022-04-05T23:59:59.999Z", + "disabled": true } - }, - "response": [] + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] } - ], - "protocolProfileBehavior": {} + ] }, { - "name": "HealthCheck", + "name": "My past challenges", "item": [ { - "name": "get app health status", + "name": "Get Member Id", "event": [ { "listen": "test", "script": { - "id": "912e3107-d7a5-41f9-9f12-824eb97da482", "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "if(pm.response.status === 'OK') {\r", + " const response = pm.response.json();\r", + " pm.environment.set('MEMBER_ID', response[0].userId);\r", + "}\r", + "" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ { - "key": "Accept", - "type": "text", - "value": "application/json" + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" }, { "key": "Content-Type", - "type": "text", - "value": "application/json" + "name": "Content-Type", + "value": "application/json", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{URL}}/challenges/health", + "raw": "{{URL}}/members?handle={{MEMBER_HANDLE}}", "host": [ "{{URL}}" ], "path": [ - "challenges", - "health" + "members" + ], + "query": [ + { + "key": "handle", + "value": "{{MEMBER_HANDLE}}" + } ] } }, "response": [] - } - ], - "event": [ + }, { - "listen": "prerequest", - "script": { - "id": "1288f98a-b7a1-46f0-a6bc-63ca1dac959b", - "type": "text/javascript", - "exec": [ - "" - ] - } + "name": "Get Challenges of Member", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const response = pm.response.json();\r", + "pm.environment.set('MEMBER_CHALLENGES', response);" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + }, + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{URL}}/resources/{{MEMBER_ID}}/challenges", + "host": [ + "{{URL}}" + ], + "path": [ + "resources", + "{{MEMBER_ID}}", + "challenges" + ] + } + }, + "response": [] }, { - "listen": "test", - "script": { - "id": "f7db78df-87dd-47fe-9828-65abf2909f9d", - "type": "text/javascript", - "exec": [ - "" - ] - } + "name": "Get Challenges", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "_.forEach(pm.environment.get('MEMBER_CHALLENGES').slice(0, 10), challange => {\r", + "pm.request.addQueryParams(`ids[]=${challange}`)\r", + "})\r", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{TOKEN}}", + "type": "text" + }, + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{URL}}/challenges?status=Completed&tracks=DS&tracks=QA&tracks=Des&tracks=Dev&types=CH&types=F2F&types=TSK", + "host": [ + "{{URL}}" + ], + "path": [ + "challenges" + ], + "query": [ + { + "key": "status", + "value": "Completed" + }, + { + "key": "tracks", + "value": "DS" + }, + { + "key": "tracks", + "value": "QA" + }, + { + "key": "tracks", + "value": "Des" + }, + { + "key": "tracks", + "value": "Dev" + }, + { + "key": "types", + "value": "CH" + }, + { + "key": "types", + "value": "F2F" + }, + { + "key": "types", + "value": "TSK" + }, + { + "key": "events", + "value": "tco21", + "disabled": true + }, + { + "key": "endDateStart", + "value": "2020-04-05T00:00:00.000Z", + "disabled": true + }, + { + "key": "startDateEnd", + "value": "2022-04-05T23:59:59.999Z", + "disabled": true + } + ] + } + }, + "response": [] } - ], - "protocolProfileBehavior": {} + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "const moment = require('moment');", + "pm.environment.set(\"tenMinFromNow\", moment().add(10, 'minutes').format(\"YYYY-MM-DDTHH:mm:ss[Z]\"));" + ] + } }, { - "name": "Elasticsearch - Get challenge index data", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "http://localhost:9200/challenge/_search", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "9200", - "path": [ - "challenge", - "_search" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } } ], "variable": [ { - "id": "1312fd20-67c8-4e3b-a1a4-17216c74923e", - "key": "SEARCH_TAG", - "value": "node" + "key": "ROLE_SUBMITTER", + "value": "732339e7-8e30-49d7-9198-cccf9451e221" + }, + { + "key": "ROLE_COPILOT", + "value": "cfe12b3f-2a24-4639-9d8b-ec86726f76bd" + }, + { + "key": "ROLE_MANAGER", + "value": "0e9c6879-39e4-4eb6-b8df-92407890faf1" + }, + { + "key": "ROLE_ITERATIVE_REVIEWER", + "value": "f6df7212-b9d6-4193-bfb1-b383586fce63" + }, + { + "key": "ROLE_REVIEWER", + "value": "318b9c07-079a-42d9-a81f-b96be1dc1099" + }, + { + "key": "ROLE_OBSERVER", + "value": "2a4dc376-a31c-4d00-b173-13934d89e286" + }, + { + "key": "TRACK_DEVELOPMENT", + "value": "9b6fc876-f4d9-4ccb-9dfd-419247628825" + }, + { + "key": "TRACK_DESIGN", + "value": "5fa04185-041f-49a6-bfd1-fe82533cd6c8" + }, + { + "key": "TRACK_QA", + "value": "36e6a8d0-7e1e-4608-a673-64279d99c115" + }, + { + "key": "TRACK_DS", + "value": "c0f5d461-8219-4c14-878a-c3a3f356466d" + }, + { + "key": "TYPE_CHALLENGE", + "value": "927abff4-7af9-4145-8ba1-577c16e64e2e" + }, + { + "key": "TYPE_F2F", + "value": "dc876fa4-ef2d-4eee-b701-b555fcc6544c" + }, + { + "key": "TYPE_TASK", + "value": "ecd58c69-238f-43a4-a4bb-d172719b9f31" + }, + { + "key": "TIMELINE_TEMPLATE_RUX", + "value": "2d0807fa-ece1-4328-a260-76f5f6b559e0" + }, + { + "key": "TIMELINE_TEMPLATE_CHALLENGE", + "value": "7ebf1c69-f62f-4d3a-bdfb-fe9ddb56861c" + }, + { + "key": "TIMELINE_TEMPLATE_DESIGN", + "value": "d4201ca4-8437-4d63-9957-3f7708184b07" + }, + { + "key": "TIMELINE_TEMPLATE_TASK", + "value": "53a307ce-b4b3-4d6f-b9a1-3741a58f77e6" + }, + { + "key": "TIMELINE_TEMPLATE_MM", + "value": "6969125a-a12f-4b89-8de6-e66b0056f36b" + }, + { + "key": "TIMELINE_TEMPLATE_F2F", + "value": "0a0fed34-cb5a-47f5-b0cb-6e2ee7de8dcb" + }, + { + "key": "PROJECT_ID", + "value": "17090" }, { - "id": "6e30a3d5-f665-461d-8920-2553d94daf10", - "key": "SEARCH_NAME", - "value": "skill" + "key": "MEMBER_HANDLE", + "value": "jcori30" }, { - "id": "c92467ac-7250-4e2b-b2ba-aa404611cbd9", - "key": "SEARCH_DESCRIPTION", - "value": "Topcoder" + "key": "COPILOT_HANDLE", + "value": "TCConnCopilot" } - ], - "protocolProfileBehavior": {} -} + ] +} \ No newline at end of file diff --git a/docs/topcoder-challenge-api.postman_environment.json b/docs/topcoder-challenge-api.postman_environment.json index ce354779..04f57829 100644 --- a/docs/topcoder-challenge-api.postman_environment.json +++ b/docs/topcoder-challenge-api.postman_environment.json @@ -1,294 +1,184 @@ { - "id": "d28e9c43-43c6-4170-9618-7e8ecf4044cd", - "name": "topcoder-challenge-api", + "id": "3ccf57f3-3f24-4929-bfec-5b7d23a388e5", + "name": "E2E Test Environment", "values": [ { - "key": "URL", - "value": "http://localhost:3000/v5", - "enabled": true - }, - { - "key": "user_token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJkZW5pcyIsImV4cCI6MTY0MjgwMDE2OSwidXNlcklkIjoiMjUxMjgwIiwiaWF0IjoxNTQ5Nzk5NTY5LCJlbWFpbCI6ImVtYWlsQGRvbWFpbi5jb20ueiIsImp0aSI6IjljNDUxMWM1LWMxNjUtNGExYi04OTllLWI2NWFkMGUwMmI1NSJ9.-SUfkKUhxNgLVFNRhCsk1wsm9J9tZHqek2_OlFqrZPw", - "enabled": true - }, - { - "key": "copilot1_token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJjb3BpbG90IiwiQ29ubmVjdCBTdXBwb3J0Il0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJHaG9zdGFyIiwiZXhwIjoxNjQyODAwMDc3LCJ1c2VySWQiOiIxNTE3NDMiLCJpYXQiOjE1NDk3OTk0NzcsImVtYWlsIjoiZW1haWxAZG9tYWluLmNvbS56IiwianRpIjoiMTJjMWMxMGItOTNlZi00NTMxLTgzMDUtYmE2NjVmYzRlMWI0In0.EvMG0xEACr9KWffPto50P0kNI51nKbuRicXjldMNN5Q", - "enabled": true - }, - { - "key": "copilot2_token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJjb3BpbG90Il0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJob2hvc2t5IiwiZXhwIjoxNjQxNzkyMzcwLCJ1c2VySWQiOiIxNjA5NjgyMyIsImlhdCI6MTU0OTc5MTc3MCwiZW1haWwiOiJlbWFpbEBkb21haW4uY29tLnoiLCJqdGkiOiJmMWU2MTNiZS1kNWI5LTQyMzEtYmFhZS1lZTlmMmQyMjcyMzQifQ.9uo3TR6Zo3L05r-zveJKiavYYG-JnJPusZUBb9MZY34", - "enabled": true - }, - { - "key": "admin_token", - "value": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSkZORGd4UlRVME5EWTBOVVkzTlRkR05qTXlRamxETmpOQk5UYzVRVUV3UlRFeU56TTJRUSJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiakdJZjJwZDNmNDRCMWpxdk9haTMwQklLVFphbllCZlVAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNjAzMDM3NjUxLCJleHAiOjE2MDMxMjQwNTEsImF6cCI6ImpHSWYycGQzZjQ0QjFqcXZPYWkzMEJJS1RaYW5ZQmZVIiwic2NvcGUiOiJ1cGRhdGU6dXNlcl9wcm9maWxlcyB3cml0ZTp1c2VyX3Byb2ZpbGVzIGNyZWF0ZTpjb25uZWN0X3Byb2plY3QgYWxsOmNoYWxsZW5nZXMgcmVhZDpjaGFsbGVuZ2VzIHdyaXRlOmNoYWxsZW5nZXMgYWxsOmdyb3VwcyB3cml0ZTpncm91cHMgcmVhZDpncm91cHMgdXBkYXRlOnN1Ym1pc3Npb24gcmVhZDpzdWJtaXNzaW9uIGRlbGV0ZTpzdWJtaXNzaW9uIGNyZWF0ZTpzdWJtaXNzaW9uIGFsbDpzdWJtaXNzaW9uIHJlYWQ6cHJvamVjdCBhbGw6Y29ubmVjdF9wcm9qZWN0IHJlYWQ6YnVzX3RvcGljcyB3cml0ZTpidXNfYXBpIHJlYWQ6ZW1haWxfdGVtcGxhdGVzIHJlYWQ6dXNlcl9wcm9maWxlcyByZWFkOnJvbGVzIHJlYWQ6cHJvamVjdC11c2VyIHJlYWQ6cHJvamVjdC1wZXJtaXNzaW9uIHJlYWQ6cmVzb3VyY2VzIHdyaXRlOnJlc291cmNlcyBkZWxldGU6cmVzb3VyY2VzIHVwZGF0ZTpyZXNvdXJjZXMgYWxsOnJlc291cmNlcyByZWFkOnRlcm1zIGFsbDp0ZXJtcyBhbGw6cHJvamVjdHMgcmVhZDpwcm9qZWN0cyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.Mnv7w3fgwuJg8SrrY1cg1CKYOfNUZD2rQCdYW7oTtuhGvew9_7WRw_WW8DokcFT0ID8c7iIzR_75Nxl2wHT-v6paZ5c6Z3VDduiA1ZPgqx0hUqqxYgK9ts-Ut-MBnUhcZN684grBDD8YNLMEOqNccl9C84du_43r3HYsiJvbx-P0366O2XFHLv-UomK5SUKiIzVvF4wmUDKCHMrkg8r4q9iAH4tQ_jEi3_UHGOUFSnnfaD5a3ZatqbSKroI7W9DextifLvlFypckXPRXC658gDPpqxfxix4OYpBvS5yvYWfiB5erzcXehcXc5yzcM5xpAp_BsVJrAdwa2x-7rvMykQ", - "enabled": true - }, - { - "key": "TYPEA_ID", - "value": "0494bf18-93fb-4320-bd54-f23465b649b6", - "enabled": true - }, - { - "key": "TYPEB_ID", - "value": "c61db679-8b9c-4ddc-b41e-889dd035cd47", - "enabled": true - }, - { - "key": "CHALLENGE_ID1", - "value": "f5121f11-e24b-42f9-9625-1da20ee94057", - "enabled": true - }, - { - "key": "SETTINGA_ID", - "value": "7bb8a726-278b-498f-89e1-2c6caabd7932", - "enabled": true - }, - { - "key": "SETTINGB_ID", - "value": "2c6dfd54-38d2-4a42-a3b3-0bff809b71f3", - "enabled": true - }, - { - "key": "m2m_token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUyMTE5NDQ4LCJleHAiOjE2NDIyMDU4NDgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6dXNlcl9wcm9maWxlcyBhbGw6d3JpdGU6dXNlcl9wcm9maWxlcyB3cml0ZTp1c2VyX3Byb2ZpbGVzIHJlYWQ6Y2hhbGxlbmdlcyByZWFkOmdyb3VwcyB1cGRhdGU6c3VibWlzc2lvbiByZWFkOnN1Ym1pc3Npb24gY3JlYXRlOnN1Ym1pc3Npb24gcmVhZDpyZXZpZXdfdHlwZSB1cGRhdGU6cmV2aWV3X3N1bW1hdGlvbiByZWFkOnJldmlld19zdW1tYXRpb24gZGVsZXRlOnJldmlld19zdW1tYXRpb24gY3JlYXRlOnJldmlld19zdW1tYXRpb24gYWxsOnJldmlld19zdW1tYXRpb24gdXBkYXRlOnJldmlldyByZWFkOnJldmlldyBkZWxldGU6cmV2aWV3IGNyZWF0ZTpyZXZpZXcgYWxsOnJldmlldyB3cml0ZTpidXNfYXBpIHJlYWQ6dXNlcl9wcm9maWxlcyByZWFkOnJvbGVzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.Q-IV0XFunyZtRo7dFkK1R9vx7RsTJny3M8t7lCLIDPk", - "enabled": true - }, - { - "key": "expire_token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJjb3BpbG90IiwiQ29ubmVjdCBTdXBwb3J0Il0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJHaG9zdGFyIiwiZXhwIjoxNTQ5ODAwMDc3LCJ1c2VySWQiOiIxNTE3NDMiLCJpYXQiOjE1NDk3OTk0NzcsImVtYWlsIjoiZW1haWxAZG9tYWluLmNvbS56IiwianRpIjoiMTJjMWMxMGItOTNlZi00NTMxLTgzMDUtYmE2NjVmYzRlMWI0In0.2n8k9pb16sE7LOLF_7mjAvEVKgggzS-wS3_8n2-R4RU", - "enabled": true - }, - { - "key": "CHALLENGE_ID2", - "value": "2204ee94-d042-4528-b277-e1b3f582f4ad", - "enabled": true - }, - { - "key": "TEST_TYPE_ID1", - "value": "ff9e7435-921a-414e-ab68-ab366a679b56", - "enabled": true - }, - { - "key": "TEST_TYPE_ID2", - "value": "e41a5f0e-5fc1-43e3-bdf9-9ed0e19f822f", - "enabled": true - }, - { - "key": "TEST_TYPE_ID3", - "value": "2aa0566a-997a-46c1-b520-f8f8291adbd8", - "enabled": true - }, - { - "key": "TEST_TYPE_ID4", - "value": "e04569ba-f534-494a-926a-b5dc643c2a5d", + "key": "TOKEN", + "value": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSkZORGd4UlRVME5EWTBOVVkzTlRkR05qTXlRamxETmpOQk5UYzVRVUV3UlRFeU56TTJRUSJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZ1o2anQ1MEhZSExCZjR2aHhqVWhYUFpPUjdRNWxrNGtAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNjE3NjY2MTcwLCJleHAiOjE2MTc3NTI1NzAsImF6cCI6ImdaNmp0NTBIWUhMQmY0dmh4alVoWFBaT1I3UTVsazRrIiwic2NvcGUiOiJyZWFkOnVzZXJfaWRwX3Rva2VucyByZWFkOmNoYWxsZW5nZXMgd3JpdGU6Y2hhbGxlbmdlcyBhbGw6Z3JvdXBzIHdyaXRlOmdyb3VwcyByZWFkOmdyb3VwcyByZWFkOnJldmlld190eXBlIHJlYWQ6cmV2aWV3IHJlYWQ6cHJvamVjdCByZWFkOmJ1c190b3BpY3Mgd3JpdGU6YnVzX2FwaSByZWFkOmVtYWlsX3RlbXBsYXRlcyByZWFkOnVzZXJfcHJvZmlsZXMgcmVhZDpyb2xlcyByZWFkOnByZWZlcmVuY2VzIHJlYWQ6cHJvamVjdC11c2VyIHJlYWQ6cHJvamVjdC1wZXJtaXNzaW9uIHJlYWQ6bG9va3VwcyByZWFkOnJlc291cmNlcyB3cml0ZTpyZXNvdXJjZXMgdXBkYXRlOnJlc291cmNlcyByZWFkOnRlcm1zIHJlYWQ6cHJvamVjdHMgcmVhZDpwcm9qZWN0LW1lbWJlcnMgd3JpdGU6cHJvamVjdC1tZW1iZXJzIHJlYWQ6YWNoaWV2ZW1lbnQgcmVhZDphY2hpZXZlbWVudHNQcm92aWRlciByZWFkOmF0dHJpYnV0ZSByZWFkOmF0dHJpYnV0ZUdyb3VwIGFsbDphdHRyaWJ1dGVHcm91cCBjcmVhdGU6YXR0cmlidXRlR3JvdXAgdXBkYXRlOmF0dHJpYnV0ZUdyb3VwIHJlYWQ6b3JnYW5pemF0aW9uIHJlYWQ6cm9sZSByZWFkOnNraWxsIHJlYWQ6c2tpbGxzUHJvdmlkZXIgcmVhZDp1c2VyQXR0cmlidXRlIHJlYWQ6dXNlcnNSb2xlIHJlYWQ6dXNlcnNTa2lsbCByZWFkOmdyb3VwIGFsbDpncm91cCB1cGRhdGU6Z3JvdXAgY3JlYXRlOmdyb3VwIGNyZWF0ZTpjaGFsbGVuZ2VzIGNyZWF0ZTpyZXNvdXJjZXMgcmVhZDp1c2VyIHJlYWQ6dGFhcy10ZWFtcyByZWFkOnRhYXMtam9icyBhbGw6dGFhcy1qb2JzIHJlYWQ6dGFhcy1qb2JDYW5kaWRhdGVzIGFsbDp0YWFzLWpvYkNhbmRpZGF0ZXMgYWxsOnRhYXMtcmVzb3VyY2VCb29raW5ncyByZWFkOnByb2plY3QtaW52aXRlcyB3cml0ZTpwcm9qZWN0LWludml0ZXMgdXBkYXRlOmNoYWxsZW5nZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.eduR0UhA4ZPEr3Naj-1MMDBqwblWScJ6dRdVPf5lUZ316IhshrTgQA_OAGuETszDiCzLG1Y-xnyF482Ri-EL5RYMct6cjbzs0gxFCs2B4hRs_qrv6dl32pEW71Cbk3cnWPZYiW0QR4LyfhPmro7mY9jLZN-0Vwg4ugad1fTpKaepAGahGnHLkhl44MVYSR9DFd9cWNs7FDhJQu4BVBuIkT4hhFiHQXUzSEPHfHSuTT-aTL3Qy05V6MnGVwiNXO_bxjyBmE3WUodHTxkte69Nf4MEzEIbK9VT9hrRR2_0CxLzhOfnlMyOf5BS17jWHeJ37O_IAnFYk5mLF7_g0PI7mQ", "enabled": true }, { - "key": "TEST_TYPE_ID5", - "value": "8c25a2d9-c47e-4b06-8570-a2f9aeca9280", - "enabled": true - }, - { - "key": "PHASEA_ID", - "value": "a6d46828-212d-4373-84fc-02e25bc6e520", - "enabled": true - }, - { - "key": "PHASEB_ID", - "value": "8c232afc-e560-4cd4-9cc5-c8d9b62a36e6", - "enabled": true - }, - { - "key": "PHASEC_ID", - "value": "d152280a-e7e2-4561-8afc-414b363da1a1", - "enabled": true - }, - { - "key": "PHASED_ID", - "value": "8a6907ea-8470-466d-8418-ea788807fd49", - "enabled": true - }, - { - "key": "TEMPLATEA_ID", - "value": "aa0dc72d-ecea-40d6-9d4a-41c16a76aa44", - "enabled": true - }, - { - "key": "TEMPLATEB_ID", - "value": "b65c8031-e95d-4cab-808a-0354bcb102ff", + "key": "URL", + "value": "https://api.topcoder-dev.com/v5", "enabled": true }, { - "key": "TEMPLATEC_ID", - "value": "4eb47db9-bbd0-49a9-ba72-3d3cc4c59418", + "key": "tenMinFromNow", + "value": "", "enabled": true }, { - "key": "ATTACHMENT_ID1", - "value": "2193b392-394d-44c3-9257-1f3c4907558b", + "key": "CHALLENGE_UUID_PAYMENT", + "value": "", "enabled": true }, { - "key": "ATTACHMENT_ID2", - "value": "3aea806a-9f32-435d-b095-9f44df2a5098", + "key": "CHALLENGE_PAYMENT_MEMBER_UUID", + "value": "", "enabled": true }, { - "key": "m2m_challenges_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOmNoYWxsZW5nZXMgYWxsOmNoYWxsZW5nZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.lCdI9MoI7xe3fQ3VM9ZuccH8VY1xaknBTPel7GmqxXg", + "key": "CHALLENGE_PAYMENT_MEMBER_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenges_create", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6Y2hhbGxlbmdlcyBhbGw6Y2hhbGxlbmdlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.5jrCnGH00i6cxDyY_nSKmvNGI-yd_niA9jMN43P5z70", + "key": "CHALLENGE_PAYMENT_COPILOT_UUID", + "value": "", "enabled": true }, { - "key": "m2m_challenges_update", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6Y2hhbGxlbmdlcyBhbGw6Y2hhbGxlbmdlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.dN4uHhmPN33ljY2YSZmndxAnSXaowQaYENiPL5wjDvc", + "key": "CHALLENGE_PAYMENT_COPILOT_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenges_delete", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJkZWxldGU6Y2hhbGxlbmdlcyBhbGw6Y2hhbGxlbmdlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.NCZdRy3TErhxG5A2ic4ahC70xfihq2UA5y0Z7OyR7Go", + "key": "CHALLENGE_UUID_PAYMENT_V5", + "value": "", "enabled": true }, { - "key": "m2m_challenge_types_create", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6Y2hhbGxlbmdlX3R5cGVzIGFsbDpjaGFsbGVuZ2VfdHlwZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.Njg1n3o0I8J9aa6y8xdiwfZFIGH2rJmW-7vKv3kXg5I", + "key": "CHALLENGE_PAYMENT_V5_MEMBER_UUID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_types_update", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6Y2hhbGxlbmdlX3R5cGVzIGFsbDpjaGFsbGVuZ2VfdHlwZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.mEjV3klV9EQB0lYrUdx2ky-kTaVU7hlZcTHAQYa974k", + "key": "CHALLENGE_PAYMENT_V5_MEMBER_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_settings_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOmNoYWxsZW5nZV9zZXR0aW5ncyBhbGw6Y2hhbGxlbmdlX3NldHRpbmdzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.4aQiQZ4zf_Dj1DxAwpiAJZz-rwHflLtw6V77aeQFiw4", + "key": "CHALLENGE_PAYMENT_V5_COPILOT_UUID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_settings_create", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6Y2hhbGxlbmdlX3NldHRpbmdzIGFsbDpjaGFsbGVuZ2Vfc2V0dGluZ3MiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.yop9LoMiQhpk5KD7hE6N1zL121J0LygCGv-ODRUOltY", + "key": "CHALLENGE_PAYMENT_V5_COPILOT_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_settings_update", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6Y2hhbGxlbmdlX3NldHRpbmdzIGFsbDpjaGFsbGVuZ2Vfc2V0dGluZ3MiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.4vZsCHKu0ENcuG4ZpYy6s-pJh6_fTMMwmvWE0Rx-YVA", + "key": "CHALLENGE_UUID_DEVELOPMENT", + "value": "", "enabled": true }, { - "key": "m2m_challenge_audit_logs_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOmNoYWxsZW5nZV9hdWRpdF9sb2dzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.pWfWhG1Ngv1T03B1NLCHeCwBTxACcCWysL0gNLlixG8", + "key": "CHALLENGE_DEVELOPMENT_MEMBER_UUID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_phases_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOmNoYWxsZW5nZV9waGFzZXMgYWxsOmNoYWxsZW5nZV9waGFzZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.p6chyXJfu_MhLCusS8OR6LpUPMUrVAOg3ORlPg_GN7A", + "key": "CHALLENGE_DEVELOPMENT_MEMBER_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_phases_create", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6Y2hhbGxlbmdlX3BoYXNlcyBhbGw6Y2hhbGxlbmdlX3BoYXNlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.eRTCL9QS0S-Gwk1A27xKjNvy7VhN51tOIX6nRy-daT4", + "key": "CHALLENGE_DEVELOPMENT_COPILOT_UUID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_phases_delete", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJkZWxldGU6Y2hhbGxlbmdlX3BoYXNlcyBhbGw6Y2hhbGxlbmdlX3BoYXNlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.p9vPmO-poXEFxgA7bLNBs9fKoLlDrLPZlpbM1WDiTb0", + "key": "CHALLENGE_DEVELOPMENT_COPILOT_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_phases_update", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6Y2hhbGxlbmdlX3BoYXNlcyBhbGw6Y2hhbGxlbmdlX3BoYXNlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.TuCYJTWarBPGV7JMeGhVEEpTKhwXHCxGvl8I0FZVZVw", + "key": "CHALLENGE_UUID_DESIGN", + "value": "", "enabled": true }, { - "key": "m2m_timeline_templates_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOnRpbWVsaW5lX3RlbXBsYXRlcyBhbGw6dGltZWxpbmVfdGVtcGxhdGVzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.NZiFiua2_5DnYOZCKKPmkeP4xS0z06Vm8c2bxybJQ80", + "key": "CHALLENGE_DESIGN_MEMBER_UUID", + "value": "", "enabled": true }, { - "key": "m2m_timeline_templates_create", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6dGltZWxpbmVfdGVtcGxhdGVzIGFsbDp0aW1lbGluZV90ZW1wbGF0ZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.wLTdLtHg_T9_gWcY8_gjV_hh3_RnISHqIpnM-TjbIs0", + "key": "CHALLENGE_DESIGN_MEMBER_ID", + "value": "", "enabled": true }, { - "key": "m2m_timeline_templates_delete", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJkZWxldGU6dGltZWxpbmVfdGVtcGxhdGVzIGFsbDp0aW1lbGluZV90ZW1wbGF0ZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.L8YkMmEH786j-DLm4X8FKlr836Wh_y-wuCLPHA9_aKE", + "key": "CHALLENGE_DESIGN_COPILOT_UUID", + "value": "", "enabled": true }, { - "key": "m2m_timeline_templates_update", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6dGltZWxpbmVfdGVtcGxhdGVzIGFsbDp0aW1lbGluZV90ZW1wbGF0ZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.qZBv5H905pTfKm2ISfhXVZ7ZJBLqT4eo_6XUlKNt-uo", + "key": "CHALLENGE_DESIGN_COPILOT_ID", + "value": "", "enabled": true }, { - "key": "m2m_challenge_attachments_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOmNoYWxsZW5nZV9hdHRhY2htZW50cyBhbGw6Y2hhbGxlbmdlX2F0dGFjaG1lbnRzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.19Ntb7Z0YnNwtS-_P79UmIaTb6AsFb0L5NdA9tQNhJw", + "key": "CHALLENGE_UUID_QA", + "value": "", "enabled": true }, { - "key": "m2m_challenge_attachments_create", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6Y2hhbGxlbmdlX2F0dGFjaG1lbnRzIGFsbDpjaGFsbGVuZ2VfYXR0YWNobWVudHMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.9w-HPsR3XQtFIu_gSSLXHp1KhetgsxKikoa4ChWF4L8", + "key": "CHALLENGE_QA_MEMBER_UUID", + "value": "", "enabled": true }, { - "key": "TEST_TYPE_M2M_ID", - "value": "e0d5202c-e9e5-4ec2-a218-3c08688813a5", + "key": "CHALLENGE_QA_MEMBER_ID", + "value": "", "enabled": true }, { - "key": "TEST_PHASE_M2M_ID", - "value": "06f2e9f2-656e-4862-838c-75e793fd2f8c", + "key": "CHALLENGE_QA_COPILOT_UUID", + "value": "", "enabled": true }, { - "key": "TEST_TEMPLATE_M2M_ID", - "value": "ba402af0-b13a-4772-9550-d0988635672b", + "key": "CHALLENGE_QA_COPILOT_ID", + "value": "", "enabled": true }, { - "key": "TEST_CHALLENGE_M2M_ID", + "key": "CHALLENGE_UUID_DS", "value": "", "enabled": true }, { - "key": "TEST_ATTACHMENT_M2M_ID", + "key": "CHALLENGE_DS_MEMBER_UUID", "value": "", "enabled": true }, { - "key": "m2m_full", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJhbGw6Y2hhbGxlbmdlcyBhbGw6Y2hhbGxlbmdlX3R5cGVzIGFsbDpjaGFsbGVuZ2Vfc2V0dGluZ3MgcmVhZDpjaGFsbGVuZ2VfYXVkaXRfbG9ncyBhbGw6Y2hhbGxlbmdlX3BoYXNlcyBhbGw6dGltZWxpbmVfdGVtcGxhdGVzIGFsbDpjaGFsbGVuZ2VfYXR0YWNobWVudHMgYWxsOmNoYWxsZW5nZV90eXBlX3RpbWVsaW5lX3RlbXBsYXRlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.awnxYbm_pXBG6oFZ_GL5yEynyIs1XFkZYxqejWDwHcA", + "key": "CHALLENGE_DS_MEMBER_ID", + "value": "", "enabled": true }, { - "key": "m2m_read", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJyZWFkOmNoYWxsZW5nZXMgcmVhZDpjaGFsbGVuZ2VfdHlwZXMgcmVhZDpjaGFsbGVuZ2Vfc2V0dGluZ3MgcmVhZDpjaGFsbGVuZ2VfYXVkaXRfbG9ncyByZWFkOmNoYWxsZW5nZV9waGFzZXMgcmVhZDp0aW1lbGluZV90ZW1wbGF0ZXMgcmVhZDpjaGFsbGVuZ2VfYXR0YWNobWVudHMgcmVhZDpjaGFsbGVuZ2VfdHlwZV90aW1lbGluZV90ZW1wbGF0ZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.42z45gBlNrmNnMWotizgQJxSLh8G_3gf2BWoqQJSvjM", + "key": "CHALLENGE_DS_COPILOT_UUID", + "value": "", "enabled": true }, { - "key": "m2m_update", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJjcmVhdGU6Y2hhbGxlbmdlcyB1cGRhdGU6Y2hhbGxlbmdlcyBjcmVhdGU6Y2hhbGxlbmdlX3R5cGVzIHVwZGF0ZTpjaGFsbGVuZ2VfdHlwZXMgY3JlYXRlOmNoYWxsZW5nZV9zZXR0aW5ncyB1cGRhdGU6Y2hhbGxlbmdlX3NldHRpbmdzIGNyZWF0ZTpjaGFsbGVuZ2VfcGhhc2VzIHVwZGF0ZTpjaGFsbGVuZ2VfcGhhc2VzIGRlbGV0ZTpjaGFsbGVuZ2VfcGhhc2VzIGNyZWF0ZTp0aW1lbGluZV90ZW1wbGF0ZXMgdXBkYXRlOnRpbWVsaW5lX3RlbXBsYXRlcyBkZWxldGU6dGltZWxpbmVfdGVtcGxhdGVzIGNyZWF0ZTpjaGFsbGVuZ2VfYXR0YWNobWVudHMgY3JlYXRlOmNoYWxsZW5nZV90eXBlX3RpbWVsaW5lX3RlbXBsYXRlcyB1cGRhdGU6Y2hhbGxlbmdlX3R5cGVfdGltZWxpbmVfdGVtcGxhdGVzIGRlbGV0ZTpjaGFsbGVuZ2VfdHlwZV90aW1lbGluZV90ZW1wbGF0ZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.a4F8HJc2mH6jDwghLO9UQku2aj0K003Ry3OCmeafuqI", + "key": "CHALLENGE_DS_COPILOT_ID", + "value": "", "enabled": true }, { - "key": "TYPE_TEMPLATEA_ID", + "key": "MEMBER_ID", "value": "", "enabled": true }, { - "key": "m2m_challenges_delete", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2NDA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJkZWxldGU6Y2hhbGxlbmdlcyBhbGw6Y2hhbGxlbmdlcyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.NCZdRy3TErhxG5A2ic4ahC70xfihq2UA5y0Z7OyR7Go", + "key": "MEMBER_CHALLENGES", + "value": "", "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-10-24T07:58:06.362Z", - "_postman_exported_using": "Postman/7.29.0" -} + "_postman_exported_at": "2021-04-06T00:32:54.636Z", + "_postman_exported_using": "Postman/8.1.0" +} \ No newline at end of file From fd04800f206ccf174486e22603c4a5e0abb0a3a9 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 11 Jun 2021 23:41:15 +0300 Subject: [PATCH 05/83] documentation changes --- README.md | 100 ++++++++++++++++++++++++++++++---------------- config/default.js | 2 +- package.json | 8 +++- 3 files changed, 74 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index aca20b6c..c369b29c 100644 --- a/README.md +++ b/README.md @@ -81,50 +81,82 @@ You can find sample `.env` files inside the `/docs` directory. 5. View table data in default environment: `npm run view-data `, ModelName can be `Challenge`, `ChallengeType`, `AuditLog`, `Phase`, `TimelineTemplate`or `Attachment` 6. Create Elasticsearch index: `npm run init-es`, or to re-create index: `npm run init-es force` 7. Synchronize ES data and DynamoDB data: `npm run sync-es` +8. Start all the depending services for local deployment: `npm run services:up` +9. Stop all the depending services for local deployment: `npm run services:down` +10. Check the logs of all the depending services for local deployment: `npm run services:logs` +11. Initialize the local environments: `npm run local:init` +12. Reset the local environments: `npm run local:reset` + ### Notes - The seed data are located in `src/scripts/seed` ## Local Deployment +0. Make sure to use Node v10+ by command `node -v`. We recommend using [NVM](https://github.com/nvm-sh/nvm) to quickly switch to the right version: + + ```bash + nvm use + ``` + +1. 📦 Install npm dependencies + + ```bash + npm install + ``` + +2. ⚙ Local config + In the `challenge-api` root directory create `.env` file with the next environment variables. Values for **Auth0 config** should be shared with you on the forum.
+ ```bash + # Auth0 config + AUTH0_URL= + AUTH0_PROXY_SERVER_URL= + AUTH0_AUDIENCE= + AUTH0_CLIENT_ID= + AUTH0_CLIENT_SECRET= + + # Locally deployed services (via docker-compose) + IS_LOCAL_DB=true + DYNAMODB_URL=http://localhost:8000 + ``` + + - Values from this file would be automatically used by many `npm` commands. + - ⚠️ Never commit this file or its copy to the repository! + +3. 🚢 Start docker-compose with services which are required to start Topcoder Challenges API locally + + ```bash + npm run services:up + ``` + +4. ♻ Update following two parts: +- https://github.com/topcoder-platform/challenge-api/blob/develop/src/models/Challenge.js#L116 + `throughput: 'ON_DEMAND',` should be updated to `throughput:{ read: 4, write: 2 },` +- https://github.com/topcoder-platform/challenge-api/blob/develop/config/default.js#L27-L28 -### AWS S3 Setup -Go to https://console.aws.amazon.com/ and login. Choose S3 from Service folder and click `Create bucket`. Following the instruction to create S3 bucket. +5. ♻ Create tables. -### Local services setup -In the `local` folder, run `docker-compose up` to start Elasticsearch, DynamoDB, S3 compatible server and Mock API. + ```bash + npm run create-tables + # Use `npm run drop-tables` to drop tables. + ``` -### Create Tables -1. Make sure DynamoDB are running as per instructions above. -2. Make sure you have configured all config parameters. Refer [Configuration](#configuration) -3. Run `npm run create-tables` to create tables. +6. ♻ Init DB, ES -### Mock API -The provided mock API provides mock endpoint to fetch challenge resources and groups so you don't have to deploy the related services locally. -You need to ensure DynamoDB configuration in `mock-api/config/default.js` is consistent with `config/default.js` -Mock API starts after running `docker-compose up` and expose port 4000. + ```bash + npm run local:init + ``` -### Notes -There are two parts need to be updated for local development -- https://github.com/topcoder-platform/challenge-api/blob/develop/src/models/Challenge.js#L116 -`throughput: 'ON_DEMAND',` should be updated to `throughput:{ read: 4, write: 2 },` -- https://github.com/topcoder-platform/challenge-api/blob/develop/config/default.js#L27-L28 -Two aws config should be uncommented - -and AUTH0 related configuration must be set at config file or in env variables. - -### Deploy the app - -- Follow the Notes section above -- Install dependencies `npm install` -- Run lint `npm run lint` -- Run lint fix `npm run lint:fix` -- initialize Elasticsearch, create configured Elasticsearch index if not present: `npm run init-es`, - or re-create the index: `npm run init-es force` -- Create tables `npm run create-tables` -- Clear and init db `npm run init-db` -- Seed tables: `npm run seed-tables` -- Start app `npm start` -- App is running at `http://localhost:3000` + This command will do 3 things: + - create Elasticsearch indexes (drop if exists) + - Initialize the database by cleaning all the records. + - Import the data to the local database and index it to ElasticSearch + +7. 🚀 Start Topcoder Challenge API + + ```bash + npm start + ``` + The Topcoder Challenge API will be served on `http://localhost:3000` ## Production deployment diff --git a/config/default.js b/config/default.js index ec1f9b86..f34e8129 100644 --- a/config/default.js +++ b/config/default.js @@ -1,7 +1,7 @@ /** * The configuration file. */ - +require('dotenv').config() module.exports = { READONLY: process.env.READONLY === 'true' || false, LOG_LEVEL: process.env.LOG_LEVEL || 'debug', diff --git a/package.json b/package.json index 174cd762..ffecccfa 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,12 @@ "test": "mocha --require test/prepare.js -t 20000 test/unit/*.test.js --exit", "e2e": "mocha --require test/prepare.js -t 20000 test/e2e/*.test.js --exit", "test:cov": "nyc --reporter=html --reporter=text npm test", - "e2e:cov": "nyc --reporter=html --reporter=text npm run e2e" + "e2e:cov": "nyc --reporter=html --reporter=text npm run e2e", + "services:up": "docker-compose -f ./local/docker-compose.yml up -d", + "services:down": "docker-compose -f ./local/docker-compose.yml down", + "services:logs": "docker-compose -f ./local/docker-compose.yml logs", + "local:init": "npm run local:reset && npm run seed-tables && npm run sync-es", + "local:reset": "npm run init-es force && npm run init-db force" }, "author": "TCSCODER", "license": "none", @@ -39,6 +44,7 @@ "body-parser": "^1.15.1", "config": "^3.0.1", "cors": "^2.7.1", + "dotenv": "^8.2.0", "dynamoose": "^1.8.0", "elasticsearch": "^16.1.1", "express": "^4.15.4", From 4fe35ce9a3811c05b23b628d00fc816eb3f3c981 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 14 Jun 2021 16:03:01 +0300 Subject: [PATCH 06/83] Support winner.type --- src/services/ChallengeService.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9df9b61c..59a9552f 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1257,7 +1257,7 @@ async function validateWinners (winners, challengeId) { } // find another placement for a member - const memberExists = _.find(diffWinners, function (w) { return w.userId === winner.userId }) + const memberExists = _.find(diffWinners, function (w) { return w.userId === winner.userId && w.type === winner.type }) if (memberExists && memberExists.placement !== winner.placement) { throw new errors.BadRequestError(`The same member ${winner.userId} cannot have multiple placements`) } @@ -1801,7 +1801,7 @@ function sanitizeChallenge (challenge) { sanitized.events = _.map(challenge.events, event => _.pick(event, ['id', 'name', 'key'])) } if (challenge.winners) { - sanitized.winners = _.map(challenge.winners, winner => _.pick(winner, ['userId', 'handle', 'placement'])) + sanitized.winners = _.map(challenge.winners, winner => _.pick(winner, ['userId', 'handle', 'placement', 'type'])) } if (challenge.discussions) { sanitized.discussions = _.map(challenge.discussions, discussion => ({ @@ -1910,7 +1910,8 @@ fullyUpdateChallenge.schema = { winners: Joi.array().items(Joi.object().keys({ userId: Joi.number().integer().positive().required(), handle: Joi.string().required(), - placement: Joi.number().integer().positive().required() + placement: Joi.number().integer().positive().required(), + type: Joi.string().valid(_.values(constants.prizeSetTypes)).default(constants.prizeSetTypes.ChallengePrizes) }).unknown(true)).min(1), terms: Joi.array().items(Joi.object().keys({ id: Joi.id(), @@ -2012,7 +2013,8 @@ partiallyUpdateChallenge.schema = { winners: Joi.array().items(Joi.object().keys({ userId: Joi.number().integer().positive().required(), handle: Joi.string().required(), - placement: Joi.number().integer().positive().required() + placement: Joi.number().integer().positive().required(), + type: Joi.string().valid(_.values(constants.prizeSetTypes)).default(constants.prizeSetTypes.ChallengePrizes) }).unknown(true)).min(1), terms: Joi.array().items(Joi.id().optional()).optional().allow([]), overview: Joi.any().forbidden() From 4e30a53d1e1a081c8fea065b3bcdfa38e1696290 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 17 Jun 2021 01:38:32 +0300 Subject: [PATCH 07/83] Fix search issue - issue #425 --- src/services/ChallengeService.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 59a9552f..dbbc5c3e 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -265,6 +265,13 @@ async function searchChallenges (currentUser, criteria) { boost: 1 } }) + boolQuery.push({ bool: { + should: [ + { wildcard: { name: `*${criteria.search}*` } }, + { wildcard: { name: `${criteria.search}*` } }, + { wildcard: { name: `*${criteria.search}` } } + ] + } }) } else { if (criteria.name) { boolQuery.push({ bool: { From e3625d46dfca08f0070db886063b42e710d7057b Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 22 Jun 2021 18:29:44 +0300 Subject: [PATCH 08/83] Do not populate actualEndDate automatically --- src/services/ChallengeService.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index dbbc5c3e..ac96f40d 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -855,7 +855,6 @@ async function populatePhases (phases, startDate, timelineTemplateId) { phase.scheduledStartDate = startDate phase.scheduledEndDate = moment(startDate).add(phase.duration || 0, 'seconds').toDate() phase.actualStartDate = phase.scheduledStartDate - phase.actualEndDate = phase.scheduledEndDate done[i] = true doing = true } else { @@ -870,7 +869,6 @@ async function populatePhases (phases, startDate, timelineTemplateId) { phase.scheduledStartDate = phases[preIndex].scheduledEndDate phase.scheduledEndDate = moment(phase.scheduledStartDate).add(phase.duration || 0, 'seconds').toDate() phase.actualStartDate = phase.scheduledStartDate - phase.actualEndDate = phase.scheduledEndDate done[i] = true doing = true } @@ -1063,7 +1061,7 @@ createChallenge.schema = { isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), - pureV5: Joi.boolean(), + pureV5: Joi.boolean() }), billing: Joi.object().keys({ billingAccountId: Joi.string(), @@ -1796,7 +1794,7 @@ function sanitizeChallenge (challenge) { sanitized.metadata = _.map(challenge.metadata, meta => _.pick(meta, ['name', 'value'])) } if (challenge.phases) { - sanitized.phases = _.map(challenge.phases, phase => _.pick(phase, ['phaseId', 'duration', 'isOpen'])) + sanitized.phases = _.map(challenge.phases, phase => _.pick(phase, ['phaseId', 'duration', 'isOpen', 'actualEndDate'])) } if (challenge.prizeSets) { sanitized.prizeSets = _.map(challenge.prizeSets, prizeSet => ({ @@ -1875,7 +1873,8 @@ fullyUpdateChallenge.schema = { phases: Joi.array().items(Joi.object().keys({ phaseId: Joi.id(), duration: Joi.number().integer().min(0), - isOpen: Joi.boolean() + isOpen: Joi.boolean(), + actualEndDate: Joi.date() }).unknown(true)), prizeSets: Joi.array().items(Joi.object().keys({ type: Joi.string().valid(_.values(constants.prizeSetTypes)).required(), @@ -1978,7 +1977,8 @@ partiallyUpdateChallenge.schema = { phases: Joi.array().items(Joi.object().keys({ phaseId: Joi.id(), duration: Joi.number().integer().min(0), - isOpen: Joi.boolean() + isOpen: Joi.boolean(), + actualEndDate: Joi.date() }).unknown(true)).min(1), events: Joi.array().items(Joi.object().keys({ id: Joi.number().required(), From 1d67c57dddbf2eca5984b20857e79e2e205bc1ee Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 24 Jun 2021 21:51:29 +0300 Subject: [PATCH 09/83] allow changing of timeline template ID on pureV5 challenges --- src/services/ChallengeService.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index ac96f40d..299f2ca3 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1410,8 +1410,10 @@ async function update (currentUser, challengeId, data, isFull) { // TODO: Fix this Tech Debt once legacy is turned off const finalStatus = data.status || challenge.status const finalTimelineTemplateId = data.timelineTemplateId || challenge.timelineTemplateId - if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) { - throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`) + if (!_.get(data, 'legacy.pureV5') && !_.get(challenge, 'legacy.pureV5')) { + if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) { + throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`) + } } if (data.prizeSets) { From 469b95fae46809520a68b923412dc2c5435a788c Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 24 Jun 2021 22:07:19 +0300 Subject: [PATCH 10/83] make sure there are no previous phases if the timeline template has changed --- src/services/ChallengeService.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 299f2ca3..7953bab1 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1414,6 +1414,9 @@ async function update (currentUser, challengeId, data, isFull) { if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) { throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`) } + } else { + // make sure there are no previous phases if the timeline template has changed + challenge.phases = [] } if (data.prizeSets) { From e9dc60b9fef70afe5e98491f9410a4d13b297725 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 24 Jun 2021 22:21:53 +0300 Subject: [PATCH 11/83] Fix phases --- src/services/ChallengeService.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 7953bab1..9b766855 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1442,6 +1442,9 @@ async function update (currentUser, challengeId, data, isFull) { _.extend(challenge.phases[i], updatedPhaseInfo) } } + if (challenge.phases.length === 0) { + challenge.phases = data.phases + } } const newPhases = _.cloneDeep(challenge.phases) || [] @@ -1452,6 +1455,7 @@ async function update (currentUser, challengeId, data, isFull) { await populatePhases(newPhases, newStartDate, data.timelineTemplateId || challenge.timelineTemplateId) data.phases = newPhases + challenge.phases = newPhases data.startDate = newStartDate data.endDate = helper.calculateChallengeEndDate(challenge, data) } From d357ee57447a0fd32847c0b5bf31c55655903bb3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 24 Jun 2021 22:36:27 +0300 Subject: [PATCH 12/83] fix phases --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9b766855..cf4a106e 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1442,7 +1442,7 @@ async function update (currentUser, challengeId, data, isFull) { _.extend(challenge.phases[i], updatedPhaseInfo) } } - if (challenge.phases.length === 0) { + if (challenge.phases.length === 0 && data.phases && data.phases.length > 0) { challenge.phases = data.phases } } From 0a2359e24f580e299b8c4f69592c99c482b5ba2b Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 25 Jun 2021 00:33:13 +0300 Subject: [PATCH 13/83] fix phases --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index cf4a106e..24d68459 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1414,7 +1414,7 @@ async function update (currentUser, challengeId, data, isFull) { if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) { throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`) } - } else { + } else if (finalTimelineTemplateId !== challenge.timelineTemplateId) { // make sure there are no previous phases if the timeline template has changed challenge.phases = [] } From a517a2bf623e70bdca6afe7453e5181ea651a187 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 9 Aug 2021 18:04:03 +0300 Subject: [PATCH 14/83] fix issue with dynamo/es sync on phases --- src/services/ChallengeService.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 24d68459..689c50a4 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1477,11 +1477,10 @@ async function update (currentUser, challengeId, data, isFull) { op = '$PUT' } } else if (key === 'phases') { - if (isDifferentPhases(challenge[key], value)) { - phasesHaveBeenModified = true - logger.info('update phases') - op = '$PUT' - } + // always consider a modification if the property exists + phasesHaveBeenModified = true + logger.info('update phases') + op = '$PUT' } else if (key === 'prizeSets') { if (isDifferentPrizeSets(challenge[key], value)) { logger.info('update prize sets') From 25a4eac57ea978f7617127f6c0e85e372454e7fd Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 2 Sep 2021 00:27:43 +0300 Subject: [PATCH 15/83] allow setting the actualEndDate to null --- src/services/ChallengeService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 689c50a4..c2bce031 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1882,7 +1882,7 @@ fullyUpdateChallenge.schema = { phaseId: Joi.id(), duration: Joi.number().integer().min(0), isOpen: Joi.boolean(), - actualEndDate: Joi.date() + actualEndDate: Joi.date().allow(null) }).unknown(true)), prizeSets: Joi.array().items(Joi.object().keys({ type: Joi.string().valid(_.values(constants.prizeSetTypes)).required(), @@ -1986,7 +1986,7 @@ partiallyUpdateChallenge.schema = { phaseId: Joi.id(), duration: Joi.number().integer().min(0), isOpen: Joi.boolean(), - actualEndDate: Joi.date() + actualEndDate: Joi.date().allow(null) }).unknown(true)).min(1), events: Joi.array().items(Joi.object().keys({ id: Joi.number().required(), From ba90b646e4c84a5e629c89ffea76b580996dab06 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 3 Sep 2021 20:51:29 +0300 Subject: [PATCH 16/83] check winners by type --- src/services/ChallengeService.js | 41 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index c2bce031..683230df 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1246,25 +1246,28 @@ function isDifferentPrizeSets (prizeSets = [], otherPrizeSets = []) { async function validateWinners (winners, challengeId) { const challengeResources = await helper.getChallengeResources(challengeId) const registrants = _.filter(challengeResources, r => r.roleId === config.SUBMITTER_ROLE_ID) - for (const winner of winners) { - if (!_.find(registrants, r => _.toString(r.memberId) === _.toString(winner.userId))) { - throw new errors.BadRequestError(`Member with userId: ${winner.userId} is not registered on the challenge`) - } - const diffWinners = _.differenceWith(winners, [winner], _.isEqual) - if (diffWinners.length + 1 !== winners.length) { - throw new errors.BadRequestError(`Duplicate member with placement: ${helper.toString(winner)}`) - } - - // find another member with the placement - const placementExists = _.find(diffWinners, function (w) { return w.placement === winner.placement }) - if (placementExists && (placementExists.userId !== winner.userId || placementExists.handle !== winner.handle)) { - throw new errors.BadRequestError(`Only one member can have a placement: ${winner.placement}`) - } - - // find another placement for a member - const memberExists = _.find(diffWinners, function (w) { return w.userId === winner.userId && w.type === winner.type }) - if (memberExists && memberExists.placement !== winner.placement) { - throw new errors.BadRequestError(`The same member ${winner.userId} cannot have multiple placements`) + for (const prizeType of constants.prizeSetTypes) { + const filteredWinners = _.filter(winners, w => w.type === prizeType) + for (const winner of filteredWinners) { + if (!_.find(registrants, r => _.toString(r.memberId) === _.toString(winner.userId))) { + throw new errors.BadRequestError(`Member with userId: ${winner.userId} is not registered on the challenge`) + } + const diffWinners = _.differenceWith(filteredWinners, [winner], _.isEqual) + if (diffWinners.length + 1 !== filteredWinners.length) { + throw new errors.BadRequestError(`Duplicate member with placement: ${helper.toString(winner)}`) + } + + // find another member with the placement + const placementExists = _.find(diffWinners, function (w) { return w.placement === winner.placement }) + if (placementExists && (placementExists.userId !== winner.userId || placementExists.handle !== winner.handle)) { + throw new errors.BadRequestError(`Only one member can have a placement: ${winner.placement}`) + } + + // find another placement for a member + const memberExists = _.find(diffWinners, function (w) { return w.userId === winner.userId && w.type === winner.type }) + if (memberExists && memberExists.placement !== winner.placement) { + throw new errors.BadRequestError(`The same member ${winner.userId} cannot have multiple placements`) + } } } } From 09c6e347b2bd51c94cd556e2b3db4b1ee48622a9 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 3 Sep 2021 21:00:17 +0300 Subject: [PATCH 17/83] minor fix --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 683230df..b6278f4c 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1246,7 +1246,7 @@ function isDifferentPrizeSets (prizeSets = [], otherPrizeSets = []) { async function validateWinners (winners, challengeId) { const challengeResources = await helper.getChallengeResources(challengeId) const registrants = _.filter(challengeResources, r => r.roleId === config.SUBMITTER_ROLE_ID) - for (const prizeType of constants.prizeSetTypes) { + for (const prizeType of _.values(constants.prizeSetTypes)) { const filteredWinners = _.filter(winners, w => w.type === prizeType) for (const winner of filteredWinners) { if (!_.find(registrants, r => _.toString(r.memberId) === _.toString(winner.userId))) { From e610527ddc018f26022e10cac6f31e7ea9a2536e Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 9 Dec 2021 18:44:46 +0200 Subject: [PATCH 18/83] add endpoint for challenge statistics --- config/default.js | 3 ++ src/common/helper.js | 48 +++++++++++++++++++++++++- src/controllers/ChallengeController.js | 13 ++++++- src/routes.js | 6 ++++ src/services/ChallengeService.js | 46 +++++++++++++++++++++++- 5 files changed, 113 insertions(+), 3 deletions(-) diff --git a/config/default.js b/config/default.js index f34e8129..1831f2af 100644 --- a/config/default.js +++ b/config/default.js @@ -48,6 +48,9 @@ module.exports = { // in bytes FILE_UPLOAD_SIZE_LIMIT: process.env.FILE_UPLOAD_SIZE_LIMIT ? Number(process.env.FILE_UPLOAD_SIZE_LIMIT) : 50 * 1024 * 1024, // 50M + // TODO: change this to localhost + SUBMISSIONS_API_URL: process.env.SUBMISSIONS_API_URL || 'https://api.topcoder-dev.com/v5/submissions', + MEMBERS_API_URL: process.env.MEMBERS_API_URL || 'https://api.topcoder-dev.com/v5/members', RESOURCES_API_URL: process.env.RESOURCES_API_URL || 'http://localhost:4000/v5/resources', // TODO: change this to localhost RESOURCE_ROLES_API_URL: process.env.RESOURCE_ROLES_API_URL || 'http://api.topcoder-dev.com/v5/resource-roles', diff --git a/src/common/helper.js b/src/common/helper.js index ee1f7507..f0cee0cc 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -959,6 +959,50 @@ async function getGroupById (groupId) { } } +/** + * Get challenge submissions + * @param {String} challengeId the challenge id + * @returns {Array} the submission + */ +async function getChallengeSubmissions (challengeId) { + const token = await getM2MToken() + let allSubmissions = [] + // get search is paginated, we need to get all pages' data + let page = 1 + while (true) { + const result = await axios.get(`${config.SUBMISSIONS_API_URL}?challengeId=${challengeId}`, { + headers: { Authorization: `Bearer ${token}` }, + params: { + page, + perPage: 100 + } + }) + const ids = result.data || [] + if (ids.length === 0) { + break + } + allSubmissions = allSubmissions.concat(ids) + page += 1 + if (result.headers['x-total-pages'] && page > Number(result.headers['x-total-pages'])) { + break + } + } + return allSubmissions +} + +/** + * Get member by ID + * @param {String} userId the user ID + * @returns {Object} + */ +async function getMemberById (userId) { + const token = await getM2MToken() + const res = await axios.get(`${config.MEMBERS_API_URL}?userId=${userId}`, { + headers: { Authorization: `Bearer ${token}` } + }) + return res.data || {} +} + module.exports = { wrapExpress, autoWrapExpress, @@ -1000,5 +1044,7 @@ module.exports = { ensureUserCanModifyChallenge, userHasFullAccess, sumOfPrizes, - getGroupById + getGroupById, + getChallengeSubmissions, + getMemberById } diff --git a/src/controllers/ChallengeController.js b/src/controllers/ChallengeController.js index 1e4cfbb5..56ef2b78 100644 --- a/src/controllers/ChallengeController.js +++ b/src/controllers/ChallengeController.js @@ -38,6 +38,16 @@ async function getChallenge (req, res) { res.send(result) } +/** + * Get challenge statistics + * @param {Object} req the request + * @param {Object} res the response + */ +async function getChallengeStatistics (req, res) { + const result = await service.getChallengeStatistics(req.authUser, req.params.challengeId) + res.send(result) +} + /** * Fully update challenge * @param {Object} req the request @@ -77,5 +87,6 @@ module.exports = { getChallenge, fullyUpdateChallenge, partiallyUpdateChallenge, - deleteChallenge + deleteChallenge, + getChallengeStatistics } diff --git a/src/routes.js b/src/routes.js index 05a54e00..7df4478e 100644 --- a/src/routes.js +++ b/src/routes.js @@ -61,6 +61,12 @@ module.exports = { scopes: [DELETE, ALL] } }, + '/challenges/:challengeId/statistics': { + get: { + controller: 'ChallengeController', + method: 'getChallengeStatistics', + } + }, '/challenge-types': { get: { controller: 'ChallengeTypeController', diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index b6278f4c..a72af8be 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1209,6 +1209,49 @@ getChallenge.schema = { id: Joi.id() } +/** + * Get challenge statistics + * @param {Object} currentUser the user who perform operation + * @param {String} id the challenge id + * @returns {Object} the challenge with given id + */ +async function getChallengeStatistics (currentUser, id) { + const challenge = await getChallenge(currentUser, id) + // for now, only Data Science challenges are supported + if (challenge.type !== 'Challenge' && challenge.track !== 'Data Science') { + throw new errors.BadRequestError(`Challenge of type ${challenge.type} and track ${challenge.track} does not support statistics`) + } + // get submissions + const submissions = await helper.getChallengeSubmissions(challenge.id) + // for each submission, load member profile + const map = {} + for (const submission of submissions) { + if (!map[submission.memberId]) { + // Load member profile and cache + const member = await helper.getMemberById(submission.memberId) + map[submission.memberId] = { + photoUrl: member.photoURL, + rating: _.get(member, 'maxRating.rating', 0), + ratingColor: _.get(member, 'maxRating.rating', '#9D9FA0'), + homeCountryCode: member.homeCountryCode, + handle: member.handle, + submissions: [] + } + } + // add submission + map[submission.memberId].submissions.push({ + created: submission.created, + score: _.get(_.find(submission.review || [], r => r.metadata), 'score', 0) + }) + } + return _.map(_.keys(map), (userId) => map[userId]) +} + +getChallengeStatistics.schema = { + currentUser: Joi.any(), + id: Joi.id() +} + /** * Check whether given two phases array are different. * @param {Array} phases the first phases array @@ -2078,7 +2121,8 @@ module.exports = { getChallenge, fullyUpdateChallenge, partiallyUpdateChallenge, - deleteChallenge + deleteChallenge, + getChallengeStatistics } logger.buildService(module.exports) From 79baf639b33a50ca0fcb9f85186f5f500fb0bf54 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 9 Dec 2021 19:00:21 +0200 Subject: [PATCH 19/83] read from array instead of object --- src/common/helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index f0cee0cc..2a70c367 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -1000,7 +1000,8 @@ async function getMemberById (userId) { const res = await axios.get(`${config.MEMBERS_API_URL}?userId=${userId}`, { headers: { Authorization: `Bearer ${token}` } }) - return res.data || {} + if (res.data.length > 0) return res.data[0] + return {} } module.exports = { From 3d90d49f727fdd7d85c1a6f11181ed092cf85032 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 10 Dec 2021 12:15:36 +0200 Subject: [PATCH 20/83] fix rating color --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index a72af8be..2af7ff0c 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1232,7 +1232,7 @@ async function getChallengeStatistics (currentUser, id) { map[submission.memberId] = { photoUrl: member.photoURL, rating: _.get(member, 'maxRating.rating', 0), - ratingColor: _.get(member, 'maxRating.rating', '#9D9FA0'), + ratingColor: _.get(member, 'maxRating.ratingColor', '#9D9FA0'), homeCountryCode: member.homeCountryCode, handle: member.handle, submissions: [] From d8dd99070642b9cefabad6457d505177c851924f Mon Sep 17 00:00:00 2001 From: Marios Kranitsas Date: Wed, 22 Dec 2021 12:14:27 +0200 Subject: [PATCH 21/83] Performance fixes on groups --- src/common/helper.js | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 2a70c367..38d03e5b 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -820,36 +820,21 @@ async function validateChallengeTerms (terms = []) { */ async function _filterChallengesByGroupsAccess (currentUser, challenges) { const res = [] - let userGroups const needToCheckForGroupAccess = !currentUser ? true : !currentUser.isMachine && !hasAdminRole(currentUser) - const subGroupsMap = {} + if(!needToCheckForGroupAccess) return challenges + + let userGroups + for (const challenge of challenges) { challenge.groups = _.filter(challenge.groups, g => !_.includes(['null', 'undefined'], _.toString(g).toLowerCase())) - let expandedGroups = [] if (!challenge.groups || _.get(challenge, 'groups.length', 0) === 0 || !needToCheckForGroupAccess) { res.push(challenge) } else if (currentUser) { - // get user groups if not yet if (_.isNil(userGroups)) { - userGroups = await getUserGroups(currentUser.userId) - } - // Expand challenge groups by subGroups - // results are being saved on a hashmap for efficiency - for (const group of challenge.groups) { - let subGroups - if (subGroupsMap[group]) { - subGroups = subGroupsMap[group] - } else { - subGroups = await expandWithSubGroups(group) - subGroupsMap[group] = subGroups - } - expandedGroups = [ - ..._.concat(expandedGroups, subGroups) - ] + userGroups = await getCompleteUserGroupTreeIds(currentUser.userId) } - // check if there is matched group - // logger.debug('Groups', challenge.groups, userGroups) - if (_.find(expandedGroups, (group) => !!_.find(userGroups, (ug) => ug.id === group))) { + // get user groups if not yet + if (_.find(challenge.groups, (group) => !!_.find(userGroups, (ug) => ug.id === group))) { res.push(challenge) } } From bf21f2c345a2882cdb3d200a0c10aa69f818d979 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 22 Dec 2021 15:59:10 +0200 Subject: [PATCH 22/83] fix groups check --- src/common/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index 38d03e5b..0c0e63ec 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -834,7 +834,7 @@ async function _filterChallengesByGroupsAccess (currentUser, challenges) { userGroups = await getCompleteUserGroupTreeIds(currentUser.userId) } // get user groups if not yet - if (_.find(challenge.groups, (group) => !!_.find(userGroups, (ug) => ug.id === group))) { + if (_.find(challenge.groups, (group) => !!_.find(userGroups, (ug) => ug === group))) { res.push(challenge) } } From 57395f31ba2683b123a7f887f5e2cf82a074c970 Mon Sep 17 00:00:00 2001 From: Marios Kranitsas Date: Thu, 6 Jan 2022 14:53:43 +0200 Subject: [PATCH 23/83] selfService flag --- config/default.js | 4 ++- docs/swagger.yaml | 15 +++++++++- src/common/helper.js | 23 +++++++++++++++- src/controllers/ChallengeController.js | 2 +- src/services/ChallengeService.js | 38 ++++++++++++++++++++++---- 5 files changed, 72 insertions(+), 10 deletions(-) diff --git a/config/default.js b/config/default.js index 1831f2af..f6ed2bd4 100644 --- a/config/default.js +++ b/config/default.js @@ -80,5 +80,7 @@ module.exports = { M2M_AUDIT_HANDLE: process.env.M2M_AUDIT_HANDLE || 'tcwebservice', - FORUM_TITLE_LENGTH_LIMIT: process.env.FORUM_TITLE_LENGTH_LIMIT || 90 + FORUM_TITLE_LENGTH_LIMIT: process.env.FORUM_TITLE_LENGTH_LIMIT || 90, + + NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'website' } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2c95a65a..18855134 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -65,7 +65,12 @@ paths: description: Filter by id, exact match required: false type: string - format: UUID + format: UUI + - name: selfService + in: query + description: Filter by selfService flag + required: false + type: boolean - name: confidentialityType in: query description: Filter by confidentialityType @@ -2352,6 +2357,8 @@ definitions: type: boolean pureV5Task: type: boolean + selfService: + type: boolean billing: type: object properties: @@ -2577,6 +2584,8 @@ definitions: type: boolean pureV5Task: type: boolean + selfService: + type: boolean billing: type: object properties: @@ -2716,6 +2725,8 @@ definitions: type: boolean pureV5Task: type: boolean + selfService: + type: boolean billing: type: object properties: @@ -2894,6 +2905,8 @@ definitions: type: boolean pureV5Task: type: boolean + selfService: + type: boolean billing: type: object properties: diff --git a/src/common/helper.js b/src/common/helper.js index 0c0e63ec..7ff52f6b 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -440,6 +440,26 @@ async function createResource (challengeId, memberHandle, roleId) { return res || false } +/** + * Create Project + * @param {String} name The name + * @param {String} description The description + * @param {String} type The type + * @param {String} token The token + * @returns + */ +async function prepareSelfServiceProject (name, description, type, token) { + + const projectObj = { + name, + description, + type + } + const url = `${config.PROJECTS_API_URL}` + const res = await axios.post(url, projectObj, {headers: {Authorization: `Bearer ${token}`}}) + return res.data.id +} + /** * Get resource roles * @returns {Promise} the challenge resources @@ -1032,5 +1052,6 @@ module.exports = { sumOfPrizes, getGroupById, getChallengeSubmissions, - getMemberById + getMemberById, + prepareSelfServiceProject } diff --git a/src/controllers/ChallengeController.js b/src/controllers/ChallengeController.js index 56ef2b78..cefd16db 100644 --- a/src/controllers/ChallengeController.js +++ b/src/controllers/ChallengeController.js @@ -24,7 +24,7 @@ async function searchChallenges (req, res) { */ async function createChallenge (req, res) { logger.debug(`createChallenge User: ${JSON.stringify(req.authUser)} - Body: ${JSON.stringify(req.body)}`) - const result = await service.createChallenge(req.authUser, req.body) + const result = await service.createChallenge(req.authUser, req.body, req.userToken) res.status(HttpStatus.CREATED).send(result) } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 2af7ff0c..ab7b45ef 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -323,6 +323,9 @@ async function searchChallenges (currentUser, criteria) { if (criteria.useSchedulingAPI) { boolQuery.push({ match_phrase: { 'legacy.useSchedulingAPI': criteria.useSchedulingAPI } }) } + if (criteria.selfService) { + boolQuery.push({ match_phrase: { 'legacy.selfservice': criteria.selfService}}) + } if (criteria.forumId) { boolQuery.push({ match_phrase: { 'legacy.forumId': criteria.forumId } }) } @@ -692,6 +695,7 @@ searchChallenges.schema = { page: Joi.page(), perPage: Joi.perPage(), id: Joi.optionalId(), + selfService: Joi.boolean(), confidentialityType: Joi.string(), directProjectId: Joi.number(), typeIds: Joi.array().items(Joi.optionalId()), @@ -889,9 +893,23 @@ async function populatePhases (phases, startDate, timelineTemplateId) { * Create challenge. * @param {Object} currentUser the user who perform operation * @param {Object} challenge the challenge to created + * @param {String} userToken the user token * @returns {Object} the created challenge */ -async function createChallenge (currentUser, challenge) { +async function createChallenge (currentUser, challenge, userToken) { + try { + if(challenge.legacy.selfService) { + if(!challenge.projectId) { + const selfServiceProjectName = `Self service - ${currentUser.userId} - ${challenge.name}` + challenge.projectId = await helper.prepareSelfServiceProject(selfServiceProjectName, selfServiceProjectName, config.NEW_SELF_SERVICE_PROJECT_TYPE, userToken) + } + } else if (!challenge.projectId) { + throw new errors.BadRequestError('The projectId is required') + } + } catch (e) { + throw new errors.ServiceUnavailableError('Fail to create the project') + } + if (!_.isUndefined(_.get(challenge, 'legacy.reviewType'))) { _.set(challenge, 'legacy.reviewType', _.toUpper(_.get(challenge, 'legacy.reviewType'))) } @@ -1061,7 +1079,8 @@ createChallenge.schema = { isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), - pureV5: Joi.boolean() + pureV5: Joi.boolean(), + selfService: Joi.boolean() }), billing: Joi.object().keys({ billingAccountId: Joi.string(), @@ -1118,7 +1137,8 @@ createChallenge.schema = { id: Joi.id(), roleId: Joi.id() })) - }).required() + }).required(), + userToken: Joi.string().required() } /** @@ -1378,6 +1398,9 @@ async function update (currentUser, challengeId, data, isFull) { if (_.get(challenge, 'legacy.pureV5') && _.get(data, 'legacy.pureV5') && _.get(challenge, 'legacy.pureV5') !== _.get(data, 'legacy.pureV5')) { throw new errors.ForbiddenError('Cannot change legacy.pureV5') } + if (_.get(challenge, 'legacy.selfService') && _.get(data, 'legacy.selfService') && _.get(challenge, 'legacy.selfService') !== _.get(data, 'legacy.selfService')) { + throw new errors.ForbiddenError('Cannot change legacy.selfService') + } if (!_.isUndefined(challenge.legacy) && !_.isUndefined(data.legacy)) { _.extend(challenge.legacy, data.legacy) @@ -1835,7 +1858,8 @@ function sanitizeChallenge (challenge) { 'isTask', 'useSchedulingAPI', 'pureV5Task', - 'pureV5' + 'pureV5', + 'selfService' ]) } if (challenge.billing) { @@ -1902,7 +1926,8 @@ fullyUpdateChallenge.schema = { isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), - pureV5: Joi.boolean() + pureV5: Joi.boolean(), + selfService: Joi.boolean() }).unknown(true), billing: Joi.object().keys({ billingAccountId: Joi.string(), @@ -2006,7 +2031,8 @@ partiallyUpdateChallenge.schema = { isTask: Joi.boolean(), useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), - pureV5: Joi.boolean() + pureV5: Joi.boolean(), + selfService: Joi.boolean() }).unknown(true), task: Joi.object().keys({ isTask: Joi.boolean().default(false), From eb6f827712304f3b8d208b92352ba32eff5355eb Mon Sep 17 00:00:00 2001 From: Marios Kranitsas Date: Thu, 6 Jan 2022 20:19:35 +0200 Subject: [PATCH 24/83] handle project changes for selfService --- docs/swagger.yaml | 4 ++++ src/common/helper.js | 29 ++++++++++++++++++++++++++++- src/services/ChallengeService.js | 15 +++++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 18855134..27a4522e 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -2727,6 +2727,8 @@ definitions: type: boolean selfService: type: boolean + cancelReason: + type: string billing: type: object properties: @@ -2907,6 +2909,8 @@ definitions: type: boolean selfService: type: boolean + cancelReason: + type: string billing: type: object properties: diff --git a/src/common/helper.js b/src/common/helper.js index 7ff52f6b..5be76779 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -110,6 +110,31 @@ function setResHeaders (req, res, result) { } } +/** + * Activate project + * @param {String} projectId The project id + */ +function activateProject (projectId) { + // TODO: Get financial information + // TODO charge credit card + const token = await getM2MToken() + const url = `${config.PROJECTS_API_URL}/${projectId}` + await axios.patch(url, { status: 'Active'}, { headers: { Authorization: `Bearer ${token}` } }) +} + +/** + * Cancel project + * @param {String} projectId The project id + * @param {String} cancelReason The cancel reasonn + */ + function canceledProject (projectId, cancelReason) { + // TODO: Get financial information + // TODO release hold + const token = await getM2MToken() + const url = `${config.PROJECTS_API_URL}/${projectId}` + await axios.patch(url, { cancelReason, status: 'Canceled'}, { headers: { Authorization: `Bearer ${token}` } }) +} + /** * Check if the user has admin role * @param {Object} authUser the user @@ -1053,5 +1078,7 @@ module.exports = { getGroupById, getChallengeSubmissions, getMemberById, - prepareSelfServiceProject + prepareSelfServiceProject, + activateProject, + canceledProject } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index ab7b45ef..4087806a 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1344,6 +1344,8 @@ async function validateWinners (winners, challengeId) { * @returns {Object} the updated challenge */ async function update (currentUser, challengeId, data, isFull) { + const cancelReason = data.cancelReason + delete data.cancelReason if (!_.isUndefined(_.get(data, 'legacy.reviewType'))) { _.set(data, 'legacy.reviewType', _.toUpper(_.get(data, 'legacy.reviewType'))) } @@ -1363,6 +1365,9 @@ async function update (currentUser, challengeId, data, isFull) { } if (data.status) { if (data.status === constants.challengeStatuses.Active) { + if (challenge.legacy.selfService && challenge.status !== constants.challengeStatuses.Active) { + await helper.activateProject(challenge.projectId) + } if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && _.isUndefined(_.get(challenge, 'legacyId'))) { throw new errors.BadRequestError('You cannot activate the challenge as it has not been created on legacy yet. Please try again later or contact support.') } @@ -1372,6 +1377,9 @@ async function update (currentUser, challengeId, data, isFull) { throw new errors.BadRequestError('Cannot Activate this project, it has no active billing account.') } } + if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible) { + await helper.canceledProject(challenge.projectId, cancelReason) + } if (data.status === constants.challengeStatuses.Completed) { if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { throw new errors.BadRequestError('You cannot mark a Draft challenge as Completed') @@ -1837,7 +1845,8 @@ function sanitizeChallenge (challenge) { 'startDate', 'status', 'task', - 'groups' + 'groups', + 'cancelReason' ]) if (!_.isUndefined(sanitized.name)) { sanitized.name = xss(sanitized.name) @@ -1927,8 +1936,9 @@ fullyUpdateChallenge.schema = { useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), pureV5: Joi.boolean(), - selfService: Joi.boolean() + selfService: Joi.boolean(), }).unknown(true), + cancelReason: Joi.string(), billing: Joi.object().keys({ billingAccountId: Joi.string(), markup: Joi.number().min(0).max(100) @@ -2034,6 +2044,7 @@ partiallyUpdateChallenge.schema = { pureV5: Joi.boolean(), selfService: Joi.boolean() }).unknown(true), + cancelReason: Joi.string(), task: Joi.object().keys({ isTask: Joi.boolean().default(false), isAssigned: Joi.boolean().default(false), From 52361793d7b8d05ed912abe090cb7366229e17b1 Mon Sep 17 00:00:00 2001 From: Marios Kranitsas Date: Thu, 6 Jan 2022 21:30:27 +0200 Subject: [PATCH 25/83] manage payments for selfService --- config/default.js | 1 + src/common/helper.js | 78 ++++++++++++++++++++++++++------ src/services/ChallengeService.js | 2 +- 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/config/default.js b/config/default.js index f6ed2bd4..fa970993 100644 --- a/config/default.js +++ b/config/default.js @@ -57,6 +57,7 @@ module.exports = { GROUPS_API_URL: process.env.GROUPS_API_URL || 'http://localhost:4000/v5/groups', PROJECTS_API_URL: process.env.PROJECTS_API_URL || 'http://localhost:4000/v5/projects', TERMS_API_URL: process.env.TERMS_API_URL || 'http://localhost:4000/v5/terms', + CUSTOMER_PAYMENTS_URL: process.env.CUSTOMER_PAYMENTS_URL || 'http://localhost:4000/v5/customer-payments', // copilot resource role ids allowed to upload attachment COPILOT_RESOURCE_ROLE_IDS: process.env.COPILOT_RESOURCE_ROLE_IDS ? process.env.COPILOT_RESOURCE_ROLE_IDS.split(',') : ['10ba038e-48da-487b-96e8-8d3b99b6d18b'], diff --git a/src/common/helper.js b/src/common/helper.js index 5be76779..d002ed89 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -111,28 +111,74 @@ function setResHeaders (req, res, result) { } /** - * Activate project - * @param {String} projectId The project id + * Get project payment + * @param {String} projectId the project id */ -function activateProject (projectId) { - // TODO: Get financial information - // TODO charge credit card + async function getProjectPayment (projectId) { const token = await getM2MToken() - const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { status: 'Active'}, { headers: { Authorization: `Bearer ${token}` } }) + const url = `${config.CUSTOMER_PAYMENTS_URL}` + const res = axios.get(url, { + headers: { Authorization: `Bearer ${token}` }, + params: { + referenceId: projectId + } + }) + const [payment] = res.data + return payment +} + +/** + * Charge payment + * @param {String} paymentId the payment ID + */ +async function capturePayment (paymentId) { + const token = await getM2MToken() + const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` + await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) +} + +/** + * Cancel payment + * @param {String} paymentId the payment ID + */ +async function cancelPayment (paymentId) { + const token = await getM2MToken() + const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/cancel` + await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) } /** * Cancel project - * @param {String} projectId The project id - * @param {String} cancelReason The cancel reasonn + * @param {String} projectId the project id + * @param {String} cancelReason the cancel reasonn */ - function canceledProject (projectId, cancelReason) { - // TODO: Get financial information - // TODO release hold + async function cancelProject (projectId, cancelReason) { + const payment = await getProjectPayment() + try { + await cancelPayment(payment.id) + } catch (e) { + throw e + } const token = await getM2MToken() const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { cancelReason, status: 'Canceled'}, { headers: { Authorization: `Bearer ${token}` } }) + await axios.patch(url, { cancelReason, status: 'Cancelled'}, { headers: { Authorization: `Bearer ${token}` } }) +} + +/** + * Activate project + * @param {String} projectId the project id + */ +async function activateProject (projectId) { + const payment = await getProjectPayment(projectId) + try { + await capturePayment(payment.id) + } catch (e) { + await cancelProject(projectId, cancelReason) + throw e + } + const token = await getM2MToken() + const url = `${config.PROJECTS_API_URL}/${projectId}` + await axios.patch(url, { status: 'Active'}, { headers: { Authorization: `Bearer ${token}` } }) } /** @@ -474,7 +520,6 @@ async function createResource (challengeId, memberHandle, roleId) { * @returns */ async function prepareSelfServiceProject (name, description, type, token) { - const projectObj = { name, description, @@ -1080,5 +1125,8 @@ module.exports = { getMemberById, prepareSelfServiceProject, activateProject, - canceledProject + cancelProject, + getProjectPayment, + capturePayment, + cancelPayment } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 4087806a..f1063ebd 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1378,7 +1378,7 @@ async function update (currentUser, challengeId, data, isFull) { } } if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible) { - await helper.canceledProject(challenge.projectId, cancelReason) + await helper.cancelProject(challenge.projectId, cancelReason) } if (data.status === constants.challengeStatuses.Completed) { if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { From 7a8a036a870097c3b9fd23af439082e052474c5b Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 6 Jan 2022 22:04:21 +0200 Subject: [PATCH 26/83] Clean up and final touches on self-service challenges --- app-constants.js | 3 +- config/default.js | 2 +- src/common/helper.js | 150 ++++++++++++++++--------------- src/services/ChallengeService.js | 29 ++++-- 4 files changed, 101 insertions(+), 83 deletions(-) diff --git a/app-constants.js b/app-constants.js index 72ddaa49..952f6c87 100644 --- a/app-constants.js +++ b/app-constants.js @@ -28,7 +28,8 @@ const challengeStatuses = { CancelledWinnerUnresponsive: 'Cancelled - Winner Unresponsive', CancelledClientRequest: 'Cancelled - Client Request', CancelledRequirementsInfeasible: 'Cancelled - Requirements Infeasible', - CancelledZeroRegistrations: 'Cancelled - Zero Registrations' + CancelledZeroRegistrations: 'Cancelled - Zero Registrations', + CancelledPaymentFailed: 'Cancelled - Payment Failed' } const validChallengeParams = { diff --git a/config/default.js b/config/default.js index fa970993..7c45713c 100644 --- a/config/default.js +++ b/config/default.js @@ -83,5 +83,5 @@ module.exports = { FORUM_TITLE_LENGTH_LIMIT: process.env.FORUM_TITLE_LENGTH_LIMIT || 90, - NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'website' + NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'self-service' } diff --git a/src/common/helper.js b/src/common/helper.js index d002ed89..8af02378 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -18,6 +18,7 @@ const elasticsearch = require('elasticsearch') const moment = require('moment') const HttpStatus = require('http-status-codes') const xss = require('xss') +const logger = require('./logger') // Bus API Client let busApiClient @@ -110,77 +111,6 @@ function setResHeaders (req, res, result) { } } -/** - * Get project payment - * @param {String} projectId the project id - */ - async function getProjectPayment (projectId) { - const token = await getM2MToken() - const url = `${config.CUSTOMER_PAYMENTS_URL}` - const res = axios.get(url, { - headers: { Authorization: `Bearer ${token}` }, - params: { - referenceId: projectId - } - }) - const [payment] = res.data - return payment -} - -/** - * Charge payment - * @param {String} paymentId the payment ID - */ -async function capturePayment (paymentId) { - const token = await getM2MToken() - const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` - await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) -} - -/** - * Cancel payment - * @param {String} paymentId the payment ID - */ -async function cancelPayment (paymentId) { - const token = await getM2MToken() - const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/cancel` - await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) -} - -/** - * Cancel project - * @param {String} projectId the project id - * @param {String} cancelReason the cancel reasonn - */ - async function cancelProject (projectId, cancelReason) { - const payment = await getProjectPayment() - try { - await cancelPayment(payment.id) - } catch (e) { - throw e - } - const token = await getM2MToken() - const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { cancelReason, status: 'Cancelled'}, { headers: { Authorization: `Bearer ${token}` } }) -} - -/** - * Activate project - * @param {String} projectId the project id - */ -async function activateProject (projectId) { - const payment = await getProjectPayment(projectId) - try { - await capturePayment(payment.id) - } catch (e) { - await cancelProject(projectId, cancelReason) - throw e - } - const token = await getM2MToken() - const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { status: 'Active'}, { headers: { Authorization: `Bearer ${token}` } }) -} - /** * Check if the user has admin role * @param {Object} authUser the user @@ -519,7 +449,7 @@ async function createResource (challengeId, memberHandle, roleId) { * @param {String} token The token * @returns */ -async function prepareSelfServiceProject (name, description, type, token) { +async function createSelfServiceProject (name, description, type, token) { const projectObj = { name, description, @@ -527,7 +457,79 @@ async function prepareSelfServiceProject (name, description, type, token) { } const url = `${config.PROJECTS_API_URL}` const res = await axios.post(url, projectObj, {headers: {Authorization: `Bearer ${token}`}}) - return res.data.id + return _.get(res, 'data.id') +} + +/** + * Get project payment + * @param {String} projectId the project id + */ + async function getProjectPayment (projectId) { + const token = await getM2MToken() + const url = `${config.CUSTOMER_PAYMENTS_URL}` + const res = axios.get(url, { + headers: { Authorization: `Bearer ${token}` }, + params: { + referenceId: projectId + } + }) + const [payment] = res.data + return payment +} + +/** + * Charge payment + * @param {String} paymentId the payment ID + */ +async function capturePayment (paymentId) { + const token = await getM2MToken() + const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` + await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) +} + +/** + * Cancel payment + * @param {String} paymentId the payment ID + */ +async function cancelPayment (paymentId) { + const token = await getM2MToken() + const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/cancel` + await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) +} + +/** + * Cancel project + * @param {String} projectId the project id + * @param {String} cancelReason the cancel reasonn + */ + async function cancelProject (projectId, cancelReason) { + const payment = await getProjectPayment(projectId) + try { + await cancelPayment(payment.id) + } catch (e) { + logger.debug(`Failed to cancel payment with error: ${e.message}`) + } + const token = await getM2MToken() + const url = `${config.PROJECTS_API_URL}/${projectId}` + await axios.patch(url, { cancelReason, status: 'cancelled'}, { headers: { Authorization: `Bearer ${token}` } }) +} + +/** + * Activate project + * @param {String} projectId the project id + */ +async function activateProject (projectId) { + const payment = await getProjectPayment(projectId) + try { + await capturePayment(payment.id) + } catch (e) { + logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) + await cancelProject(projectId, cancelReason) + throw new Error(`Failed to charge payment ${payment.id} with error: ${e.message}`) + } + const token = await getM2MToken() + const url = `${config.PROJECTS_API_URL}/${projectId}` + await axios.patch(url, { status: 'active'}, { headers: { Authorization: `Bearer ${token}` } }) } /** @@ -1123,7 +1125,7 @@ module.exports = { getGroupById, getChallengeSubmissions, getMemberById, - prepareSelfServiceProject, + createSelfServiceProject, activateProject, cancelProject, getProjectPayment, diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f1063ebd..21ec68e8 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -324,7 +324,7 @@ async function searchChallenges (currentUser, criteria) { boolQuery.push({ match_phrase: { 'legacy.useSchedulingAPI': criteria.useSchedulingAPI } }) } if (criteria.selfService) { - boolQuery.push({ match_phrase: { 'legacy.selfservice': criteria.selfService}}) + boolQuery.push({ match_phrase: { 'legacy.selfService': criteria.selfService}}) } if (criteria.forumId) { boolQuery.push({ match_phrase: { 'legacy.forumId': criteria.forumId } }) @@ -901,13 +901,13 @@ async function createChallenge (currentUser, challenge, userToken) { if(challenge.legacy.selfService) { if(!challenge.projectId) { const selfServiceProjectName = `Self service - ${currentUser.userId} - ${challenge.name}` - challenge.projectId = await helper.prepareSelfServiceProject(selfServiceProjectName, selfServiceProjectName, config.NEW_SELF_SERVICE_PROJECT_TYPE, userToken) + challenge.projectId = await helper.createSelfServiceProject(selfServiceProjectName, challenge.description, config.NEW_SELF_SERVICE_PROJECT_TYPE, userToken) } } else if (!challenge.projectId) { throw new errors.BadRequestError('The projectId is required') } } catch (e) { - throw new errors.ServiceUnavailableError('Fail to create the project') + throw new errors.ServiceUnavailableError('Fail to create a self-service project') } if (!_.isUndefined(_.get(challenge, 'legacy.reviewType'))) { @@ -1344,7 +1344,7 @@ async function validateWinners (winners, challengeId) { * @returns {Object} the updated challenge */ async function update (currentUser, challengeId, data, isFull) { - const cancelReason = data.cancelReason + const cancelReason = _.cloneDeep(data.cancelReason) delete data.cancelReason if (!_.isUndefined(_.get(data, 'legacy.reviewType'))) { _.set(data, 'legacy.reviewType', _.toUpper(_.get(data, 'legacy.reviewType'))) @@ -1358,6 +1358,24 @@ async function update (currentUser, challengeId, data, isFull) { // helper.ensureNoDuplicateOrNullElements(data.gitRepoURLs, 'gitRepoURLs') const challenge = await helper.getById('Challenge', challengeId) + // check if it's a self service challenge and project needs to be activated first + if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { + try { + await helper.activateProject(challenge.projectId) + } catch (e) { + await update( + currentUser, + challengeId, + { + ...data, + status: constants.challengeStatuses.CancelledPaymentFailed, + cancelReason: e.message + }, + false + ) + throw new errors.BadRequestError('Failed to activate the challenge! The challenge has been canceled!') + } + } const { billingAccountId, markup } = await helper.getProjectBillingInformation(_.get(challenge, 'projectId')) if (billingAccountId && _.isUndefined(_.get(challenge, 'billing.billingAccountId'))) { _.set(data, 'billing.billingAccountId', billingAccountId) @@ -1365,9 +1383,6 @@ async function update (currentUser, challengeId, data, isFull) { } if (data.status) { if (data.status === constants.challengeStatuses.Active) { - if (challenge.legacy.selfService && challenge.status !== constants.challengeStatuses.Active) { - await helper.activateProject(challenge.projectId) - } if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && _.isUndefined(_.get(challenge, 'legacyId'))) { throw new errors.BadRequestError('You cannot activate the challenge as it has not been created on legacy yet. Please try again later or contact support.') } From dfee724469e8b27fccfca5bbf2c89864649fcbca Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 6 Jan 2022 22:19:27 +0200 Subject: [PATCH 27/83] add financial info to the project --- src/common/helper.js | 35 ++++++++++++++++++++++++++++---- src/services/ChallengeService.js | 4 ++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 8af02378..67c06a37 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -501,9 +501,11 @@ async function cancelPayment (paymentId) { * Cancel project * @param {String} projectId the project id * @param {String} cancelReason the cancel reasonn + * @param {Object} currentUser the current user */ - async function cancelProject (projectId, cancelReason) { + async function cancelProject (projectId, cancelReason, currentUser) { const payment = await getProjectPayment(projectId) + const project = await ensureProjectExist(projectId, currentUser) try { await cancelPayment(payment.id) } catch (e) { @@ -511,15 +513,29 @@ async function cancelPayment (paymentId) { } const token = await getM2MToken() const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { cancelReason, status: 'cancelled'}, { headers: { Authorization: `Bearer ${token}` } }) + await axios.patch(url, { + cancelReason, + status: 'cancelled', + details: { + ...project.details, + paymentProvider: config.DEFAULT_PAYMENT_PROVIDER, + paymentId: payment.id, + paymentIntentId: payment.paymentIntentId, + paymentAmount: payment.amount, + paymentCurrency: payment.currency, + paymentStatus: payment.status + } + }, { headers: { Authorization: `Bearer ${token}` } }) } /** * Activate project * @param {String} projectId the project id + * @param {Object} currentUser the current user */ -async function activateProject (projectId) { +async function activateProject (projectId, currentUser) { const payment = await getProjectPayment(projectId) + const project = await ensureProjectExist(projectId, currentUser) try { await capturePayment(payment.id) } catch (e) { @@ -529,7 +545,18 @@ async function activateProject (projectId) { } const token = await getM2MToken() const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { status: 'active'}, { headers: { Authorization: `Bearer ${token}` } }) + await axios.patch(url, { + status: 'active', + details: { + ...project.details, + paymentProvider: config.DEFAULT_PAYMENT_PROVIDER, + paymentId: payment.id, + paymentIntentId: payment.paymentIntentId, + paymentAmount: payment.amount, + paymentCurrency: payment.currency, + paymentStatus: payment.status + } + }, { headers: { Authorization: `Bearer ${token}` } }) } /** diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 21ec68e8..995eb477 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1361,7 +1361,7 @@ async function update (currentUser, challengeId, data, isFull) { // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { try { - await helper.activateProject(challenge.projectId) + await helper.activateProject(challenge.projectId, currentUser) } catch (e) { await update( currentUser, @@ -1393,7 +1393,7 @@ async function update (currentUser, challengeId, data, isFull) { } } if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible) { - await helper.cancelProject(challenge.projectId, cancelReason) + await helper.cancelProject(challenge.projectId, cancelReason, currentUser) } if (data.status === constants.challengeStatuses.Completed) { if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { From 337aa1ab3d48f4a5833ce52d44dfd18cf9aff1c6 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 6 Jan 2022 22:21:51 +0200 Subject: [PATCH 28/83] verify status of changed payments --- src/common/helper.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 67c06a37..957f6c59 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -484,7 +484,10 @@ async function createSelfServiceProject (name, description, type, token) { async function capturePayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` - await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + if (res.data.status !== 'succeeded') { + throw new Error(`Failed to charge payment. Current status: ${res.data.status}`) + } } /** @@ -494,7 +497,10 @@ async function capturePayment (paymentId) { async function cancelPayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/cancel` - await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + if (res.data.status !== 'canceled') { + throw new Error(`Failed to cancel payment. Current status: ${res.data.status}`) + } } /** From b98d12f72f439698de0053846e2b2356531bf6f2 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 7 Jan 2022 16:18:23 +0200 Subject: [PATCH 29/83] Get payments for reference: project --- src/common/helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index 957f6c59..819781d2 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -470,7 +470,8 @@ async function createSelfServiceProject (name, description, type, token) { const res = axios.get(url, { headers: { Authorization: `Bearer ${token}` }, params: { - referenceId: projectId + referenceId: projectId, + reference: 'project' } }) const [payment] = res.data From a92ab3a5f965e268b6c62d3c0e2d72594703ecc8 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 10 Jan 2022 16:44:44 +0200 Subject: [PATCH 30/83] make projectId optional --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 995eb477..044602a2 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1127,7 +1127,7 @@ createChallenge.schema = { })).min(1).required() })), tags: Joi.array().items(Joi.string()), // tag names - projectId: Joi.number().integer().positive().required(), + projectId: Joi.number().integer().positive(), legacyId: Joi.number().integer().positive(), startDate: Joi.date(), status: Joi.string().valid(_.values(constants.challengeStatuses)), From 0a022ef2c3da075d777f8c7d185971da17735685 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 10 Jan 2022 17:20:05 +0200 Subject: [PATCH 31/83] pass m2m token if it's machine --- app-routes.js | 1 + src/services/ChallengeService.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app-routes.js b/app-routes.js index 96fe531f..a77b491d 100644 --- a/app-routes.js +++ b/app-routes.js @@ -50,6 +50,7 @@ module.exports = (app) => { next(new errors.ForbiddenError('You are not allowed to perform this action!')) } else { req.authUser.handle = config.M2M_AUDIT_HANDLE + req.userToken = req.headers.authorization.split(' ')[1] next() } } else { diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 044602a2..f09113c4 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1138,7 +1138,7 @@ createChallenge.schema = { roleId: Joi.id() })) }).required(), - userToken: Joi.string().required() + userToken: Joi.string().required() } /** From a35a18801194e37e416f86156fb63de193267398 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 10 Jan 2022 17:28:23 +0200 Subject: [PATCH 32/83] read default timeline template with pagination --- src/services/ChallengeService.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f09113c4..967819b2 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -965,11 +965,12 @@ async function createChallenge (currentUser, challenge, userToken) { // populate phases if (!challenge.timelineTemplateId) { if (challenge.typeId && challenge.trackId) { - const [challengeTimelineTemplate] = await ChallengeTimelineTemplateService.searchChallengeTimelineTemplates({ + const supportedTemplates = await ChallengeTimelineTemplateService.searchChallengeTimelineTemplates({ typeId: challenge.typeId, trackId: challenge.trackId, isDefault: true }) + const challengeTimelineTemplate = supportedTemplates.result[0] if (!challengeTimelineTemplate) { throw new errors.BadRequestError(`The selected trackId ${challenge.trackId} and typeId: ${challenge.typeId} does not have a default timeline template. Please provide a timelineTemplateId`) } From fb0dec25d77bbedd6832a33914fbae4fce797075 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 10 Jan 2022 17:42:51 +0200 Subject: [PATCH 33/83] add logging --- src/services/ChallengeService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 967819b2..a2e7ac5a 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -970,6 +970,7 @@ async function createChallenge (currentUser, challenge, userToken) { trackId: challenge.trackId, isDefault: true }) + console.log(JSON.stringify(supportedTemplates, null, 2)) const challengeTimelineTemplate = supportedTemplates.result[0] if (!challengeTimelineTemplate) { throw new errors.BadRequestError(`The selected trackId ${challenge.trackId} and typeId: ${challenge.typeId} does not have a default timeline template. Please provide a timelineTemplateId`) From 543cc8785a2aaca22fa6f399de37f35f12c94f71 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 10 Jan 2022 17:53:15 +0200 Subject: [PATCH 34/83] fix boolean with string comparison in challenge timelines --- src/services/ChallengeService.js | 1 - src/services/ChallengeTimelineTemplateService.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index a2e7ac5a..967819b2 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -970,7 +970,6 @@ async function createChallenge (currentUser, challenge, userToken) { trackId: challenge.trackId, isDefault: true }) - console.log(JSON.stringify(supportedTemplates, null, 2)) const challengeTimelineTemplate = supportedTemplates.result[0] if (!challengeTimelineTemplate) { throw new errors.BadRequestError(`The selected trackId ${challenge.trackId} and typeId: ${challenge.typeId} does not have a default timeline template. Please provide a timelineTemplateId`) diff --git a/src/services/ChallengeTimelineTemplateService.js b/src/services/ChallengeTimelineTemplateService.js index 73e004fc..9390d139 100644 --- a/src/services/ChallengeTimelineTemplateService.js +++ b/src/services/ChallengeTimelineTemplateService.js @@ -20,7 +20,7 @@ async function searchChallengeTimelineTemplates (criteria) { if (criteria.typeId) records = _.filter(records, e => (criteria.typeId === e.typeId)) if (criteria.trackId) records = _.filter(records, e => (criteria.trackId === e.trackId)) if (criteria.timelineTemplateId) records = _.filter(records, e => (criteria.timelineTemplateId === e.timelineTemplateId)) - if (!_.isUndefined(criteria.isDefault)) records = _.filter(records, e => (e.isDefault === (criteria.isDefault === 'true'))) + if (!_.isUndefined(criteria.isDefault)) records = _.filter(records, e => (e.isDefault === (_.toLower(_.toString(criteria.isDefault)) === 'true'))) return { total: records.length, page: 1, From 1f0f46883ca4852d8826c022d37ae0f210d24c41 Mon Sep 17 00:00:00 2001 From: Marios Kranitsas Date: Tue, 18 Jan 2022 18:38:01 +0200 Subject: [PATCH 35/83] Replace all description --- src/services/ChallengeService.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 967819b2..759dade6 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -909,7 +909,11 @@ async function createChallenge (currentUser, challenge, userToken) { } catch (e) { throw new errors.ServiceUnavailableError('Fail to create a self-service project') } - + if(challenge.legacy.selfService && challenge.metadata && challenge.metadata.length > 0) { + for(const entry of challenge.metadata) { + challenge.description = challenge.description.replaceAll(`{{${entry.name}}}`, entry.value ) + } + } if (!_.isUndefined(_.get(challenge, 'legacy.reviewType'))) { _.set(challenge, 'legacy.reviewType', _.toUpper(_.get(challenge, 'legacy.reviewType'))) } From 8e737e8162d5d70032276bf5d81dbf6ee35faa82 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 19 Jan 2022 16:56:36 +0200 Subject: [PATCH 36/83] add logging' --- src/common/helper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/helper.js b/src/common/helper.js index 819781d2..62f53432 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -486,6 +486,7 @@ async function capturePayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + logger.debug(`Payment API Response: ${JSON.stringify(res.data, null, 2)}`) if (res.data.status !== 'succeeded') { throw new Error(`Failed to charge payment. Current status: ${res.data.status}`) } From a697482d95c9a11efe3d62c19ba5375b244d3e51 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 19 Jan 2022 17:04:23 +0200 Subject: [PATCH 37/83] add missing await --- src/common/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index 62f53432..fac41573 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -467,7 +467,7 @@ async function createSelfServiceProject (name, description, type, token) { async function getProjectPayment (projectId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}` - const res = axios.get(url, { + const res = await axios.get(url, { headers: { Authorization: `Bearer ${token}` }, params: { referenceId: projectId, From 95b847f7227bd911c286d4cff4dea7bd96c9347c Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 19 Jan 2022 17:20:13 +0200 Subject: [PATCH 38/83] temp fix on getting payment info --- src/common/helper.js | 10 +++++----- src/services/ChallengeService.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index fac41573..0ed35486 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -511,8 +511,8 @@ async function cancelPayment (paymentId) { * @param {String} cancelReason the cancel reasonn * @param {Object} currentUser the current user */ - async function cancelProject (projectId, cancelReason, currentUser) { - const payment = await getProjectPayment(projectId) + async function cancelProject (projectId, cancelReason, currentUser, challengeId) { + const payment = await getProjectPayment(challengeId) const project = await ensureProjectExist(projectId, currentUser) try { await cancelPayment(payment.id) @@ -541,14 +541,14 @@ async function cancelPayment (paymentId) { * @param {String} projectId the project id * @param {Object} currentUser the current user */ -async function activateProject (projectId, currentUser) { - const payment = await getProjectPayment(projectId) +async function activateProject (projectId, currentUser, challengeId) { + const payment = await getProjectPayment(challengeId) const project = await ensureProjectExist(projectId, currentUser) try { await capturePayment(payment.id) } catch (e) { logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) - await cancelProject(projectId, cancelReason) + await cancelProject(projectId, `Failed to charge payment ${payment.id} with error: ${e.message}`, currentUser, challengeId) throw new Error(`Failed to charge payment ${payment.id} with error: ${e.message}`) } const token = await getM2MToken() diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 759dade6..9cd00235 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1366,7 +1366,7 @@ async function update (currentUser, challengeId, data, isFull) { // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { try { - await helper.activateProject(challenge.projectId, currentUser) + await helper.activateProject(challenge.projectId, currentUser, challenge.id) // TODO: do not use challenge ID } catch (e) { await update( currentUser, @@ -1398,7 +1398,7 @@ async function update (currentUser, challengeId, data, isFull) { } } if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible) { - await helper.cancelProject(challenge.projectId, cancelReason, currentUser) + await helper.cancelProject(challenge.projectId, cancelReason, currentUser, challenge.id) } if (data.status === constants.challengeStatuses.Completed) { if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { From feb22f44585080edf09078fd9922e334bb7d47f2 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 19 Jan 2022 17:28:30 +0200 Subject: [PATCH 39/83] try/catch --- src/common/helper.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 0ed35486..14d91ac6 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -542,9 +542,11 @@ async function cancelPayment (paymentId) { * @param {Object} currentUser the current user */ async function activateProject (projectId, currentUser, challengeId) { - const payment = await getProjectPayment(challengeId) - const project = await ensureProjectExist(projectId, currentUser) + let payment + let project try { + payment = await getProjectPayment(challengeId) + project = await ensureProjectExist(projectId, currentUser) await capturePayment(payment.id) } catch (e) { logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) From ac218aa9a2d5b831f3b34d4623b9fa3dfac40866 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 19 Jan 2022 17:34:34 +0200 Subject: [PATCH 40/83] logging --- src/common/helper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/helper.js b/src/common/helper.js index 14d91ac6..66289036 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -549,6 +549,7 @@ async function activateProject (projectId, currentUser, challengeId) { project = await ensureProjectExist(projectId, currentUser) await capturePayment(payment.id) } catch (e) { + logger.debug(e) logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) await cancelProject(projectId, `Failed to charge payment ${payment.id} with error: ${e.message}`, currentUser, challengeId) throw new Error(`Failed to charge payment ${payment.id} with error: ${e.message}`) From f30870ce59bb0151ee0733749f3deeb6a5501585 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 19 Jan 2022 22:27:49 +0200 Subject: [PATCH 41/83] support legacy.selfServiceCopilot --- docs/swagger.yaml | 13 +++++++++++++ src/services/ChallengeService.js | 14 +++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 27a4522e..154d0a89 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -71,6 +71,11 @@ paths: description: Filter by selfService flag required: false type: boolean + - name: selfServiceCopilot + in: query + description: Filter by selfServiceCopilot + required: false + type: string - name: confidentialityType in: query description: Filter by confidentialityType @@ -2359,6 +2364,8 @@ definitions: type: boolean selfService: type: boolean + selfServiceCopilot: + type: string billing: type: object properties: @@ -2586,6 +2593,8 @@ definitions: type: boolean selfService: type: boolean + selfServiceCopilot: + type: string billing: type: object properties: @@ -2727,6 +2736,8 @@ definitions: type: boolean selfService: type: boolean + selfServiceCopilot: + type: string cancelReason: type: string billing: @@ -2909,6 +2920,8 @@ definitions: type: boolean selfService: type: boolean + selfServiceCopilot: + type: string cancelReason: type: string billing: diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9cd00235..da23c44e 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -326,6 +326,9 @@ async function searchChallenges (currentUser, criteria) { if (criteria.selfService) { boolQuery.push({ match_phrase: { 'legacy.selfService': criteria.selfService}}) } + if (criteria.selfServiceCopilot) { + boolQuery.push({ match_phrase: { 'legacy.selfServiceCopilot': criteria.selfServiceCopilot}}) + } if (criteria.forumId) { boolQuery.push({ match_phrase: { 'legacy.forumId': criteria.forumId } }) } @@ -696,6 +699,7 @@ searchChallenges.schema = { perPage: Joi.perPage(), id: Joi.optionalId(), selfService: Joi.boolean(), + selfServiceCopilot: Joi.string(), confidentialityType: Joi.string(), directProjectId: Joi.number(), typeIds: Joi.array().items(Joi.optionalId()), @@ -1085,7 +1089,8 @@ createChallenge.schema = { useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), pureV5: Joi.boolean(), - selfService: Joi.boolean() + selfService: Joi.boolean(), + selfServiceCopilot: Joi.string() }), billing: Joi.object().keys({ billingAccountId: Joi.string(), @@ -1888,7 +1893,8 @@ function sanitizeChallenge (challenge) { 'useSchedulingAPI', 'pureV5Task', 'pureV5', - 'selfService' + 'selfService', + 'selfServiceCopilot' ]) } if (challenge.billing) { @@ -1957,6 +1963,7 @@ fullyUpdateChallenge.schema = { pureV5Task: Joi.boolean(), pureV5: Joi.boolean(), selfService: Joi.boolean(), + selfServiceCopilot: Joi.string(), }).unknown(true), cancelReason: Joi.string(), billing: Joi.object().keys({ @@ -2062,7 +2069,8 @@ partiallyUpdateChallenge.schema = { useSchedulingAPI: Joi.boolean(), pureV5Task: Joi.boolean(), pureV5: Joi.boolean(), - selfService: Joi.boolean() + selfService: Joi.boolean(), + selfServiceCopilot: Joi.string() }).unknown(true), cancelReason: Joi.string(), task: Joi.object().keys({ From 4d0fb0c8cd6259cdbd17efd7299330150772a5c0 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 20 Jan 2022 14:31:51 +0200 Subject: [PATCH 42/83] revert temp fix --- src/common/helper.js | 10 +++++----- src/services/ChallengeService.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 66289036..0fc2cf97 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -511,8 +511,8 @@ async function cancelPayment (paymentId) { * @param {String} cancelReason the cancel reasonn * @param {Object} currentUser the current user */ - async function cancelProject (projectId, cancelReason, currentUser, challengeId) { - const payment = await getProjectPayment(challengeId) + async function cancelProject (projectId, cancelReason, currentUser) { + const payment = await getProjectPayment(projectId) const project = await ensureProjectExist(projectId, currentUser) try { await cancelPayment(payment.id) @@ -541,17 +541,17 @@ async function cancelPayment (paymentId) { * @param {String} projectId the project id * @param {Object} currentUser the current user */ -async function activateProject (projectId, currentUser, challengeId) { +async function activateProject (projectId, currentUser) { let payment let project try { - payment = await getProjectPayment(challengeId) + payment = await getProjectPayment(projectId) project = await ensureProjectExist(projectId, currentUser) await capturePayment(payment.id) } catch (e) { logger.debug(e) logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) - await cancelProject(projectId, `Failed to charge payment ${payment.id} with error: ${e.message}`, currentUser, challengeId) + await cancelProject(projectId, `Failed to charge payment ${payment.id} with error: ${e.message}`, currentUser) throw new Error(`Failed to charge payment ${payment.id} with error: ${e.message}`) } const token = await getM2MToken() diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index da23c44e..f2e2f3b9 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1371,7 +1371,7 @@ async function update (currentUser, challengeId, data, isFull) { // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { try { - await helper.activateProject(challenge.projectId, currentUser, challenge.id) // TODO: do not use challenge ID + await helper.activateProject(challenge.projectId, currentUser) } catch (e) { await update( currentUser, @@ -1403,7 +1403,7 @@ async function update (currentUser, challengeId, data, isFull) { } } if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible) { - await helper.cancelProject(challenge.projectId, cancelReason, currentUser, challenge.id) + await helper.cancelProject(challenge.projectId, cancelReason, currentUser) } if (data.status === constants.challengeStatuses.Completed) { if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { From 7d791c4f28e7c2ea232caf88370f044a0a5e361f Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 20 Jan 2022 16:53:13 +0200 Subject: [PATCH 43/83] hot fix configs and add logging --- config/default.js | 2 +- src/common/helper.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 7c45713c..4851a9bf 100644 --- a/config/default.js +++ b/config/default.js @@ -57,7 +57,7 @@ module.exports = { GROUPS_API_URL: process.env.GROUPS_API_URL || 'http://localhost:4000/v5/groups', PROJECTS_API_URL: process.env.PROJECTS_API_URL || 'http://localhost:4000/v5/projects', TERMS_API_URL: process.env.TERMS_API_URL || 'http://localhost:4000/v5/terms', - CUSTOMER_PAYMENTS_URL: process.env.CUSTOMER_PAYMENTS_URL || 'http://localhost:4000/v5/customer-payments', + CUSTOMER_PAYMENTS_URL: process.env.CUSTOMER_PAYMENTS_URL || 'https://api.topcoder-dev.com/v5/customer-payments', // copilot resource role ids allowed to upload attachment COPILOT_RESOURCE_ROLE_IDS: process.env.COPILOT_RESOURCE_ROLE_IDS ? process.env.COPILOT_RESOURCE_ROLE_IDS.split(',') : ['10ba038e-48da-487b-96e8-8d3b99b6d18b'], diff --git a/src/common/helper.js b/src/common/helper.js index 0fc2cf97..096bc4ac 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -485,6 +485,7 @@ async function createSelfServiceProject (name, description, type, token) { async function capturePayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` + logger.info(`Calling: ${url} to capture payment`) const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) logger.debug(`Payment API Response: ${JSON.stringify(res.data, null, 2)}`) if (res.data.status !== 'succeeded') { From 294b5e5e43c678c20877bc20b150ffc5a6cc91c1 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 14:54:02 +0200 Subject: [PATCH 44/83] logging --- src/common/helper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/helper.js b/src/common/helper.js index 096bc4ac..a0080a6c 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -486,6 +486,7 @@ async function capturePayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` logger.info(`Calling: ${url} to capture payment`) + logger.info(`Token: ${token}`) const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) logger.debug(`Payment API Response: ${JSON.stringify(res.data, null, 2)}`) if (res.data.status !== 'succeeded') { From 69e073214673994f95186d6138a4f29420f783eb Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 14:57:47 +0200 Subject: [PATCH 45/83] udpate project name/description on activation --- src/common/helper.js | 4 +++- src/services/ChallengeService.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index a0080a6c..673f8b5d 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -543,7 +543,7 @@ async function cancelPayment (paymentId) { * @param {String} projectId the project id * @param {Object} currentUser the current user */ -async function activateProject (projectId, currentUser) { +async function activateProject (projectId, currentUser, name, description) { let payment let project try { @@ -559,6 +559,8 @@ async function activateProject (projectId, currentUser) { const token = await getM2MToken() const url = `${config.PROJECTS_API_URL}/${projectId}` await axios.patch(url, { + name, + description, status: 'active', details: { ...project.details, diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f2e2f3b9..f79af0ae 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1371,7 +1371,8 @@ async function update (currentUser, challengeId, data, isFull) { // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { try { - await helper.activateProject(challenge.projectId, currentUser) + const selfServiceProjectName = `Self service - ${currentUser.userId} - ${challenge.name}` + await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, challenge.description) } catch (e) { await update( currentUser, From 76f68cace4594942bc129508ae8ae7cf6bb16755 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 15:00:49 +0200 Subject: [PATCH 46/83] use user handle instead of ID in the project name --- src/services/ChallengeService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f79af0ae..2dee4b06 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -904,7 +904,7 @@ async function createChallenge (currentUser, challenge, userToken) { try { if(challenge.legacy.selfService) { if(!challenge.projectId) { - const selfServiceProjectName = `Self service - ${currentUser.userId} - ${challenge.name}` + const selfServiceProjectName = `Self service - ${currentUser.handle} - ${challenge.name}` challenge.projectId = await helper.createSelfServiceProject(selfServiceProjectName, challenge.description, config.NEW_SELF_SERVICE_PROJECT_TYPE, userToken) } } else if (!challenge.projectId) { @@ -1371,7 +1371,7 @@ async function update (currentUser, challengeId, data, isFull) { // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { try { - const selfServiceProjectName = `Self service - ${currentUser.userId} - ${challenge.name}` + const selfServiceProjectName = `Self service - ${currentUser.createdBy} - ${challenge.name}` await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, challenge.description) } catch (e) { await update( From 1ff76528f561a3e50e9c5f86d25e12b1bd70c187 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 15:04:26 +0200 Subject: [PATCH 47/83] fix call to capture/cancel payment --- src/common/helper.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 673f8b5d..8e4b6fc9 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -486,8 +486,7 @@ async function capturePayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge` logger.info(`Calling: ${url} to capture payment`) - logger.info(`Token: ${token}`) - const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + const res = await axios.patch(url, {}, { headers: { Authorization: `Bearer ${token}` } }) logger.debug(`Payment API Response: ${JSON.stringify(res.data, null, 2)}`) if (res.data.status !== 'succeeded') { throw new Error(`Failed to charge payment. Current status: ${res.data.status}`) @@ -501,7 +500,7 @@ async function capturePayment (paymentId) { async function cancelPayment (paymentId) { const token = await getM2MToken() const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/cancel` - const res = await axios.patch(url, { headers: { Authorization: `Bearer ${token}` } }) + const res = await axios.patch(url, {}, { headers: { Authorization: `Bearer ${token}` } }) if (res.data.status !== 'canceled') { throw new Error(`Failed to cancel payment. Current status: ${res.data.status}`) } From f8ea04097f6ae76d0b35dcc2835146f674437f77 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 15:18:04 +0200 Subject: [PATCH 48/83] update payment info on activation/canceling of project --- src/common/helper.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 8e4b6fc9..663ec988 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -491,6 +491,7 @@ async function capturePayment (paymentId) { if (res.data.status !== 'succeeded') { throw new Error(`Failed to charge payment. Current status: ${res.data.status}`) } + return res.data } /** @@ -504,6 +505,7 @@ async function cancelPayment (paymentId) { if (res.data.status !== 'canceled') { throw new Error(`Failed to cancel payment. Current status: ${res.data.status}`) } + return res.data } /** @@ -513,10 +515,10 @@ async function cancelPayment (paymentId) { * @param {Object} currentUser the current user */ async function cancelProject (projectId, cancelReason, currentUser) { - const payment = await getProjectPayment(projectId) + let payment = await getProjectPayment(projectId) const project = await ensureProjectExist(projectId, currentUser) try { - await cancelPayment(payment.id) + payment = await cancelPayment(payment.id) } catch (e) { logger.debug(`Failed to cancel payment with error: ${e.message}`) } @@ -548,7 +550,7 @@ async function activateProject (projectId, currentUser, name, description) { try { payment = await getProjectPayment(projectId) project = await ensureProjectExist(projectId, currentUser) - await capturePayment(payment.id) + payment = await capturePayment(payment.id) } catch (e) { logger.debug(e) logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) From d8019d65b1b8e6b594bd802bf03941b42a1c57de Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 17:15:18 +0200 Subject: [PATCH 49/83] dynamic template --- src/services/ChallengeService.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 2dee4b06..d9f569bb 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1368,6 +1368,18 @@ async function update (currentUser, challengeId, data, isFull) { // helper.ensureNoDuplicateOrNullElements(data.gitRepoURLs, 'gitRepoURLs') const challenge = await helper.getById('Challenge', challengeId) + + if (challenge.legacy.selfService && !data.description) { + data.description = challenge.description + } + if (challenge.legacy.selfService && !data.metadata) { + data.metadata = challenge.metadata + } + if(challenge.legacy.selfService && data.metadata && data.metadata.length > 0) { + for(const entry of data.metadata) { + data.description = data.description.replaceAll(`{{${entry.name}}}`, entry.value ) + } + } // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { try { @@ -1387,6 +1399,7 @@ async function update (currentUser, challengeId, data, isFull) { throw new errors.BadRequestError('Failed to activate the challenge! The challenge has been canceled!') } } + const { billingAccountId, markup } = await helper.getProjectBillingInformation(_.get(challenge, 'projectId')) if (billingAccountId && _.isUndefined(_.get(challenge, 'billing.billingAccountId'))) { _.set(data, 'billing.billingAccountId', billingAccountId) From a7d95efb67573691ec54fb66affedba13d2f24f1 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 17:55:42 +0200 Subject: [PATCH 50/83] fix dynamic spec --- src/services/ChallengeService.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index d9f569bb..4c60c799 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1368,17 +1368,12 @@ async function update (currentUser, challengeId, data, isFull) { // helper.ensureNoDuplicateOrNullElements(data.gitRepoURLs, 'gitRepoURLs') const challenge = await helper.getById('Challenge', challengeId) - - if (challenge.legacy.selfService && !data.description) { - data.description = challenge.description - } - if (challenge.legacy.selfService && !data.metadata) { - data.metadata = challenge.metadata - } + let dynamicDescription = _.cloneDeep(challenge.description) if(challenge.legacy.selfService && data.metadata && data.metadata.length > 0) { for(const entry of data.metadata) { - data.description = data.description.replaceAll(`{{${entry.name}}}`, entry.value ) + dynamicDescription = dynamicDescription.replaceAll(`{{${entry.name}}}`, entry.value ) } + data.description = dynamicDescription } // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { From 199964ac23908aa25ff68752b99b718563889017 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 21 Jan 2022 18:07:59 +0200 Subject: [PATCH 51/83] use regex for dynamic spec --- src/services/ChallengeService.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 4c60c799..9d5fb2e2 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1371,7 +1371,8 @@ async function update (currentUser, challengeId, data, isFull) { let dynamicDescription = _.cloneDeep(challenge.description) if(challenge.legacy.selfService && data.metadata && data.metadata.length > 0) { for(const entry of data.metadata) { - dynamicDescription = dynamicDescription.replaceAll(`{{${entry.name}}}`, entry.value ) + const regexp = new RegExp(`{{${entry.name}}}`, 'g') + dynamicDescription = dynamicDescription.replace(regexp, entry.value) } data.description = dynamicDescription } From e25ec764faa68565124f0000603fbe985867e367 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Sat, 22 Jan 2022 01:12:47 +0200 Subject: [PATCH 52/83] support approved state for challenges --- app-constants.js | 1 + src/common/helper.js | 4 +++- src/services/ChallengeService.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app-constants.js b/app-constants.js index 952f6c87..4b89f079 100644 --- a/app-constants.js +++ b/app-constants.js @@ -18,6 +18,7 @@ const prizeSetTypes = { const challengeStatuses = { New: 'New', Draft: 'Draft', + Approved: 'Approved', Cancelled: 'Cancelled', Active: 'Active', Completed: 'Completed', diff --git a/src/common/helper.js b/src/common/helper.js index 663ec988..96e91071 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -550,7 +550,9 @@ async function activateProject (projectId, currentUser, name, description) { try { payment = await getProjectPayment(projectId) project = await ensureProjectExist(projectId, currentUser) - payment = await capturePayment(payment.id) + if (payment.status !== 'succeeded') { + payment = await capturePayment(payment.id) + } } catch (e) { logger.debug(e) logger.debug(`Failed to charge payment ${payment.id} with error: ${e.message}`) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9d5fb2e2..b86773ad 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1377,7 +1377,7 @@ async function update (currentUser, challengeId, data, isFull) { data.description = dynamicDescription } // check if it's a self service challenge and project needs to be activated first - if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Active && challenge.status !== constants.challengeStatuses.Active) { + if (challenge.legacy.selfService && (data.status === constants.challengeStatuses.Approved || data.status === constants.challengeStatuses.Active) && challenge.status !== constants.challengeStatuses.Active) { try { const selfServiceProjectName = `Self service - ${currentUser.createdBy} - ${challenge.name}` await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, challenge.description) From d884897522f225d347214d1e365a291f90eef454 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 24 Jan 2022 01:00:20 +0200 Subject: [PATCH 53/83] Only allowe admins, m2m and whitelisted members to access selfService challenges --- config/default.js | 4 +++- src/services/ChallengeService.js | 30 +++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/config/default.js b/config/default.js index 4851a9bf..944e16db 100644 --- a/config/default.js +++ b/config/default.js @@ -83,5 +83,7 @@ module.exports = { FORUM_TITLE_LENGTH_LIMIT: process.env.FORUM_TITLE_LENGTH_LIMIT || 90, - NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'self-service' + NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'self-service', + + SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || [] } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index b86773ad..65e482c6 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -139,6 +139,8 @@ async function searchChallenges (currentUser, criteria) { 'updatedBy' ] + const includeSelfService = currentUser && (currentUser.isMachine || helper.hasAdminRole(currentUser) || _.includes(config.SELF_SERVICE_WHITELIST_HANDLES, currentUser.handle)) + const includedTrackIds = _.isArray(criteria.trackIds) ? criteria.trackIds : [] const includedTypeIds = _.isArray(criteria.typeIds) ? criteria.typeIds : [] @@ -323,11 +325,13 @@ async function searchChallenges (currentUser, criteria) { if (criteria.useSchedulingAPI) { boolQuery.push({ match_phrase: { 'legacy.useSchedulingAPI': criteria.useSchedulingAPI } }) } - if (criteria.selfService) { - boolQuery.push({ match_phrase: { 'legacy.selfService': criteria.selfService}}) - } - if (criteria.selfServiceCopilot) { - boolQuery.push({ match_phrase: { 'legacy.selfServiceCopilot': criteria.selfServiceCopilot}}) + if (includeSelfService) { + if (criteria.selfService) { + boolQuery.push({ match_phrase: { 'legacy.selfService': criteria.selfService}}) + } + if (criteria.selfServiceCopilot) { + boolQuery.push({ match_phrase: { 'legacy.selfServiceCopilot': criteria.selfServiceCopilot}}) + } } if (criteria.forumId) { boolQuery.push({ match_phrase: { 'legacy.forumId': criteria.forumId } }) @@ -572,6 +576,22 @@ async function searchChallenges (currentUser, criteria) { }) } + if (!includeSelfService) { + mustQuery.push({ + bool: { + should: [ + { bool: { must_not: { exists: { field: 'legacy.selfService' } } } }, + ...(currentUser ? [ + { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.New } } } }, + { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.Draft } } } }, + { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.Approved } } } }, + { bool: { must: { match_phrase: { 'createdBy': currentUser.handle } } } }, + ] : []) + ] + } + }) + } + if (groupsQuery.length > 0) { mustQuery.push({ bool: { From 3f773f6f0d9684e1226f6b76e7dde24c7df67070 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 24 Jan 2022 01:07:16 +0200 Subject: [PATCH 54/83] fix --- src/services/ChallengeService.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 65e482c6..45d07716 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -325,13 +325,11 @@ async function searchChallenges (currentUser, criteria) { if (criteria.useSchedulingAPI) { boolQuery.push({ match_phrase: { 'legacy.useSchedulingAPI': criteria.useSchedulingAPI } }) } - if (includeSelfService) { - if (criteria.selfService) { - boolQuery.push({ match_phrase: { 'legacy.selfService': criteria.selfService}}) - } - if (criteria.selfServiceCopilot) { - boolQuery.push({ match_phrase: { 'legacy.selfServiceCopilot': criteria.selfServiceCopilot}}) - } + if (criteria.selfService) { + boolQuery.push({ match_phrase: { 'legacy.selfService': criteria.selfService}}) + } + if (criteria.selfServiceCopilot) { + boolQuery.push({ match_phrase: { 'legacy.selfServiceCopilot': criteria.selfServiceCopilot}}) } if (criteria.forumId) { boolQuery.push({ match_phrase: { 'legacy.forumId': criteria.forumId } }) From 5465abb339465435e2938f77a558fe6a775443b4 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 24 Jan 2022 14:00:11 +0200 Subject: [PATCH 55/83] support adding forums post-creation --- src/services/ChallengeService.js | 35 +++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 45d07716..f814855b 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1488,22 +1488,29 @@ async function update (currentUser, challengeId, data, isFull) { // Only M2M can update url and options of discussions if (data.discussions && data.discussions.length > 0) { - for (let i = 0; i < data.discussions.length; i += 1) { - if (_.isUndefined(data.discussions[i].id)) { - data.discussions[i].id = uuid() - if (!currentUser.isMachine) { - _.unset(data.discussions, 'url') - _.unset(data.discussions, 'options') - } - } else if (!currentUser.isMachine) { - const existingDiscussion = _.find(_.get(challenge, 'discussions', []), d => d.id === data.discussions[i].id) - if (existingDiscussion) { - _.assign(data.discussions[i], _.pick(existingDiscussion, ['url', 'options'])) - } else { - _.unset(data.discussions, 'url') - _.unset(data.discussions, 'options') + if (challenge.discussions && challenge.discussions.length > 0) { + for (let i = 0; i < data.discussions.length; i += 1) { + if (_.isUndefined(data.discussions[i].id)) { + data.discussions[i].id = uuid() + if (!currentUser.isMachine) { + _.unset(data.discussions, 'url') + _.unset(data.discussions, 'options') + } + } else if (!currentUser.isMachine) { + const existingDiscussion = _.find(_.get(challenge, 'discussions', []), d => d.id === data.discussions[i].id) + if (existingDiscussion) { + _.assign(data.discussions[i], _.pick(existingDiscussion, ['url', 'options'])) + } else { + _.unset(data.discussions, 'url') + _.unset(data.discussions, 'options') + } } } + } else { + for (let i = 0; i < challenge.discussions.length; i += 1) { + data.discussions[i].id = uuid() + data.discussions[i].name = data.discussions[i].name.substring(0, config.FORUM_TITLE_LENGTH_LIMIT) + } } } From 4757f0c852b3b3cecac48b5bc2ea1778ee8988ae Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 24 Jan 2022 14:17:11 +0200 Subject: [PATCH 56/83] fix typo --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f814855b..9d4af20a 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1507,7 +1507,7 @@ async function update (currentUser, challengeId, data, isFull) { } } } else { - for (let i = 0; i < challenge.discussions.length; i += 1) { + for (let i = 0; i < data.discussions.length; i += 1) { data.discussions[i].id = uuid() data.discussions[i].name = data.discussions[i].name.substring(0, config.FORUM_TITLE_LENGTH_LIMIT) } From a2af9fb0feb46e3c98163d3dc6487fd6eb526df2 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 25 Jan 2022 15:07:04 +1100 Subject: [PATCH 57/83] Temp fix for client manager role assigned to self-service challenge creator --- config/default.js | 1 + src/services/ChallengeService.js | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/config/default.js b/config/default.js index 944e16db..0493b4a3 100644 --- a/config/default.js +++ b/config/default.js @@ -65,6 +65,7 @@ module.exports = { MANAGER_ROLE_ID: process.env.MANAGER_ROLE_ID || '0e9c6879-39e4-4eb6-b8df-92407890faf1', OBSERVER_ROLE_ID: process.env.OBSERVER_ROLE_ID || '2a4dc376-a31c-4d00-b173-13934d89e286', + CLIENT_MANAGER_ROLE_ID: process.env.OBSERVER_ROLE_ID || '9b2f1905-8128-42da-85df-ed64410f4781', // health check timeout in milliseconds HEALTH_CHECK_TIMEOUT: process.env.HEALTH_CHECK_TIMEOUT || 3000, diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9d4af20a..e0a1ba8b 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1077,12 +1077,21 @@ async function createChallenge (currentUser, challenge, userToken) { body: ret }) - // if created by a user, add user as a manager - if (currentUser.handle) { - // logger.debug(`Adding user as manager ${currentUser.handle}`) - await helper.createResource(ret.id, ret.createdBy, config.MANAGER_ROLE_ID) - } else { - // logger.debug(`Not adding manager ${currentUser.sub} ${JSON.stringify(currentUser)}`) + //If the challenge is self-service, add the creating user as the "client manager", *not* the manager + //This is necessary for proper handling of the vanilla embed on the self-service work item dashboard + if(challenge.legacy.selfService) { + if (currentUser.handle) { + await helper.createResource(ret.id, ret.createdBy, config.CLIENT_MANAGER_ROLE_ID) + } + } + else{ + // if created by a user, add user as a manager, but only if *not* a self-service challenge + if (currentUser.handle) { + // logger.debug(`Adding user as manager ${currentUser.handle}`) + await helper.createResource(ret.id, ret.createdBy, config.MANAGER_ROLE_ID) + } else { + // logger.debug(`Not adding manager ${currentUser.sub} ${JSON.stringify(currentUser)}`) + } } // post bus event From fd0df23f822032f437903ffc9b64dd1005a1ff44 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 11:51:19 +0200 Subject: [PATCH 58/83] Update whitelisted copilots (temp for QA) --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 0493b4a3..2d19d167 100644 --- a/config/default.js +++ b/config/default.js @@ -86,5 +86,5 @@ module.exports = { NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'self-service', - SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || [] + SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || ['TCConnCopilot', 'sstestcopilot'] } From 890587155694148f85f1cef333c8105c8a4bb56d Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 16:12:42 +0200 Subject: [PATCH 59/83] v1 of email notifications for self-service --- app-constants.js | 36 ++++++++++++++++++++++++++++++-- config/default.js | 13 +++++++++++- src/common/helper.js | 32 +++++++++++++++++++++++++++- src/services/ChallengeService.js | 11 +++++++++- 4 files changed, 87 insertions(+), 5 deletions(-) diff --git a/app-constants.js b/app-constants.js index 4b89f079..81cd442a 100644 --- a/app-constants.js +++ b/app-constants.js @@ -1,3 +1,5 @@ +const config = require('config') + /** * App constants */ @@ -72,7 +74,9 @@ const Topics = { ChallengeTypeTimelineTemplateDeleted: 'test.new.bus.events', // 'challenge.action.type.timeline.template.deleted' ChallengeAttachmentCreated: 'test.new.bus.events', // 'challenge.action.attachment.created', ChallengeAttachmentUpdated: 'test.new.bus.events', // 'challenge.action.attachment.updated', - ChallengeAttachmentDeleted: 'test.new.bus.events' // 'challenge.action.attachment.deleted', + ChallengeAttachmentDeleted: 'test.new.bus.events', // 'challenge.action.attachment.deleted', + // Self Service topics + Notifications: 'notifications.action.create' } const challengeTracks = { @@ -92,6 +96,32 @@ const reviewTypes = { Internal: 'INTERNAL' } +const SelfServiceNotificationTypes = { + WORK_REQUEST_SUBMITTED: 'self-service.notifications.work-request-submitted', + WORK_REQUEST_STARTED: 'self-service.notifications.work-request-started', + WORK_REQUEST_REDIRECTED: 'self-service.notifications.work-request-redirected', + WORK_COMPLETED: 'self-service.notifications.work-completed' +} + +const SelfServiceNotificationSettings = { + [SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED]: { + sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_REQUEST_SUBMITTED, + cc: [] + }, + [SelfServiceNotificationTypes.WORK_REQUEST_STARTED]: { + sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_REQUEST_STARTED, + cc: [] + }, + [SelfServiceNotificationTypes.WORK_REQUEST_REDIRECTED]: { + sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_REQUEST_REDIRECTED, + cc: [...config.SELF_SERVICE_EMAIL_CC_ACCOUNTS] + }, + [SelfServiceNotificationTypes.WORK_COMPLETED]: { + sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_COMPLETED, + cc: [] + } +} + module.exports = { UserRoles, prizeSetTypes, @@ -103,5 +133,7 @@ module.exports = { challengeTracks, challengeTextSortField, DiscussionTypes, - reviewTypes + reviewTypes, + SelfServiceNotificationTypes, + SelfServiceNotificationSettings } diff --git a/config/default.js b/config/default.js index 944e16db..6701483c 100644 --- a/config/default.js +++ b/config/default.js @@ -1,6 +1,7 @@ /** * The configuration file. */ +const _ = require('lodash') require('dotenv').config() module.exports = { READONLY: process.env.READONLY === 'true' || false, @@ -85,5 +86,15 @@ module.exports = { NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'self-service', - SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || [] + SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || [], + + SENDGRID_TEMPLATES: { + WORK_REQUEST_SUBMITTED: process.env.WORK_REQUEST_SUBMITTED || '', + WORK_REQUEST_STARTED: process.env.WORK_REQUEST_STARTED || '', + WORK_REQUEST_REDIRECTED: process.env.WORK_REQUEST_REDIRECTED || '', + WORK_COMPLETED: process.env.WORK_COMPLETED || '' + }, + + EMAIL_FROM: process.env.EMAIL_FROM || 'no-reply@topcoder.com', + SELF_SERVICE_EMAIL_CC_ACCOUNTS: process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS ? _.map(process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS.split(','), email => ({ email })) : [] } diff --git a/src/common/helper.js b/src/common/helper.js index 96e91071..ac0353e8 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -1126,6 +1126,35 @@ async function getMemberById (userId) { return {} } +/** + * Send self service notification + * @param {String} type the notification type + * @param {Array} recipients the array of recipients in { userId || email || handle } format + * @param {Object} data the data + */ +async function sendSelfServiceNotification (type, recipients, data) { + try { + await postBusEvent(constants.Topics.Notifications, { + notifications: [ + { + serviceId: 'email', + type, + details: { + from: config.EMAIL_FROM, + recipients: [...recipients], + cc: [...constants.SelfServiceNotificationSettings[type].cc], + data, + sendgridTemplateId: constants.SelfServiceNotificationSettings[type].sendgridTemplateId, + version: 'v3' + } + } + ] + }) + } catch (e) { + logger.debug(`Failed to post notification ${type}: ${e.message}`) + } +} + module.exports = { wrapExpress, autoWrapExpress, @@ -1175,5 +1204,6 @@ module.exports = { cancelProject, getProjectPayment, capturePayment, - cancelPayment + cancelPayment, + sendSelfServiceNotification } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9d4af20a..c51223ac 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1087,7 +1087,16 @@ async function createChallenge (currentUser, challenge, userToken) { // post bus event await helper.postBusEvent(constants.Topics.ChallengeCreated, ret) - + // send email notification + if (challenge.legacy.selfService && currentUser.handle) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, + [{ userId: currentUser.userId }], + { + handle: currentUser.handle, + workItemName: ret.name + }) + } return ret } From 89d8b0e5504e235f3a3784371c6082f0b92a0d32 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 16:58:24 +0200 Subject: [PATCH 60/83] fix access checks --- app-constants.js | 3 ++- src/routes.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app-constants.js b/app-constants.js index 81cd442a..2a415635 100644 --- a/app-constants.js +++ b/app-constants.js @@ -7,7 +7,8 @@ const UserRoles = { Admin: 'administrator', Copilot: 'copilot', Manager: 'Connect Manager', - User: 'Topcoder User' + User: 'Topcoder User', + SelfServiceCustomer: 'Self-Service Customer' } const prizeSetTypes = { diff --git a/src/routes.js b/src/routes.js index 7df4478e..ad4b1720 100644 --- a/src/routes.js +++ b/src/routes.js @@ -16,14 +16,14 @@ module.exports = { get: { controller: 'ChallengeController', method: 'searchChallenges', - access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], + access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Manager, constants.UserRoles.User], scopes: [READ, ALL] }, post: { controller: 'ChallengeController', method: 'createChallenge', auth: 'jwt', - access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], + access: [constants.UserRoles.Admin, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], scopes: [CREATE, ALL] } }, @@ -43,21 +43,21 @@ module.exports = { controller: 'ChallengeController', method: 'fullyUpdateChallenge', auth: 'jwt', - access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], + access: [constants.UserRoles.Admin, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], scopes: [UPDATE, ALL] }, patch: { controller: 'ChallengeController', method: 'partiallyUpdateChallenge', auth: 'jwt', - access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], + access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Manager, constants.UserRoles.User], scopes: [UPDATE, ALL] }, delete: { controller: 'ChallengeController', method: 'deleteChallenge', auth: 'jwt', - access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], + access: [constants.UserRoles.Admin, constants.UserRoles.Copilot, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Manager, constants.UserRoles.User], scopes: [DELETE, ALL] } }, From 106e1d996ce3c68ad3144b7604a01681a6a661d7 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 17:11:28 +0200 Subject: [PATCH 61/83] Fix submitted email --- src/services/ChallengeService.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 796116ad..c5b2bf6d 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1096,16 +1096,6 @@ async function createChallenge (currentUser, challenge, userToken) { // post bus event await helper.postBusEvent(constants.Topics.ChallengeCreated, ret) - // send email notification - if (challenge.legacy.selfService && currentUser.handle) { - await helper.sendSelfServiceNotification( - constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, - [{ userId: currentUser.userId }], - { - handle: currentUser.handle, - workItemName: ret.name - }) - } return ret } @@ -1391,6 +1381,7 @@ async function validateWinners (winners, challengeId) { */ async function update (currentUser, challengeId, data, isFull) { const cancelReason = _.cloneDeep(data.cancelReason) + let sendActivationEmail = false delete data.cancelReason if (!_.isUndefined(_.get(data, 'legacy.reviewType'))) { _.set(data, 'legacy.reviewType', _.toUpper(_.get(data, 'legacy.reviewType'))) @@ -1417,6 +1408,7 @@ async function update (currentUser, challengeId, data, isFull) { try { const selfServiceProjectName = `Self service - ${currentUser.createdBy} - ${challenge.name}` await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, challenge.description) + sendActivationEmail = true } catch (e) { await update( currentUser, @@ -1901,6 +1893,15 @@ async function update (currentUser, challengeId, data, isFull) { doc: challenge } }) + if (challenge.legacy.selfService && currentUser.handle) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, + [{ email: currentUser.email }], + { + handle: currentUser.handle, + workItemName: challenge.name + }) + } return challenge } From 7e14aa045dcfdd7c2b21896b2282f240f7a7aba9 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 17:12:13 +0200 Subject: [PATCH 62/83] only send email on activation --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index c5b2bf6d..c40ddcec 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1893,7 +1893,7 @@ async function update (currentUser, challengeId, data, isFull) { doc: challenge } }) - if (challenge.legacy.selfService && currentUser.handle) { + if (sendActivationEmail && challenge.legacy.selfService && currentUser.handle) { await helper.sendSelfServiceNotification( constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, [{ email: currentUser.email }], From 5d7057f4173962f5ae277f045ab72ff96f11c0c8 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 17:24:38 +0200 Subject: [PATCH 63/83] submission vs activation email --- src/services/ChallengeService.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index c40ddcec..cf6b95e6 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1382,6 +1382,7 @@ async function validateWinners (winners, challengeId) { async function update (currentUser, challengeId, data, isFull) { const cancelReason = _.cloneDeep(data.cancelReason) let sendActivationEmail = false + let sendSubmittedEmail = false delete data.cancelReason if (!_.isUndefined(_.get(data, 'legacy.reviewType'))) { _.set(data, 'legacy.reviewType', _.toUpper(_.get(data, 'legacy.reviewType'))) @@ -1403,6 +1404,9 @@ async function update (currentUser, challengeId, data, isFull) { } data.description = dynamicDescription } + if (challenge.legacy.selfService && data.status === constants.challengeStatuses.Draft && challenge.status !== constants.challengeStatuses.Draft) { + sendSubmittedEmail = true + } // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && (data.status === constants.challengeStatuses.Approved || data.status === constants.challengeStatuses.Active) && challenge.status !== constants.challengeStatuses.Active) { try { @@ -1893,14 +1897,17 @@ async function update (currentUser, challengeId, data, isFull) { doc: challenge } }) - if (sendActivationEmail && challenge.legacy.selfService && currentUser.handle) { - await helper.sendSelfServiceNotification( - constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, - [{ email: currentUser.email }], - { - handle: currentUser.handle, - workItemName: challenge.name - }) + if (challenge.legacy.selfService && currentUser.handle) { + if (sendSubmittedEmail) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, + [{ email: currentUser.email }], + { + handle: currentUser.handle, + workItemName: challenge.name + } + ) + } } return challenge } From 4230791035200f4ac9ac36451a90b6230b5bf444 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 17:29:01 +0200 Subject: [PATCH 64/83] fix recipient to be the creator of the challenge --- src/common/helper.js | 16 +++++++++++++++- src/services/ChallengeService.js | 8 +++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index ac0353e8..96c7a535 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -1126,6 +1126,19 @@ async function getMemberById (userId) { return {} } +/** + * Get member by handle + * @param {String} handle the user handle + * @returns {Object} + */ +async function getMemberByHandle (handle) { + const token = await getM2MToken() + const res = await axios.get(`${config.MEMBERS_API_URL}/${handle}`, { + headers: { Authorization: `Bearer ${token}` } + }) + return res.data || {} +} + /** * Send self service notification * @param {String} type the notification type @@ -1205,5 +1218,6 @@ module.exports = { getProjectPayment, capturePayment, cancelPayment, - sendSelfServiceNotification + sendSelfServiceNotification, + getMemberByHandle } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index cf6b95e6..c1201818 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1897,13 +1897,15 @@ async function update (currentUser, challengeId, data, isFull) { doc: challenge } }) - if (challenge.legacy.selfService && currentUser.handle) { + + if (challenge.legacy.selfService) { + const creator = await helper.getMemberByHandle(challenge.createdBy) if (sendSubmittedEmail) { await helper.sendSelfServiceNotification( constants.SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED, - [{ email: currentUser.email }], + [{ email: creator.email }], { - handle: currentUser.handle, + handle: creator.handle, workItemName: challenge.name } ) From c16ede2cd3a3f5c1184f1c5d8415a44640ace9f6 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 18:14:35 +0200 Subject: [PATCH 65/83] all types of email notifications --- config/default.js | 3 ++- src/services/ChallengeService.js | 38 +++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index 3a081582..50700bc7 100644 --- a/config/default.js +++ b/config/default.js @@ -98,5 +98,6 @@ module.exports = { EMAIL_FROM: process.env.EMAIL_FROM || 'no-reply@topcoder.com', SELF_SERVICE_EMAIL_CC_ACCOUNTS: process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS ? _.map(process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS.split(','), email => ({ email })) : [], - SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || ['TCConnCopilot', 'sstestcopilot'] + SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || ['TCConnCopilot', 'sstestcopilot'], + SELF_SERVICE_APP_URL: process.env.SELF_SERVICE_APP_URL || 'https://platform.topcoder-dev.com/self-service' } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index c1201818..f6c9fdbb 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1383,6 +1383,8 @@ async function update (currentUser, challengeId, data, isFull) { const cancelReason = _.cloneDeep(data.cancelReason) let sendActivationEmail = false let sendSubmittedEmail = false + let sendCompletedEmail = false + let sendRejectedEmail = false delete data.cancelReason if (!_.isUndefined(_.get(data, 'legacy.reviewType'))) { _.set(data, 'legacy.reviewType', _.toUpper(_.get(data, 'legacy.reviewType'))) @@ -1444,13 +1446,15 @@ async function update (currentUser, challengeId, data, isFull) { throw new errors.BadRequestError('Cannot Activate this project, it has no active billing account.') } } - if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible) { + if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible || constants.challengeStatuses.CancelledPaymentFailed) { await helper.cancelProject(challenge.projectId, cancelReason, currentUser) + sendRejectedEmail = true } if (data.status === constants.challengeStatuses.Completed) { if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) { throw new errors.BadRequestError('You cannot mark a Draft challenge as Completed') } + sendCompletedEmail = true } } @@ -1910,6 +1914,38 @@ async function update (currentUser, challengeId, data, isFull) { } ) } + if (sendActivationEmail) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_REQUEST_STARTED, + [{ email: creator.email }], + { + handle: creator.handle, + workItemName: challenge.name, + workItemUrl: `${config.SELF_SERVICE_APP_URL}/work-items/${challenge.id}` + } + ) + } + if (sendCompletedEmail) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_COMPLETED, + [{ email: creator.email }], + { + handle: creator.handle, + workItemName: challenge.name, + workItemUrl: `${config.SELF_SERVICE_APP_URL}/work-items/${challenge.id}?tab=solutions` + } + ) + } + if (sendRejectedEmail) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_REQUEST_REDIRECTED, + [{ email: creator.email }], + { + handle: creator.handle, + workItemName: challenge.name + } + ) + } } return challenge } From 8445b19830f625ef2390e686bb85e47b1bcd6f2a Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 18:27:38 +0200 Subject: [PATCH 66/83] fix undefined in project name --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index f6c9fdbb..d91fc3f7 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1412,7 +1412,7 @@ async function update (currentUser, challengeId, data, isFull) { // check if it's a self service challenge and project needs to be activated first if (challenge.legacy.selfService && (data.status === constants.challengeStatuses.Approved || data.status === constants.challengeStatuses.Active) && challenge.status !== constants.challengeStatuses.Active) { try { - const selfServiceProjectName = `Self service - ${currentUser.createdBy} - ${challenge.name}` + const selfServiceProjectName = `Self service - ${challenge.createdBy} - ${challenge.name}` await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, challenge.description) sendActivationEmail = true } catch (e) { From fe69484350cce1c5d5d6245f58d1c97193a1ec40 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 18:39:27 +0200 Subject: [PATCH 67/83] add cancelReason --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index d91fc3f7..b50db898 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1422,7 +1422,7 @@ async function update (currentUser, challengeId, data, isFull) { { ...data, status: constants.challengeStatuses.CancelledPaymentFailed, - cancelReason: e.message + cancelReason: `Failed to activate project. Error: ${e.message}. JSON: ${JSON.stringify(e)}` }, false ) From 0f8f3d1b98e5d0662de6c507660a98df46ad5e5d Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 26 Jan 2022 18:41:44 +0200 Subject: [PATCH 68/83] fix issue with challenge updates --- src/services/ChallengeService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index b50db898..7c2817ed 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1446,7 +1446,7 @@ async function update (currentUser, challengeId, data, isFull) { throw new errors.BadRequestError('Cannot Activate this project, it has no active billing account.') } } - if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible || constants.challengeStatuses.CancelledPaymentFailed) { + if (data.status === constants.challengeStatuses.CancelledRequirementsInfeasible || data.status === constants.challengeStatuses.CancelledPaymentFailed) { await helper.cancelProject(challenge.projectId, cancelReason, currentUser) sendRejectedEmail = true } From e46615c6caa1bcf54e12c14850b606bd21ad46fd Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 27 Jan 2022 15:32:13 +0200 Subject: [PATCH 69/83] Add endpoint for submitting requests to zendesk --- config/default.js | 5 +++- src/common/helper.js | 27 ++++++++++++++++- src/controllers/SupportController.js | 21 ++++++++++++++ src/routes.js | 9 ++++++ src/services/SupportService.js | 43 ++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 src/controllers/SupportController.js create mode 100644 src/services/SupportService.js diff --git a/config/default.js b/config/default.js index 50700bc7..3f823df2 100644 --- a/config/default.js +++ b/config/default.js @@ -99,5 +99,8 @@ module.exports = { EMAIL_FROM: process.env.EMAIL_FROM || 'no-reply@topcoder.com', SELF_SERVICE_EMAIL_CC_ACCOUNTS: process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS ? _.map(process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS.split(','), email => ({ email })) : [], SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || ['TCConnCopilot', 'sstestcopilot'], - SELF_SERVICE_APP_URL: process.env.SELF_SERVICE_APP_URL || 'https://platform.topcoder-dev.com/self-service' + SELF_SERVICE_APP_URL: process.env.SELF_SERVICE_APP_URL || 'https://platform.topcoder-dev.com/self-service', + + ZENDESK_API_TOKEN: process.env.ZENDESK_API_TOKEN || '', + ZENDESK_API_URL: process.env.ZENDESK_API_URL || '' } diff --git a/src/common/helper.js b/src/common/helper.js index 96c7a535..237caa27 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -1168,6 +1168,30 @@ async function sendSelfServiceNotification (type, recipients, data) { } } +/** + * Submit a request to zendesk + * @param {Object} request the request + */ +async function submitZendeskRequest (request) { + try { + const res = await axios.post(`${ZENDESK_API_URL}/api/v2/requests`, { + request: { + ...request, + collaborators: [..._.map(config.SELF_SERVICE_EMAIL_CC_ACCOUNTS, 'email')] + } + }, { + auth: { + username: `${request.requester.email}/token`, + password: config.ZENDESK_API_TOKEN + } + }) + return res.data || {} + } catch (e) { + logger.debug(`Failed to submit request: ${e.message}`) + logger.debug(e) + } +} + module.exports = { wrapExpress, autoWrapExpress, @@ -1219,5 +1243,6 @@ module.exports = { capturePayment, cancelPayment, sendSelfServiceNotification, - getMemberByHandle + getMemberByHandle, + submitZendeskRequest } diff --git a/src/controllers/SupportController.js b/src/controllers/SupportController.js new file mode 100644 index 00000000..07aa69fb --- /dev/null +++ b/src/controllers/SupportController.js @@ -0,0 +1,21 @@ +/** + * Controller for support endpoints + */ +const HttpStatus = require('http-status-codes') +const service = require('../services/SupportService') +const logger = require('../common/logger') + +/** + * Create challenge + * @param {Object} req the request + * @param {Object} res the response + */ +async function createRequest (req, res) { + logger.debug(`createRequest User: ${JSON.stringify(req.authUser)} - Body: ${JSON.stringify(req.body)}`) + const result = await service.createRequest(req.authUser, req.body) + res.status(HttpStatus.CREATED).send(result) +} + +module.exports = { + createRequest +} diff --git a/src/routes.js b/src/routes.js index ad4b1720..56683a5f 100644 --- a/src/routes.js +++ b/src/routes.js @@ -27,6 +27,15 @@ module.exports = { scopes: [CREATE, ALL] } }, + '/challenges/support-requests': { + post: { + controller: 'SupportController', + method: 'createRequest', + auth: 'jwt', + access: [constants.UserRoles.Admin, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], + scopes: [CREATE, ALL] + } + }, '/challenges/health': { get: { controller: 'HealthController', diff --git a/src/services/SupportService.js b/src/services/SupportService.js new file mode 100644 index 00000000..f1262cc2 --- /dev/null +++ b/src/services/SupportService.js @@ -0,0 +1,43 @@ +/** + * This service provides operations of support requests. + */ + +const _ = require('lodash') +const Joi = require('joi') +const helper = require('../common/helper') +const logger = require('../common/logger') + +/** + * Create a request in zendesk + * @param {Object} currentUser the current user + * @param {Object} request the request + * @returns {Object} the search result + */ +async function createRequest (currentUser, request) { + return await helper.submitZendeskRequest({ + requester: { + name: `${request.firstName} ${request.lastName}`, + email: request.email + }, + subject: `${request.isSelfService ? 'Self-Service customer request for' : ''} Challenge ID: ${request.challengeId}`, + comment: request.question + }) +} + +createRequest.schema = { + currentUser: Joi.any(), + request: Joi.object().keys({ + challengeId: Joi.optionalId(), + email: Joi.string().email().required(), + firstName: Joi.string().required(), + lastName: Joi.string().required(), + isSelfService: Joi.boolean(), + question: Joi.string().required() + }) +} + +module.exports = { + createRequest +} + +logger.buildService(module.exports) From 458a70e143614d8aa9d0bba43f06593b64420446 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 27 Jan 2022 15:45:23 +0200 Subject: [PATCH 70/83] properly format request body for zendesk --- src/services/SupportService.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/SupportService.js b/src/services/SupportService.js index f1262cc2..61c7a177 100644 --- a/src/services/SupportService.js +++ b/src/services/SupportService.js @@ -20,7 +20,9 @@ async function createRequest (currentUser, request) { email: request.email }, subject: `${request.isSelfService ? 'Self-Service customer request for' : ''} Challenge ID: ${request.challengeId}`, - comment: request.question + comment: { + body: request.question + } }) } From e5e65a8870b0359b064f7958e789b42c9e06e60c Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 27 Jan 2022 15:58:42 +0200 Subject: [PATCH 71/83] support custom self_service tag on zendesk requests --- config/default.js | 3 ++- src/services/SupportService.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index 3f823df2..a1473835 100644 --- a/config/default.js +++ b/config/default.js @@ -102,5 +102,6 @@ module.exports = { SELF_SERVICE_APP_URL: process.env.SELF_SERVICE_APP_URL || 'https://platform.topcoder-dev.com/self-service', ZENDESK_API_TOKEN: process.env.ZENDESK_API_TOKEN || '', - ZENDESK_API_URL: process.env.ZENDESK_API_URL || '' + ZENDESK_API_URL: process.env.ZENDESK_API_URL || '', + ZENDESK_CUSTOM_FIELD_TAG_ID: process.env.ZENDESK_CUSTOM_FIELD_TAG_ID } diff --git a/src/services/SupportService.js b/src/services/SupportService.js index 61c7a177..894e255c 100644 --- a/src/services/SupportService.js +++ b/src/services/SupportService.js @@ -4,6 +4,7 @@ const _ = require('lodash') const Joi = require('joi') +const config = require('config') const helper = require('../common/helper') const logger = require('../common/logger') @@ -22,7 +23,15 @@ async function createRequest (currentUser, request) { subject: `${request.isSelfService ? 'Self-Service customer request for' : ''} Challenge ID: ${request.challengeId}`, comment: { body: request.question - } + }, + ...(request.isSelfService && config.ZENDESK_CUSTOM_FIELD_TAG_ID ? { + custom_fields: [ + { + id: _.toNumber(config.ZENDESK_CUSTOM_FIELD_TAG_ID), + value: 'self_service' + } + ] + } : {}) }) } From bad7d7c277b1f7336586a6828a9f16b586b4a9c6 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 27 Jan 2022 17:07:16 +0200 Subject: [PATCH 72/83] auto activate project after reviewed --- src/common/helper.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index 237caa27..fc73d923 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -561,7 +561,7 @@ async function activateProject (projectId, currentUser, name, description) { } const token = await getM2MToken() const url = `${config.PROJECTS_API_URL}/${projectId}` - await axios.patch(url, { + const res = await axios.patch(url, { name, description, status: 'active', @@ -575,6 +575,11 @@ async function activateProject (projectId, currentUser, name, description) { paymentStatus: payment.status } }, { headers: { Authorization: `Bearer ${token}` } }) + + if (res.data && res.data.status !== 'active') { + // auto activate if the project goes in reviewed state + await activateProject(projectId, currentUser, name, description) + } } /** From 162121f2ee9674819dfcfb07f27c170ebd16f999 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 27 Jan 2022 17:10:14 +0200 Subject: [PATCH 73/83] correct project status --- src/common/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index fc73d923..0e46ecce 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -576,7 +576,7 @@ async function activateProject (projectId, currentUser, name, description) { } }, { headers: { Authorization: `Bearer ${token}` } }) - if (res.data && res.data.status !== 'active') { + if (res.data && res.data.status === 'reviewed') { // auto activate if the project goes in reviewed state await activateProject(projectId, currentUser, name, description) } From 7eee3778a46cc65f239e39afb246160da1aadcac Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Sun, 30 Jan 2022 13:15:32 +0200 Subject: [PATCH 74/83] allow null for selfServiceCopilot --- src/services/ChallengeService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 7c2817ed..aaf2c7a9 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -2062,7 +2062,7 @@ fullyUpdateChallenge.schema = { pureV5Task: Joi.boolean(), pureV5: Joi.boolean(), selfService: Joi.boolean(), - selfServiceCopilot: Joi.string(), + selfServiceCopilot: Joi.string().allow(null), }).unknown(true), cancelReason: Joi.string(), billing: Joi.object().keys({ @@ -2169,7 +2169,7 @@ partiallyUpdateChallenge.schema = { pureV5Task: Joi.boolean(), pureV5: Joi.boolean(), selfService: Joi.boolean(), - selfServiceCopilot: Joi.string() + selfServiceCopilot: Joi.string().allow(null) }).unknown(true), cancelReason: Joi.string(), task: Joi.object().keys({ From 1dcf9a063642c379dc77873530b47bd5cbcd3058 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Sun, 30 Jan 2022 16:26:10 +0200 Subject: [PATCH 75/83] add support URL to email data --- src/common/helper.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/helper.js b/src/common/helper.js index 0e46ecce..5ff69f79 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -1161,7 +1161,10 @@ async function sendSelfServiceNotification (type, recipients, data) { from: config.EMAIL_FROM, recipients: [...recipients], cc: [...constants.SelfServiceNotificationSettings[type].cc], - data, + data: { + ...data, + supportUrl: `${config.SELF_SERVICE_APP_URL}/support` + }, sendgridTemplateId: constants.SelfServiceNotificationSettings[type].sendgridTemplateId, version: 'v3' } From 13845541df24a82a4c166239572eb9bd5f892ba8 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Sun, 30 Jan 2022 16:27:23 +0200 Subject: [PATCH 76/83] make /challenges/support-requests public --- src/routes.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/routes.js b/src/routes.js index 56683a5f..886ad765 100644 --- a/src/routes.js +++ b/src/routes.js @@ -30,10 +30,7 @@ module.exports = { '/challenges/support-requests': { post: { controller: 'SupportController', - method: 'createRequest', - auth: 'jwt', - access: [constants.UserRoles.Admin, constants.UserRoles.SelfServiceCustomer, constants.UserRoles.Copilot, constants.UserRoles.Manager, constants.UserRoles.User], - scopes: [CREATE, ALL] + method: 'createRequest' } }, '/challenges/health': { From 150bdc3954bde5f1d248fa68cd2e0bcb526c3440 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 31 Jan 2022 12:37:01 +0200 Subject: [PATCH 77/83] add a QA email for testing on cc --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index a1473835..8d2f5c10 100644 --- a/config/default.js +++ b/config/default.js @@ -97,7 +97,7 @@ module.exports = { }, EMAIL_FROM: process.env.EMAIL_FROM || 'no-reply@topcoder.com', - SELF_SERVICE_EMAIL_CC_ACCOUNTS: process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS ? _.map(process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS.split(','), email => ({ email })) : [], + SELF_SERVICE_EMAIL_CC_ACCOUNTS: process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS ? _.map(process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS.split(','), email => ({ email })) : ['sathya.jayabal@gmail.com'], SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || ['TCConnCopilot', 'sstestcopilot'], SELF_SERVICE_APP_URL: process.env.SELF_SERVICE_APP_URL || 'https://platform.topcoder-dev.com/self-service', From b12a4af081c361b6ffdbee1a4e09af6b41055ebc Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Tue, 1 Feb 2022 12:17:19 +0200 Subject: [PATCH 78/83] performance improvements and fix access checks on self service challenges --- src/common/helper.js | 12 ++++++------ src/services/ChallengeService.js | 12 +++++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 5ff69f79..583cc386 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -1004,14 +1004,14 @@ async function ensureAccessibleByGroupsAccess (currentUser, challenge) { */ async function _ensureAccessibleForTaskChallenge (currentUser, challenge) { let challengeResourceIds - if (currentUser) { - if (!currentUser.isMachine) { - const challengeResources = await getChallengeResources(challenge.id) - challengeResourceIds = _.map(challengeResources, r => _.toString(r.memberId)) - } - } // Check if challenge is task and apply security rules if (_.get(challenge, 'task.isTask', false) && _.get(challenge, 'task.isAssigned', false)) { + if (currentUser) { + if (!currentUser.isMachine) { + const challengeResources = await getChallengeResources(challenge.id) + challengeResourceIds = _.map(challengeResources, r => _.toString(r.memberId)) + } + } const canAccesChallenge = _.isUndefined(currentUser) ? false : currentUser.isMachine || hasAdminRole(currentUser) || _.includes((challengeResourceIds || []), _.toString(currentUser.userId)) if (!canAccesChallenge) { throw new errors.ForbiddenError(`You don't have access to view this challenge`) diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index aaf2c7a9..46a43f17 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -580,9 +580,15 @@ async function searchChallenges (currentUser, criteria) { should: [ { bool: { must_not: { exists: { field: 'legacy.selfService' } } } }, ...(currentUser ? [ - { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.New } } } }, - { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.Draft } } } }, - { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.Approved } } } }, + { + bool: { + must: [ + { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.New } } } }, + { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.Draft } } } }, + { bool: { must_not: { match_phrase: { 'status': constants.challengeStatuses.Approved } } } }, + ] + } + }, { bool: { must: { match_phrase: { 'createdBy': currentUser.handle } } } }, ] : []) ] From 90882b45545f798931c2328353793c4148f131ea Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 2 Feb 2022 17:32:32 +0200 Subject: [PATCH 79/83] fix issue with copilots not being able to approve SS challenges and change project desc to work item summary --- src/common/helper.js | 3 +++ src/services/ChallengeService.js | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/common/helper.js b/src/common/helper.js index 583cc386..15701a9a 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -792,6 +792,9 @@ async function ensureProjectExist (projectId, currentUser) { if (currentUser.isMachine || hasAdminRole(currentUser)) { return res.data } + if (_.get(res, 'data.type') === 'self-service' && _.includes(config.SELF_SERVICE_WHITELIST_HANDLES, currentUser.handle.toLowerCase())) { + return res.data + } if (!_.find(_.get(res, 'data.members', []), m => _.toString(m.userId) === _.toString(currentUser.userId))) { throw new errors.ForbiddenError(`You don't have access to project with ID: ${projectId}`) } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 46a43f17..a3fb1e7a 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -139,7 +139,7 @@ async function searchChallenges (currentUser, criteria) { 'updatedBy' ] - const includeSelfService = currentUser && (currentUser.isMachine || helper.hasAdminRole(currentUser) || _.includes(config.SELF_SERVICE_WHITELIST_HANDLES, currentUser.handle)) + const includeSelfService = currentUser && (currentUser.isMachine || helper.hasAdminRole(currentUser) || _.includes(config.SELF_SERVICE_WHITELIST_HANDLES, currentUser.handle.toLowerCase())) const includedTrackIds = _.isArray(criteria.trackIds) ? criteria.trackIds : [] @@ -929,7 +929,7 @@ async function createChallenge (currentUser, challenge, userToken) { if(challenge.legacy.selfService) { if(!challenge.projectId) { const selfServiceProjectName = `Self service - ${currentUser.handle} - ${challenge.name}` - challenge.projectId = await helper.createSelfServiceProject(selfServiceProjectName, challenge.description, config.NEW_SELF_SERVICE_PROJECT_TYPE, userToken) + challenge.projectId = await helper.createSelfServiceProject(selfServiceProjectName, "N/A", config.NEW_SELF_SERVICE_PROJECT_TYPE, userToken) } } else if (!challenge.projectId) { throw new errors.BadRequestError('The projectId is required') @@ -1419,8 +1419,11 @@ async function update (currentUser, challengeId, data, isFull) { if (challenge.legacy.selfService && (data.status === constants.challengeStatuses.Approved || data.status === constants.challengeStatuses.Active) && challenge.status !== constants.challengeStatuses.Active) { try { const selfServiceProjectName = `Self service - ${challenge.createdBy} - ${challenge.name}` - await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, challenge.description) - sendActivationEmail = true + const workItemSummary = _.get(_.find(_.get(challenge, 'metadata', []), m => m.name === 'websitePurpose.description'), 'value', 'N/A') + await helper.activateProject(challenge.projectId, currentUser, selfServiceProjectName, workItemSummary) + if (data.status === constants.challengeStatuses.Active) { + sendActivationEmail = true + } } catch (e) { await update( currentUser, From 68258c7c10f397783b7c253322bf8f7c36949e69 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 3 Feb 2022 02:06:56 +0200 Subject: [PATCH 80/83] implement endpoint to trigger notifications --- src/controllers/ChallengeController.js | 13 ++++++++++- src/routes.js | 9 ++++++++ src/services/ChallengeService.js | 30 +++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/controllers/ChallengeController.js b/src/controllers/ChallengeController.js index cefd16db..8d8cee62 100644 --- a/src/controllers/ChallengeController.js +++ b/src/controllers/ChallengeController.js @@ -28,6 +28,16 @@ async function createChallenge (req, res) { res.status(HttpStatus.CREATED).send(result) } +/** + * send notifications + * @param {Object} req the request + * @param {Object} res the response + */ +async function sendNotifications (req, res) { + const result = await service.sendNotifications(req.authUser, req.params.challengeId) + res.status(HttpStatus.CREATED).send(result) +} + /** * Get challenge * @param {Object} req the request @@ -88,5 +98,6 @@ module.exports = { fullyUpdateChallenge, partiallyUpdateChallenge, deleteChallenge, - getChallengeStatistics + getChallengeStatistics, + sendNotifications } diff --git a/src/routes.js b/src/routes.js index 886ad765..3c778369 100644 --- a/src/routes.js +++ b/src/routes.js @@ -73,6 +73,15 @@ module.exports = { method: 'getChallengeStatistics', } }, + '/challenges/:challengeId/notifications': { + post: { + controller: 'ChallengeController', + method: 'sendNotifications', + auth: 'jwt', + access: [constants.UserRoles.Admin, constants.UserRoles.Copilot], + scopes: [CREATE, ALL] + } + }, '/challenge-types': { get: { controller: 'ChallengeTypeController', diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index a3fb1e7a..a140e62c 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -1959,6 +1959,33 @@ async function update (currentUser, challengeId, data, isFull) { return challenge } +/** + * Send notifications + * @param {Object} currentUser the current use + * @param {String} challengeId the challenge id + */ +async function sendNotifications (currentUser, challengeId) { + const challenge = await getChallenge(currentUser, challengeId) + const creator = await helper.getMemberByHandle(challenge.createdBy) + if (challenge.status === constants.challengeStatuses.Completed) { + await helper.sendSelfServiceNotification( + constants.SelfServiceNotificationTypes.WORK_COMPLETED, + [{ email: creator.email }], + { + handle: creator.handle, + workItemName: challenge.name, + workItemUrl: `${config.SELF_SERVICE_APP_URL}/work-items/${challenge.id}?tab=solutions` + } + ) + return { type: constants.SelfServiceNotificationTypes.WORK_COMPLETED } + } +} + +sendNotifications.schema = { + currentUser: Joi.any(), + challengeId: Joi.id() +} + /** * Remove unwanted properties from the challenge object * @param {Object} challenge the challenge object @@ -2295,7 +2322,8 @@ module.exports = { fullyUpdateChallenge, partiallyUpdateChallenge, deleteChallenge, - getChallengeStatistics + getChallengeStatistics, + sendNotifications } logger.buildService(module.exports) From 85b7ce03e9c9d3f689e46604f025a3564348f9a0 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 3 Feb 2022 13:57:57 +0200 Subject: [PATCH 81/83] add priority on zendesk requests --- config/default.js | 3 ++- src/services/SupportService.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 8d2f5c10..aa351cbb 100644 --- a/config/default.js +++ b/config/default.js @@ -103,5 +103,6 @@ module.exports = { ZENDESK_API_TOKEN: process.env.ZENDESK_API_TOKEN || '', ZENDESK_API_URL: process.env.ZENDESK_API_URL || '', - ZENDESK_CUSTOM_FIELD_TAG_ID: process.env.ZENDESK_CUSTOM_FIELD_TAG_ID + ZENDESK_CUSTOM_FIELD_TAG_ID: process.env.ZENDESK_CUSTOM_FIELD_TAG_ID, + ZENDESK_DEFAULT_PRIORITY: process.env.ZENDESK_DEFAULT_PRIORITY || 'high' } diff --git a/src/services/SupportService.js b/src/services/SupportService.js index 894e255c..ce6d9bd3 100644 --- a/src/services/SupportService.js +++ b/src/services/SupportService.js @@ -24,6 +24,7 @@ async function createRequest (currentUser, request) { comment: { body: request.question }, + priority: config.ZENDESK_DEFAULT_PRIORITY, ...(request.isSelfService && config.ZENDESK_CUSTOM_FIELD_TAG_ID ? { custom_fields: [ { From 713e041b9d4ce8218924c1b1240d37e254e516f2 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 3 Feb 2022 14:36:13 +0200 Subject: [PATCH 82/83] config clean up --- config/default.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/default.js b/config/default.js index aa351cbb..8bc3d7a8 100644 --- a/config/default.js +++ b/config/default.js @@ -87,8 +87,6 @@ module.exports = { NEW_SELF_SERVICE_PROJECT_TYPE: process.env.NEW_SELF_SERVICE_PROJECT_TYPE || 'self-service', - SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || [], - SENDGRID_TEMPLATES: { WORK_REQUEST_SUBMITTED: process.env.WORK_REQUEST_SUBMITTED || '', WORK_REQUEST_STARTED: process.env.WORK_REQUEST_STARTED || '', From 5c6d279bc1f80dbc07e0c68461f90de040b815d2 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 3 Feb 2022 15:18:11 +0200 Subject: [PATCH 83/83] parse whitelisted handles --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 8bc3d7a8..cacfd208 100644 --- a/config/default.js +++ b/config/default.js @@ -96,7 +96,7 @@ module.exports = { EMAIL_FROM: process.env.EMAIL_FROM || 'no-reply@topcoder.com', SELF_SERVICE_EMAIL_CC_ACCOUNTS: process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS ? _.map(process.env.SELF_SERVICE_EMAIL_CC_ACCOUNTS.split(','), email => ({ email })) : ['sathya.jayabal@gmail.com'], - SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES || ['TCConnCopilot', 'sstestcopilot'], + SELF_SERVICE_WHITELIST_HANDLES: process.env.SELF_SERVICE_WHITELIST_HANDLES ? process.env.SELF_SERVICE_WHITELIST_HANDLES.split(',') : ['TCConnCopilot', 'sstestcopilot'], SELF_SERVICE_APP_URL: process.env.SELF_SERVICE_APP_URL || 'https://platform.topcoder-dev.com/self-service', ZENDESK_API_TOKEN: process.env.ZENDESK_API_TOKEN || '',