From 2250362d1cd803bb59d1ca51cc9051bc48e48455 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Tue, 5 Jul 2022 12:57:47 +0300 Subject: [PATCH] Revert "Feature/projectid" --- config/default.js | 3 +- docs/swagger.yaml | 36 ++---------------------- src/controllers/apiController.js | 20 +------------ src/routes.js | 6 ---- src/services/challengeInformixService.js | 16 ----------- src/services/challengeService.js | 5 ---- 6 files changed, 4 insertions(+), 82 deletions(-) diff --git a/config/default.js b/config/default.js index bfb6a2a..12ce9e9 100644 --- a/config/default.js +++ b/config/default.js @@ -227,6 +227,5 @@ module.exports = { } }, - COPILOT_PAYMENT_TYPE: process.env.COPILOT_PAYMENT_TYPE || 'copilot', - MARATHON_MATCH_PROJECT_INFO_TYPE_ID: 56 + COPILOT_PAYMENT_TYPE: process.env.COPILOT_PAYMENT_TYPE || 'copilot' } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f77234a..693020c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -122,7 +122,7 @@ paths: summary: Delete a challenge's migration record, sync record, challenge entry, and resources tags: - Migration - operationId: getChallenge + operationId: destroyChallenge security: - bearer: [] responses: @@ -137,29 +137,6 @@ paths: 500: $ref: '#/definitions/ServerError' - '/challenge-migration/getChallengeProjectId/{roundId}': - get: - parameters: - - name: roundId - in: path - description: The roundId of record - required: true - type: string - summary: get the projectId by roundId - tags: - - Migration - operationId: Challenge - security: - - bearer: [] - responses: - 200: - schema: - $ref: '#/definitions/ProjectIdObject' - 400: - $ref: '#/definitions/BadRequest' - 500: - $ref: '#/definitions/ServerError' - '/challenge-migration/sync': get: summary: Get Sync status. @@ -225,14 +202,6 @@ paths: definitions: - ProjectIdObject: - description: The project id of challenge - type: object - properties: - projectId: - type: number - description: The ProjectId - example: 23234 MigrationStatusObject: description: The Migration Status Object. type: object @@ -315,5 +284,4 @@ definitions: message: type: string description: The conflict error message. - example: Creating a resource with a name already exists. - + example: Creating a resource with a name already exists. \ No newline at end of file diff --git a/src/controllers/apiController.js b/src/controllers/apiController.js index c8a1831..a0d59ed 100644 --- a/src/controllers/apiController.js +++ b/src/controllers/apiController.js @@ -184,23 +184,6 @@ async function convertV4TrackToV5 (req, res) { return res.json(translationService.convertV4TrackToV5(track, subTrack, isTask, tags)) } -async function getChallengeProjectId (req, res) { - const roundId = _.get(req, 'params.roundId') - if (!roundId) { - return res.status(400).json({ message: `Invalid roundId: ${roundId}` }) - } - try { - const result = await challengeService.getChallengeProjectId(roundId) - if (result.length > 0) { - return res.json({ projectId: result[0].project_id}) - } - return res.status(404).json({ message: 'projectId Not found' }) - } catch (e) { - logger.debug(`Error in GetChallengeProjectId: ${e}`) - return res.status(400).json({ message: `Unable to GetChallengeProjectId: ${JSON.stringify(e)}` }) - } -} - module.exports = { queueForMigration, getMigrationStatus, @@ -209,6 +192,5 @@ module.exports = { getSyncStatus, destroyChallenge, convertV5TrackToV4, - convertV4TrackToV5, - getChallengeProjectId + convertV4TrackToV5 } diff --git a/src/routes.js b/src/routes.js index 3be30de..1a1c7cb 100644 --- a/src/routes.js +++ b/src/routes.js @@ -62,11 +62,5 @@ module.exports = { auth: 'jwt', scopes: [CHALLENGES.WRITE, CHALLENGES.ALL] } - }, - '/challenge-migration/getChallengeProjectId/:roundId': { - get: { - controller: 'apiController', - method: 'getChallengeProjectId' - } } } diff --git a/src/services/challengeInformixService.js b/src/services/challengeInformixService.js index d04305e..2343bab 100644 --- a/src/services/challengeInformixService.js +++ b/src/services/challengeInformixService.js @@ -1,24 +1,9 @@ const _ = require('lodash') -const config = require('config') const logger = require('../util/logger') const helper = require('../util/helper') // const getErrorService = require('./errorService') const { executeQueryAsync } = require('../util/informixWrapper') -/** - * Get projectId - * @param {Number} roundId the Round ID - */ -async function getProjectIdFromIfx (roundId) { - const sql = `SELECT limit 1 - project_id - FROM project_info - WHERE value = ${roundId} and project_info_type_id = ${config.MARATHON_MATCH_PROJECT_INFO_TYPE_ID} - ` - // logger.info(`projectId SQL: ${sql}`) - return execQuery(sql) -} - /** * Get effort hours for a legacyId * @param {Number} legacyId the legacy ID @@ -695,7 +680,6 @@ async function execQuery (sql) { module.exports = { execQuery, getChallengeInfo, - getProjectIdFromIfx, getMetadataFromIfx, getChallengesFromIfx, getChallengeIdsFromIfx, diff --git a/src/services/challengeService.js b/src/services/challengeService.js index af30ad4..8576a20 100644 --- a/src/services/challengeService.js +++ b/src/services/challengeService.js @@ -942,10 +942,6 @@ async function getChallengeSubmissionsFromV5API (challengeId, type) { return { results: [], total: 0 } } -async function getChallengeProjectId (roundId) { - return challengeInformixService.getProjectIdFromIfx(roundId) -} - module.exports = { save, buildV5Challenge, @@ -966,6 +962,5 @@ module.exports = { getMMatchFromV4API, getChallengeTypesFromDynamo, getChallengeSubmissionsFromV5API, - getChallengeProjectId, mapTimelineTemplateId }