Skip to content

Commit 9cf2722

Browse files
authored
[HUMAN App] feat: enable audino for everyone (#3680)
1 parent 398f13a commit 9cf2722

File tree

3 files changed

+36
-54
lines changed

3 files changed

+36
-54
lines changed

packages/apps/human-app/server/src/modules/jobs-discovery/jobs-discovery.controller.ts

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class JobsDiscoveryController {
3434
private readonly service: JobsDiscoveryService,
3535
private readonly environmentConfigService: EnvironmentConfigService,
3636
@InjectMapper() private readonly mapper: Mapper,
37-
) { }
37+
) {}
3838

3939
@Get('/jobs')
4040
@ApiOperation({
@@ -70,32 +70,33 @@ export class JobsDiscoveryController {
7070

7171
return (data?.id ?? 0 > 0)
7272
? {
73-
page: 0,
74-
page_size: 1,
75-
total_pages: 1,
76-
total_results: 0,
77-
results: [],
78-
}
73+
page: 0,
74+
page_size: 1,
75+
total_pages: 1,
76+
total_results: 0,
77+
results: [],
78+
}
7979
: {
80-
page: 0,
81-
page_size: 1,
82-
total_pages: 1,
83-
total_results: 1,
84-
results: [
85-
{
86-
chain_id: ChainId.POLYGON,
87-
escrow_address: 'thirstyfi-task',
88-
job_type: 'thirstyfi',
89-
job_description: 'Check job description at https://thirsty.fi/blog/campaign-human-protocol',
90-
reward_amount: '5 - 50',
91-
reward_token: 'USDT',
92-
status: JobStatus.ACTIVE,
93-
created_at: new Date().toISOString(),
94-
updated_at: new Date().toISOString(),
95-
qualifications: [],
96-
},
97-
],
98-
};
80+
page: 0,
81+
page_size: 1,
82+
total_pages: 1,
83+
total_results: 1,
84+
results: [
85+
{
86+
chain_id: ChainId.POLYGON,
87+
escrow_address: 'thirstyfi-task',
88+
job_type: 'thirstyfi',
89+
job_description:
90+
'Check job description at https://thirsty.fi/blog/campaign-human-protocol',
91+
reward_amount: '5 - 50',
92+
reward_token: 'USDT',
93+
status: JobStatus.ACTIVE,
94+
created_at: new Date().toISOString(),
95+
updated_at: new Date().toISOString(),
96+
qualifications: [],
97+
},
98+
],
99+
};
99100
}
100101

101102
return {

packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.controller.ts

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,24 @@ import {
77
HttpException,
88
HttpStatus,
99
Query,
10-
Request,
1110
} from '@nestjs/common';
12-
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
11+
import {
12+
ApiBearerAuth,
13+
ApiOkResponse,
14+
ApiOperation,
15+
ApiTags,
16+
} from '@nestjs/swagger';
1317
import { EnvironmentConfigService } from '../../common/config/environment-config.service';
14-
import { RequestWithUser } from '../../common/interfaces/jwt';
1518
import {
1619
DiscoveredOracle,
1720
GetOraclesCommand,
1821
GetOraclesQuery,
1922
} from './model/oracle-discovery.model';
2023
import { OracleDiscoveryService } from './oracle-discovery.service';
21-
import Environment from '../../common/utils/environment';
2224
import { ChainId } from '@human-protocol/sdk';
2325

2426
@ApiTags('Oracle-Discovery')
27+
@ApiBearerAuth()
2528
@Controller()
2629
export class OracleDiscoveryController {
2730
constructor(
@@ -38,7 +41,6 @@ export class OracleDiscoveryController {
3841
@Header('Cache-Control', 'private, max-age=60')
3942
@Get('/oracles')
4043
public async getOracles(
41-
@Request() req: RequestWithUser,
4244
@Query() query: GetOraclesQuery,
4345
): Promise<DiscoveredOracle[]> {
4446
if (!this.environmentConfigService.jobsDiscoveryFlag) {
@@ -76,25 +78,6 @@ export class OracleDiscoveryController {
7678
});
7779
oracles.push(thisrtyOracle);
7880

79-
if (!Environment.isProduction()) {
80-
return oracles;
81-
}
82-
83-
const isAudinoAvailableForUser = (req?.user?.qualifications ?? []).includes(
84-
'audino',
85-
);
86-
87-
/**
88-
* TODO: remove filtering logic when Audino available for everyone
89-
*/
90-
return oracles.filter((oracle) => {
91-
const isAudinoOracle = oracle.jobTypes.includes('audio_transcription');
92-
93-
if (isAudinoOracle) {
94-
return isAudinoAvailableForUser;
95-
} else {
96-
return true;
97-
}
98-
});
81+
return oracles;
9982
}
10083
}

packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.controller.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ describe('OracleDiscoveryController', () => {
8080

8181
(configServiceMock as any).jobsDiscoveryFlag = false;
8282

83-
await expect(
84-
controller.getOracles({ qualifications: [] } as any, dtoFixture),
85-
).rejects.toThrow(
83+
await expect(controller.getOracles(dtoFixture)).rejects.toThrow(
8684
new HttpException(
8785
'Oracles discovery is disabled',
8886
HttpStatus.FORBIDDEN,

0 commit comments

Comments
 (0)