Skip to content

Commit 827e7cc

Browse files
committed
Submissions API data import
1 parent df637ce commit 827e7cc

File tree

14 files changed

+1284
-757
lines changed

14 files changed

+1284
-757
lines changed

mock/jwt.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import * as jwt from 'jsonwebtoken';
2+
import { Scope } from '../src/shared/enums/scopes.enum';
3+
import { UserRole } from '../src/shared/enums/userRole.enum';
4+
5+
const commonFields = {
6+
exp: 1845393226,
7+
iss: 'https://topcoder-dev.com'
8+
};
9+
10+
const authSecret = 'secret';
11+
12+
const adminPayload = {
13+
roles: [UserRole.Admin],
14+
handle: 'admin',
15+
userId: 123,
16+
...commonFields
17+
};
18+
19+
console.log('------------- Admin Token -------------');
20+
console.log(jwt.sign(adminPayload, authSecret));
21+
22+
const m2mPayload = {
23+
scope: `${Scope.AllReview} ${Scope.AllSubmission} ${Scope.AllAppeal} ${Scope.AllReviewSummation}`,
24+
sub: 'auth0|clients',
25+
...commonFields
26+
};
27+
28+
console.log('------------- Full M2M token -------------');
29+
console.log(jwt.sign(m2mPayload, authSecret));
30+
31+
const userPayload = {
32+
roles: [UserRole.User],
33+
handle: 'user',
34+
userId: 124,
35+
...commonFields
36+
};
37+
38+
console.log('------------- User Token -------------');
39+
console.log(jwt.sign(userPayload, authSecret));
40+
41+
42+
const reviewerPayload = {
43+
roles: [UserRole.Reviewer],
44+
handle: 'reviewer',
45+
userId: 125,
46+
...commonFields
47+
};
48+
49+
console.log('------------- Reviewer Token -------------');
50+
console.log(jwt.sign(reviewerPayload, authSecret));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test:cov": "jest --coverage",
1919
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
2020
"test:e2e": "jest --config ./test/jest-e2e.json",
21-
"postinstall": "npx prisma generate"
21+
"postinstall": "pnpm exec prisma generate"
2222
},
2323
"dependencies": {
2424
"@nestjs/axios": "^4.0.0",

0 commit comments

Comments
 (0)