Skip to content

Dry Release v0.2 #106

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

Merged
merged 67 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
370ce9c
fix: return start/end date for resources
maxceem Dec 16, 2020
d426d0a
docs: use variables in requests for Teams
maxceem Dec 16, 2020
57a8044
fix: return "JobCandidate.id" for team jobs
maxceem Dec 17, 2020
0e3f3b8
fix: small fixes
maxceem Dec 17, 2020
1c4c415
throw not found error if job not exist for `GET /taas-teams/:id/jobs/…
imcaizheng Dec 17, 2020
0fdc561
allow booking manager to access all teams
imcaizheng Dec 18, 2020
40106ed
use `helper.getM2Mtoken()` again
imcaizheng Dec 18, 2020
42a1581
Merge pull request #69 from imcaizheng/fix-booking-manager-access
maxceem Dec 18, 2020
4fce5b0
Merge pull request #71 from topcoder-platform/feature/integration-tes…
maxceem Dec 18, 2020
512df40
Merge pull request #68 from imcaizheng/get-team-job-add-not-found-res…
maxceem Dec 18, 2020
b815105
TeamService: use m2m token for internal api calls
imcaizheng Dec 19, 2020
a921a92
fix function `TeamService._getJobsByProjectIds()`
imcaizheng Dec 19, 2020
e29d842
Merge pull request #73 from imcaizheng/team-service-m2m-internal-api-…
maxceem Dec 19, 2020
5795ff3
remove redundant console.log
imcaizheng Dec 19, 2020
896f811
Merge pull request #74 from imcaizheng/allow-search-all-jobs
maxceem Dec 19, 2020
421d2a2
Merge pull request #75 from imcaizheng/team-service-m2m-internal-api-…
maxceem Dec 19, 2020
89876c6
fix permission rules as per https://github.com/topcoder-platform/taas…
imcaizheng Dec 21, 2020
be275c8
implement taas-teams skills endpoint
imcaizheng Dec 23, 2020
e37f001
apply permission check after record is pulled from ES
imcaizheng Dec 24, 2020
5ccfb7a
Merge pull request #77 from imcaizheng/fix-permission-rules
maxceem Dec 25, 2020
ba5b1dc
Merge pull request #80 from imcaizheng/add-skills-endpoint
maxceem Dec 25, 2020
7dac65a
refactor: getSkills -> getTopcoderSkills
maxceem Dec 25, 2020
3d280e7
fix: errors in /taas-teams endpoints
maxceem Dec 25, 2020
b2c30f8
remove skillMatched property
imcaizheng Dec 26, 2020
375479c
fix: teams access for Topcoder Users
maxceem Dec 28, 2020
4062f60
fix: teams access for Topcoder Users, 2
maxceem Dec 28, 2020
28e0b38
Merge pull request #83 from imcaizheng/remove-skillMatched-property
maxceem Dec 28, 2020
c208671
implement event handling
imcaizheng Dec 28, 2020
51128fc
Merge branch 'dev' into implement-event-handlers-repost
imcaizheng Dec 28, 2020
b0bd4dd
make fields startDate, endDate, memberRate and customerRate optional
imcaizheng Dec 28, 2020
f95ca33
fix: permission rules for connect manager
imcaizheng Dec 31, 2020
b64ac86
fix inconsistence by interating all jobs found filtering by projectId
imcaizheng Dec 31, 2020
1041679
enhancement: encapsulate old value to the event payload as well
imcaizheng Dec 31, 2020
596f545
fix: all operations except get/search cause 403 error if manager is n…
imcaizheng Jan 2, 2021
0c093c4
fix: use jobId instead of projectId to find job
imcaizheng Jan 3, 2021
4fa94f5
add migration script
imcaizheng Jan 3, 2021
01241b4
Update helper.js
Jan 4, 2021
d0fc7a7
Merge pull request #88 from topcoder-platform/m2m-fix
nkumar-topcoder Jan 4, 2021
e553e9e
Merge pull request #87 from imcaizheng/fix-permission-rules-part-2
maxceem Jan 4, 2021
7f5a621
Merge branch 'dev' into implement-event-handlers-repost
imcaizheng Jan 4, 2021
c21ac05
Revert "m2m create user fix"
maxceem Jan 4, 2021
89ba0bb
Merge pull request #90 from topcoder-platform/revert-88-m2m-fix
maxceem Jan 4, 2021
6d8dfff
decouple functions assignJob and selectJobCandidate to increase maint…
imcaizheng Jan 4, 2021
2d14088
find resourceBooking by jobId when cancelJob
imcaizheng Jan 4, 2021
600c7d9
make db migration configurable
imcaizheng Jan 4, 2021
13f5669
Merge pull request #85 from imcaizheng/implement-event-handlers-repost
maxceem Jan 4, 2021
a073aaf
update auth0 configuration
imcaizheng Jan 4, 2021
b4c6d93
fix typo: repalce all `ubhan` with `ubahn`
imcaizheng Jan 5, 2021
7a94251
fix typo elsewhere: repalce all `ubhan` with `ubahn`
imcaizheng Jan 5, 2021
59240c4
Merge pull request #91 from imcaizheng/fix-auth0-config
maxceem Jan 6, 2021
8821b54
Merge pull request #86 from imcaizheng/make-some-fields-for-resource-…
nkumar-topcoder Jan 6, 2021
5baf0c1
add the title field to Job model
imcaizheng Jan 6, 2021
28891fd
update the title values of existing jobs in DB
imcaizheng Jan 6, 2021
3c3a6ce
return resource booking id and user id for the taas-teams endpoints
imcaizheng Jan 6, 2021
076cc8a
fix: don't cancel ResourceBookings
maxceem Jan 6, 2021
6c6b362
include all fields except `id` from `getUserById` in a resource
imcaizheng Jan 6, 2021
b548040
Merge pull request #96 from imcaizheng/taas-teams-return-resource-boo…
maxceem Jan 6, 2021
ab77c3f
Merge pull request #95 from imcaizheng/job-add-title-field
nkumar-topcoder Jan 7, 2021
563aa7a
turn a job into in-review status after it has a candidate
imcaizheng Jan 7, 2021
205f264
fix: return Job "title" in Team endpoints
maxceem Jan 7, 2021
d3873f8
add externalId and resume fields to the JobCanidate model
imcaizheng Jan 7, 2021
c1225a2
Merge pull request #98 from imcaizheng/auto-change-job-status-in-review
maxceem Jan 7, 2021
8fdd9ef
Merge pull request #100 from imcaizheng/job-candidate-add-external-id…
nkumar-topcoder Jan 8, 2021
4f4ebc1
make some fields of Job optional
imcaizheng Jan 8, 2021
49ff24f
return the resume property instead of resumeLink in `TeamService.getT…
imcaizheng Jan 10, 2021
b0f61b9
Merge pull request #103 from imcaizheng/make-some-fields-for-job-opti…
nkumar-topcoder Jan 10, 2021
ef78279
Merge pull request #105 from imcaizheng/taas-teams-job-return-resume-…
maxceem Jan 11, 2021
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
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following parameters can be set in config files or in env variables:

