-
Notifications
You must be signed in to change notification settings - Fork 29
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
Feature/plat 1902 (DO NOT MEREGE) #301
Open
hamidre13
wants to merge
8
commits into
develop
Choose a base branch
from
feature/PLAT-1902
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
88f811f
refactor: update to async/await and add topcoder DAL framework
hamidre13 5934fb9
refactor: update to async/await and add topcoder DAL framework
hamidre13 82b5cbc
refactor: update to async/await and add topcoder DAL framework
hamidre13 22376eb
refactor: update topcoder/framework
hamidre13 1dbb552
feat: grpc create tested
hamidre13 2fffc18
fix: wip memberid out of scope error
hamidre13 2171507
integrate submission.update, review and reviewSummation with dal
ThomasKranitsas 51ae5bf
Merge pull request #302 from topcoder-platform/feat/plat-2428
ThomasKranitsas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"env": { | ||
"es2022": true | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"prettier" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2022 | ||
}, | ||
"rules": { | ||
"prefer-const": "error", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=http://localhost:4873 | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ const _ = require('lodash') | |
const winston = require('winston') | ||
const helper = require('./src/common/helper') | ||
const errorMiddleware = require('./src/common/ErrorMiddleware') | ||
const routes = require('./src/routes') | ||
const routes = require('./src/routes'); | ||
const swaggerUi = require('swagger-ui-express') | ||
const YAML = require('yamljs') | ||
const authenticator = require('tc-core-library-js').middleware.jwtAuthenticator | ||
|
@@ -37,7 +37,7 @@ const apiRouter = express.Router() | |
* @param {Array} source the array in which to search for the term | ||
* @param {Array | String} term the term to search | ||
*/ | ||
function checkIfExists (source, term) { | ||
function checkIfExists(source, term) { | ||
let terms | ||
|
||
if (!_.isArray(source)) { | ||
|
@@ -67,13 +67,17 @@ function checkIfExists (source, term) { | |
_.each(routes, (verbs, url) => { | ||
_.each(verbs, (def, verb) => { | ||
let actions = [ | ||
(req, res, next) => { | ||
async (req, res, next) => { | ||
req.signature = `${def.controller}#${def.method}` | ||
req.authUser = req.authUser || { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to clean up these hardcoded values |
||
userId: 'a84a4180-65aa-42ec-a945-5fd21dec1567', | ||
roles: ['Administrator'], | ||
scopes: ['read:submission', 'all:submission'] | ||
} | ||
next() | ||
} | ||
] | ||
const method = require(`./src/controllers/${def.controller}`)[ def.method ]; // eslint-disable-line | ||
|
||
const method = require(`./src/controllers/${def.controller}`)[def.method]; // eslint-disable-line | ||
if (!method) { | ||
throw new Error(`${def.method} is undefined, for controller ${def.controller}`) | ||
} | ||
|
@@ -83,9 +87,9 @@ _.each(routes, (verbs, url) => { | |
|
||
// add Authenticator check if route has auth | ||
if (def.auth) { | ||
actions.push((req, res, next) => { | ||
authenticator(_.pick(config, ['AUTH_SECRET', 'VALID_ISSUERS']))(req, res, next) | ||
}) | ||
// actions.push((req, res, next) => { | ||
// authenticator(_.pick(config, ['AUTH_SECRET', 'VALID_ISSUERS']))(req, res, next) | ||
// }) | ||
|
||
actions.push((req, res, next) => { | ||
if (!req.authUser) { | ||
|
@@ -125,7 +129,6 @@ _.each(routes, (verbs, url) => { | |
} | ||
}) | ||
} | ||
|
||
actions.push(method) | ||
winston.info(`API : ${verb.toLocaleUpperCase()} ${config.API_VERSION}${url}`) | ||
apiRouter[verb](`${config.API_VERSION}${url}`, helper.autoWrapExpress(actions)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
extends: ["@commitlint/config-conventional"], | ||
rules: { | ||
"type-enum": [ | ||
2, | ||
"always", | ||
[ | ||
"feat", | ||
"fix", | ||
"docs", | ||
"chore", | ||
"refactor", | ||
"ci", | ||
"test", | ||
"perf", | ||
"revert", | ||
], | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.npmrc should be .gitignored