Skip to content

Commit

Permalink
Tenders APi impl (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil-tarento authored Jun 21, 2024
1 parent c20919e commit c320707
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/proxies_v8/proxies_v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@ proxiesV8.use('/careers/*',
proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`)
)

proxiesV8.use('/tenders/*',
proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`)
)
export interface IUserProfile {
channel: string
firstName: string
Expand Down
15 changes: 11 additions & 4 deletions src/publicApi_v8/publicApiV8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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')
}
})
}
32 changes: 32 additions & 0 deletions src/utils/whitelistApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3203,6 +3203,34 @@ export const API_LIST = {
ROLE.SPV_PUBLISHER,
],
},
'/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,
],
},
},
URL_PATTERN:
[
Expand Down Expand Up @@ -3613,5 +3641,9 @@ export const API_LIST = {
'/proxies/v8/playList/update',
'/proxies/v8/playList/search',
'/proxies/v8/playList/delete/:do_id',
'/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',
],
}

0 comments on commit c320707

Please sign in to comment.