- `AUTH0_URL`: Auth0 URL, used to get TC M2M token
- `AUTH0_AUDIENCE`: Auth0 audience, used to get TC M2M token
- `AUTH0_AUDIENCE_FOR_BUS_API`: Auth0 audience, used to get TC M2M token to be used in bus api client
- `AUTH0_AUDIENCE_UBAHN`: Auth0 audience for U-Bahn
- `TOKEN_CACHE_TIME`: Auth0 token cache time, used to get TC M2M token
- `AUTH0_CLIENT_ID`: Auth0 client id, used to get TC M2M token
- `AUTH0_CLIENT_SECRET`: Auth0 client secret, used to get TC M2M token
Expand All @@ -36,6 +36,7 @@ The following parameters can be set in config files or in env variables:
- `PROJECT_API_URL`: the project service url
- `TC_API`: the Topcoder v5 url
- `ORG_ID`: the organization id
- `TOPCODER_SKILL_PROVIDER_ID`: the referenced skill provider id

- `esConfig.HOST`: the elasticsearch host
- `esConfig.ES_INDEX_JOB`: the job index
Expand Down Expand Up @@ -66,6 +67,19 @@ The following parameters can be set in config files or in env variables:
- Modify `DATABASE_URL` under `config/default.js` to meet your environment.
- Run `npm run init-db` to create table(run `npm run init-db force` to force creating table)

## DB Migration
- `npm run migrate`: run any migration files which haven't run yet.
- `npm run migrate:undo`: revert most recent migration.

Configuration for migration is at `./config/config.json`.

The following parameters can be set in the config file or via env variables:

- `username`: set via env `DB_USERNAME`; datebase username
- `password`: set via env `DB_PASSWORD`; datebase password
- `database`: set via env `DB_NAME`; datebase name
- `host`: set via env `DB_HOST`; datebase host name

