Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes for data-emitter API #271

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ingestion/controller/ingestion.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class IngestionController {
}
}
@Post('/data-emitter')
@UseGuards(JwtGuard)
// @UseGuards(JwtGuard)
async fetchData(@Body()inputData:RawDataPullBody ,@Res()response: Response,@Req() request: Request){
try {
const result: any = await this.nvskService.getEmitterData(inputData?.program_names, request);
Expand Down
11 changes: 9 additions & 2 deletions src/ingestion/services/nvsk-api/nvsk-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ export class NvskApiService {
"program_names": names
}
try {
let jwtToken;
const tokenResult = await this.httpService.get(process.env.URL + '/generatejwt')
if(tokenResult.status === 200){
jwtToken = tokenResult?.data
}
jwtToken = 'Bearer'+' '+jwtToken;
const headers = {
Authorization: request.headers.authorization
Authorization: jwtToken
};
const result = await this.httpService.post(process.env.NVSK_URL + '/getRawData', body,{headers: headers})
if (result?.data['code'] === 200) {
Expand Down Expand Up @@ -117,9 +123,10 @@ export class NvskApiService {
async scheduleAdapters(){
try {
let url = `${process.env.SPEC_URL}` + '/schedule'

let scheduleBody = {
"processor_group_name": "Run_adapters",
"scheduled_at": "* 0/7 * * * ?"
"scheduled_at": " 0 */5 * * * ?"
}
let scheduleResult = await this.httpService.post(url, scheduleBody)
console.log('The schedule result is:',scheduleResult?.data['message']);
Expand Down