Skip to content

Commit 0f19dfe

Browse files
committed
feat: block auth users for now
1 parent 28ea500 commit 0f19dfe

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

__tests__/schema/opportunity.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5151,4 +5151,22 @@ describe('mutation parseOpportunity', () => {
51515151
expect(body.errors[0].extensions.code).toBe('GRAPHQL_VALIDATION_FAILED');
51525152
expect(body.errors[0].message).toBe('File type not supported');
51535153
});
5154+
5155+
it('should not allow authenticated users to parse opportunity', async () => {
5156+
loggedUser = '1';
5157+
5158+
const res = await client.mutate(MUTATION, {
5159+
variables: {
5160+
payload: {
5161+
url: 'https://example.com/opportunity',
5162+
},
5163+
},
5164+
});
5165+
5166+
expect(res.errors).toBeDefined();
5167+
expect(res.errors?.[0].extensions.code).toBe('FORBIDDEN');
5168+
expect(res.errors?.[0].message).toBe(
5169+
'Not available for authenticated users yet',
5170+
);
5171+
});
51545172
});

src/schema/opportunity.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,10 @@ export const resolvers: IResolvers<unknown, BaseContext> = traceResolvers<
16191619
ctx: Context,
16201620
info,
16211621
): Promise<GQLOpportunity> => {
1622+
if (ctx.userId) {
1623+
throw new ForbiddenError('Not available for authenticated users yet');
1624+
}
1625+
16221626
const parseOpportunityPayload =
16231627
await parseOpportunitySchema.parseAsync(payload);
16241628

0 commit comments

Comments
 (0)