## ElasticSearch Setup
- Go to https://www.elastic.co/downloads/ download and install the elasticsearch.
- Modify `esConfig` under `config/default.js` to meet your environment.
Expand Down
10 changes: 9 additions & 1 deletion app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
*/

const UserRoles = {
BookingManager: 'bookingmanager'
BookingManager: 'bookingmanager',
Administrator: 'administrator',
ConnectManager: 'Connect Manager'
}

const FullManagePermissionRoles = [
UserRoles.BookingManager,
UserRoles.Administrator
]

const Scopes = {
// job
READ_JOB: 'read:taas-jobs',
Expand All @@ -31,5 +38,6 @@ const Scopes = {

module.exports = {
UserRoles,
FullManagePermissionRoles,
Scopes
}
8 changes: 6 additions & 2 deletions app-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ module.exports = (app) => {
}
} else {
req.authUser.jwtToken = req.headers.authorization
if (_.includes(req.authUser.roles, constants.UserRoles.BookingManager)) {
req.authUser.isBookingManager = true
// check if user has full manage permission
if (_.intersection(req.authUser.roles, constants.FullManagePermissionRoles).length) {
req.authUser.hasManagePermission = true
}
if (_.includes(req.authUser.roles, constants.UserRoles.ConnectManager)) {
req.authUser.isConnectManager = true
}
next()
}
Expand Down
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const cors = require('cors')
const HttpStatus = require('http-status-codes')
const interceptor = require('express-interceptor')
const logger = require('./src/common/logger')
const eventHandlers = require('./src/eventHandlers')

// setup express app
const app = express()
Expand Down Expand Up @@ -91,6 +92,7 @@ app.use((err, req, res, next) => {

const server = app.listen(app.get('port'), () => {
logger.info({ component: 'app', message: `Express server listening on port ${app.get('port')}` })
eventHandlers.init()
})

if (process.env.NODE_ENV === 'test') {
Expand Down
27 changes: 27 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Configuration for DB migration.
*/

module.exports = {
development: {
username: process.env.DB_USERNAME || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
database: process.env.DB_NAME || 'postgres',
host: process.env.DB_HOST || '127.0.0.1',
dialect: 'postgres'
},
test: {
username: process.env.DB_USERNAME || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
database: process.env.DB_NAME || 'postgres',
host: process.env.DB_HOST || '127.0.0.1',
dialect: 'postgres'
},
production: {
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: 'postgres'
}
}
23 changes: 23 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"development": {
"username": "postgres",
"password": "postgres",
"database": "postgres",
"host": "127.0.0.1",
"dialect": "postgres"
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
3 changes: 2 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
VALID_ISSUERS: process.env.VALID_ISSUERS || '["https://api.topcoder-dev.com", "https://api.topcoder.com", "https://topcoder-dev.auth0.com/", "https://auth.topcoder-dev.com/"]',
AUTH0_URL: process.env.AUTH0_URL,
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE,
AUTH0_AUDIENCE_FOR_BUS_API: process.env.AUTH0_AUDIENCE_FOR_BUS_API,
AUTH0_AUDIENCE_UBAHN: process.env.AUTH0_AUDIENCE_UBAHN,
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME,
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
Expand All @@ -21,6 +21,7 @@ module.exports = {

TC_API: process.env.TC_API || 'https://api.topcoder-dev.com/v5',
ORG_ID: process.env.ORG_ID || '36ed815b-3da1-49f1-a043-aaed0a4e81ad',
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',

TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',

Expand Down
2 changes: 1 addition & 1 deletion config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
LOG_LEVEL: process.env.LOG_LEVEL || 'info',
AUTH0_URL: 'http://example.com',
AUTH0_AUDIENCE: 'http://example.com',
AUTH0_AUDIENCE_FOR_BUS_API: 'http://example.com',
AUTH0_AUDIENCE_UBAHN: 'http://example.com',
AUTH0_CLIENT_ID: 'fake_id',
AUTH0_CLIENT_SECRET: 'fake_secret'
}
2 changes: 1 addition & 1 deletion docker/sample.api.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ES_HOST=<ES Host Endpoint>

AUTH0_URL=<AUTH0 URL>
AUTH0_AUDIENCE=<AUTH0 Audience>
AUTH0_AUDIENCE_FOR_BUS_API=<AUTH0 Audience For Bus Api>
AUTH0_AUDIENCE_UBAHN=<AUTH0 Audience For Bus Api>
TOKEN_CACHE_TIME=500000
AUTH0_CLIENT_ID=<AUTH0 Client ID>
AUTH0_CLIENT_SECRET=<AUTH0 Client Secret>
Loading