From fb7b94709a9bde7d22e4c3bd32b8ff24f4c6c2cd Mon Sep 17 00:00:00 2001 From: Sahil-tarento <140611066+Sahil-tarento@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:50:18 +0530 Subject: [PATCH] 4.8.15 dev v2 (#388) * content-creator role add for the upate status api (#376) * Assessment SavePoint API (#377) Assessment SavePoint API * Added ui-proxy for V2 APIs of Playlist * kong for v2 playlist APIs * Added access role content creator for V2 update API * Added new role for update API * ui-proxy change for v2 read API * ui-proxy for v2 read * cios ui-proxies added * cios roles updated * ciosIntegration APIs added (#384) * cios-integration apis added * cios-integration apis added * Tenders APi impl * 4.8.15 dev v2 (#387) * added configurations for bulk user create and update using csv * added configurations for bulk user create and update using csv --------- Co-authored-by: shankaragoudab <140387294+shankaragoudab@users.noreply.github.com> Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com> Co-authored-by: ruksanasemeir Co-authored-by: arpithasureshappa Co-authored-by: Sharath Prasad Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com> --- src/proxies_v8/proxies_v8.ts | 16 +++- src/publicApi_v8/publicApiV8.ts | 15 +++- src/utils/whitelistApis.ts | 150 +++++++++++++++++++++++++++++++- 3 files changed, 175 insertions(+), 6 deletions(-) diff --git a/src/proxies_v8/proxies_v8.ts b/src/proxies_v8/proxies_v8.ts index 9cf90924..0e59aeb8 100644 --- a/src/proxies_v8/proxies_v8.ts +++ b/src/proxies_v8/proxies_v8.ts @@ -392,7 +392,7 @@ proxiesV8.use('/dashboard/*', proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) ) // tslint:disable-next-line:max-line-length -proxiesV8.post(['/user/v1/bulkupload', '/storage/profilePhotoUpload/*', '/workflow/admin/transition/bulkupdate', '/cloud-services/mlcore/v1/files/upload', '/calendar/v1/bulkUpload', '/storage/orgStoreUpload'], (req, res) => { +proxiesV8.post(['/user/v1/bulkupload', '/storage/profilePhotoUpload/*', '/workflow/admin/transition/bulkupdate', '/cloud-services/mlcore/v1/files/upload', '/calendar/v1/bulkUpload', '/storage/orgStoreUpload', 'workflow/admin/v2/transition/bulkupdate', '/user/v2/bulkupload'], (req, res) => { if (req.files && req.files.data) { const url = removePrefix('/proxies/v8', req.originalUrl) const file: UploadedFile = req.files.data as UploadedFile @@ -729,6 +729,10 @@ proxiesV8.use('/assessment/save/', proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) ) +proxiesV8.use('/assessment/savepoint/', + proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) +) + proxiesV8.use('/announcements/*', proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) ) @@ -937,6 +941,16 @@ proxiesV8.use('/orgBookmark/*', proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) ) +proxiesV8.use('/cios/*', + proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) +) + +proxiesV8.use('/ciosIntegration/*', + proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) +) +proxiesV8.use('/tenders/*', + proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`) +) export interface IUserProfile { channel: string firstName: string diff --git a/src/publicApi_v8/publicApiV8.ts b/src/publicApi_v8/publicApiV8.ts index 329cd461..f15e3fd4 100644 --- a/src/publicApi_v8/publicApiV8.ts +++ b/src/publicApi_v8/publicApiV8.ts @@ -72,13 +72,20 @@ publicApiV8.use('/halloffame/read', proxyCreatorRoute(express.Router(), CONSTANT publicApiV8.use('/playlist', youtubePlaylist) -// tslint:disable-next-line: all publicApiV8.get('/careers/list', async (_, res) => { + await fetchList('Jobs', res) + }) + +publicApiV8.get('/tenders/list', async (_, res) => { + await fetchList('Tenders', res) + }) + +const fetchList = async (resourceCategoryString: string, res: express.Response) => { const reqBody = { request: { facets: ['name', 'source', 'position'], filters: { - resourceCategory: 'Jobs', + resourceCategory: resourceCategoryString, status: ['Live'], }, limit: 500, @@ -102,7 +109,7 @@ publicApiV8.get('/careers/list', async (_, res) => { res.status(200).send(response.data) } } catch (error) { - logError('Failed to get carrer listing. Error : ' + error) + logError(`Failed to get ${resourceCategoryString} listing. Error: ${error}`) res.status(500).send('Internal Server Error') } -}) +} diff --git a/src/utils/whitelistApis.ts b/src/utils/whitelistApis.ts index 06b06cde..4055a14d 100644 --- a/src/utils/whitelistApis.ts +++ b/src/utils/whitelistApis.ts @@ -3187,6 +3187,7 @@ export const API_LIST = { ROLE.MDO_ADMIN, ROLE.MDO_LEADER, ROLE.SPV_PUBLISHER, + ROLE.CONTENT_CREATOR, ], }, '/proxies/v8/playList/search': { @@ -3285,6 +3286,7 @@ export const API_LIST = { ROLE.MDO_ADMIN, ROLE.MDO_LEADER, ROLE.SPV_ADMIN, + ROLE.CONTENT_CREATOR, ], }, '/proxies/v8/orgBookmark/v1/create': { @@ -3380,7 +3382,137 @@ export const API_LIST = { ROLE.MDO_LEADER, ROLE.SPV_ADMIN, ], - }, + }, + '/proxies/v8/assessment/savepoint': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.PUBLIC, + ], + }, + '/proxies/v8/playList/v2/create': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ROLE.MDO_ADMIN, + ROLE.MDO_LEADER, + ROLE.SPV_PUBLISHER, + ], + }, + '/proxies/v8/playList/v2/update': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ROLE.MDO_ADMIN, + ROLE.MDO_LEADER, + ROLE.SPV_PUBLISHER, + ROLE.CONTENT_CREATOR, + ], + }, + '/proxies/v8/playList/v2/read/:id/:playListId/:orgId': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.PUBLIC, + ], + }, + '/proxies/v8/cios/v1/onboardContent': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ROLE.MDO_ADMIN, + ROLE.CBP_ADMIN, + ], + }, + '/proxies/v8/cios/v1/content/read/:contentId': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.PUBLIC, + ], + }, + '/proxies/v8/cios/v1/search/content': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.PUBLIC, + ], + }, + '/proxies/v8/cios/v1/content/delete/:contentId': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ROLE.MDO_ADMIN, + ROLE.CBP_ADMIN, + ], + }, + '/proxies/v8/ciosIntegration/v1/loadContentFromExcel': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ROLE.MDO_ADMIN, + ROLE.CBP_ADMIN, + ], + }, + '/proxies/v8/ciosIntegration/v1/readAllContentFromDb': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ROLE.MDO_ADMIN, + ROLE.CBP_ADMIN, + ], + }, + '/proxies/v8/tenders/v4/read/:do_id': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.PUBLIC, + ], + }, + '/proxies/v8/tenders/v4/publish/:do_id': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ], + }, + '/proxies/v8/tenders/v4/create': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ], + }, + '/proxies/v8/tenders/v4/update/:do_id': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.SPV_ADMIN, + ], + }, + '/proxies/v8/user/v2/bulkupload': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.MDO_ADMIN, + ROLE.MDO_LEADER, + ], + }, + '/proxies/v8/workflow/admin/v2/transition/bulkupdate': { + checksNeeded: [CHECK.ROLE], + // tslint:disable-next-line: object-literal-sort-keys + ROLE_CHECK: [ + ROLE.MDO_ADMIN, + ROLE.MDO_LEADER, + ], + }, + }, URL_PATTERN: [ @@ -3814,5 +3946,21 @@ export const API_LIST = { '/proxies/v8/announcements/v1/search', '/proxies/v8/announcements/v1/read/:id', '/proxies/v8/announcements/v1/delete/:id', + '/proxies/v8/assessment/savepoint', + '/proxies/v8/playList/v2/create', + '/proxies/v8/playList/v2/update', + '/proxies/v8/playList/v2/read/:id/:playListId/:orgId', + '/proxies/v8/cios/v1/onboardContent', + '/proxies/v8/cios/v1/content/read/:contentId', + '/proxies/v8/cios/v1/search/content', + '/proxies/v8/cios/v1/content/delete/:contentId', + '/proxies/v8/ciosIntegration/v1/loadContentFromExcel', + '/proxies/v8/ciosIntegration/v1/readAllContentFromDb', + '/proxies/v8/tenders/v4/read/:do_id', + '/proxies/v8/tenders/v4/publish/:do_id', + '/proxies/v8/tenders/v4/create', + '/proxies/v8/tenders/v4/update/:do_id', + '/proxies/v8/user/v2/bulkupload', + '/proxies/v8/workflow/admin/v2/transition/bulkupdate' ], }