Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit c3726a0

Browse files
author
dengjun
committed
integration done
2 parents e74c7c3 + a2a5425 commit c3726a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3407
-71
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This is a [single-spa](https://single-spa.js.org/) example React microapp.
2525
| `npm run test` | Run unit tests |
2626
| `npm run watch-tests` | Watch for file changes and run unit tests on changes |
2727
| `npm run coverage` | Generate test code coverage report |
28+
| `npm run mock-api` | Start the mock api which mocks Recruit api |
2829

2930
## Local Deployment
3031

config/default.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
COMMUNITY_APP: "https://community-app.topcoder-dev.com",
1313
PLATFORM_WEBSITE_URL: "https://platform.topcoder-dev.com",
1414
},
15+
RECRUIT_API: process.env.RECRUIT_API || "https://www.topcoder-dev.com",
1516
// the server api base path
1617
API_BASE_PATH: process.env.API_BASE_PATH || "/earn-app/api/my-gigs",
1718
// the log level, default is 'debug'
@@ -43,4 +44,12 @@ module.exports = {
4344
process.env.M2M_AUDIT_USER_ID || "00000000-0000-0000-0000-000000000000",
4445
M2M_AUDIT_HANDLE: process.env.M2M_AUDIT_HANDLE || "TopcoderService",
4546
},
47+
MOCK_API_PORT: process.env.MOCK_API_PORT || 4000,
48+
ALLOWED_FILE_TYPES: process.env.ALLOWED_FILE_TYPES || [
49+
"pdf",
50+
"doc",
51+
"docx",
52+
"txt",
53+
],
54+
MAX_ALLOWED_FILE_SIZE_MB: process.env.MAX_ALLOWED_FILE_SIZE_MB || 10,
4655
};

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
transform: {
44
"^.+\\.(j|t)sx?$": "babel-jest",
55
},
6+
transformIgnorePatterns: ["node_modules/?!(react-dropzone)"],
67
moduleNameMapper: {
78
"\\.(css|scss)$": "identity-obj-proxy",
89
"\\.(png|eot|otf|ttf|woff|woff2|svg)$": "<rootDir>/__mocks__/fileMock.js",

package-lock.json

Lines changed: 109 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"format": "prettier --write \"./**\"",
1111
"test": "cross-env BABEL_ENV=test jest",
1212
"watch-tests": "cross-env BABEL_ENV=test jest --watch",
13-
"coverage": "cross-env BABEL_ENV=test jest --coverage"
13+
"coverage": "cross-env BABEL_ENV=test jest --coverage",
14+
"mock-api": "node ./src/api/mock-api/mock-api.js"
1415
},
1516
"devDependencies": {
1617
"@babel/core": "^7.7.5",
@@ -61,11 +62,15 @@
6162
"@babel/runtime": "^7.13.10",
6263
"@reach/router": "^1.3.4",
6364
"autoprefixer": "^8.6.5",
65+
"cors": "^2.8.5",
66+
"country-calling-code": "0.0.3",
6467
"dotenv": "^10.0.0",
6568
"express": "^4.17.1",
69+
"express-fileupload": "^1.2.1",
6670
"express-interceptor": "^1.2.0",
6771
"get-parameter-names": "^0.3.0",
6872
"http-status": "^1.5.0",
73+
"i18n-iso-countries": "^6.7.0",
6974
"joi": "^17.4.0",
7075
"lodash": "^4.17.21",
7176
"moment": "^2.29.1",
@@ -75,7 +80,9 @@
7580
"react": "^16.12.0",
7681
"react-date-range": "^1.1.3",
7782
"react-dom": "^16.12.0",
83+
"react-dropzone": "^11.3.2",
7884
"react-redux": "^7.2.3",
85+
"react-responsive-modal": "^6.1.0",
7986
"react-select": "^1.3.0",
8087
"react-use": "^15.3.4",
8188
"redux": "^4.0.5",

src/App.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { useSelector } from "react-redux";
2020
import "react-date-range/dist/theme/default.css";
2121
import "react-date-range/dist/styles.css";
2222
import "rc-tooltip/assets/bootstrap.css";
23+
import "react-responsive-modal/styles.css";
2324

2425
import "./styles/main.scss";
2526

src/actions/lookup.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ async function checkIsLoggedIn() {
1313
return service.checkIsLoggedIn();
1414
}
1515

16+
async function getGigPhases() {
17+
return service.getGigPhases();
18+
}
19+
20+
async function getGigStatuses() {
21+
return service.getGigStatuses();
22+
}
23+
1624
export default createActions({
1725
GET_TAGS: getTags,
1826
GET_COMMUNITY_LIST: getCommunityList,
1927
CHECK_IS_LOGGED_IN: checkIsLoggedIn,
28+
GET_GIG_PHASES: getGigPhases,
29+
GET_GIG_STATUSES: getGigStatuses,
2030
});

src/actions/myGigs.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ async function loadMoreMyGigs(nextPage, perPage = PER_PAGE) {
2222
return service.getMyGigs(nextPage, perPage);
2323
}
2424

25+
async function getProfile() {
26+
return service.getProfile();
27+
}
28+
29+
async function updateProfile(profile) {
30+
return service.updateProfile(profile);
31+
}
32+
2533
export default createActions({
2634
GET_MY_GIGS: getMyGigs,
2735
LOAD_MORE_MY_GIGS: loadMoreMyGigs,
36+
GET_PROFILE: getProfile,
37+
UPDATE_PROFILE: updateProfile,
2838
});

src/api/app-constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
const Scopes = {
66
// JobApplication
77
READ_JOBAPPLICATION: "read:earn-jobApplications",
8+
READ_PROFILE: "read:earn-profile",
9+
WRITE_PROFILE: "write:earn-profile",
10+
ALL_PROFILE: "all:earn-profile",
811
};
912

1013
module.exports = {

src/api/app-routes.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
const _ = require("lodash");
66
const config = require("config");
7+
const express = require("express");
8+
const cors = require("cors");
9+
const fileUpload = require("express-fileupload");
710
const helper = require("./common/helper");
811
const errors = require("./common/errors");
912
const routes = require("./routes");
@@ -14,6 +17,18 @@ const authenticator = require("tc-core-library-js").middleware.jwtAuthenticator;
1417
* @param app the express app
1518
*/
1619
module.exports = (app) => {
20+
app.use(express.json());
21+
app.use(cors());
22+
app.use(
23+
fileUpload({
24+
limits: {
25+
fields: 20,
26+
fileSize: config.MAX_ALLOWED_FILE_SIZE_MB * 1024 * 1024,
27+
files: 1,
28+
},
29+
debug: config.get("LOG_LEVEL") === "debug",
30+
})
31+
);
1732
// intercept the response body from jwtAuthenticator
1833
app.use(helper.interceptor);
1934
// Load all routes

0 commit comments

Comments
 (0)