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

Commit 566889d

Browse files
authored
Merge pull request #108 from dhruvit-r/develop
For #469: Create private fork when users register
2 parents 2b05b73 + 3394833 commit 566889d

15 files changed

+5713
-2762
lines changed

.eslintrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"node": true,
44
"mocha": true
55
},
6+
"plugins": [
7+
"jsdoc"
8+
],
69
"parserOptions": {
710
"ecmaVersion": 8,
811
"ecmaFeatures": {
@@ -43,6 +46,7 @@
4346
}
4447
],
4548
"max-lines": 0,
46-
"max-statements": 0
49+
"max-statements": 0,
50+
"valid-jsdoc": 0
4751
}
48-
}
52+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
*.cer
77
*.key
88
.idea
9+
10+
.env
11+
.envrc

config/default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ module.exports = {
1616
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
1717
PARTITION: process.env.PARTITION || 0,
1818
TOPIC: process.env.TOPIC || 'tc-x-events',
19+
TOPIC_CHALLENGE_ACTION_RESOURCE_CREATE: process.env.TOPIC_CHALLENGE_ACTION_RESOURCE_CREATE || 'challenge.action.resource.create',
1920
TOPIC_NOTIFICATION: process.env.TOPIC_NOTIFICATION || 'notifications.action.create',
2021
KAFKA_OPTIONS: {
2122
connectionString: process.env.KAFKA_URL || 'localhost:9092',
2223
groupId: process.env.KAFKA_GROUP_ID || 'topcoder-x-processor',
23-
ssl: {
24+
ssl: process.env.KAFKA_DISABLE_SSL ? false : {
2425
cert: process.env.KAFKA_CLIENT_CERT || fs.readFileSync('./kafka_client.cer'), // eslint-disable-line no-sync
2526
key: process.env.KAFKA_CLIENT_CERT_KEY || fs.readFileSync('./kafka_client.key'), // eslint-disable-line no-sync
2627
passphrase: 'secret', // NOTE:* This configuration specifies the private key passphrase used while creating it.

constants.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,20 @@ const ISSUE_STATUS = {
4343
CHALLENGE_PAYMENT_FAILED: 'challenge_payment_failed'
4444
};
4545

46+
const GITLAB_ACCESS_LEVELS = {
47+
NO_ACCESS: 0,
48+
GUEST: 10,
49+
REPORTER: 20,
50+
DEVELOPER: 30,
51+
MAINTAINER: 40,
52+
OWNER: 50
53+
};
54+
4655
module.exports = {
4756
USER_ROLES,
4857
USER_TYPES,
4958
SERVICE_ERROR_STATUS,
5059
CHALLENGE_STATUS,
51-
ISSUE_STATUS
60+
ISSUE_STATUS,
61+
GITLAB_ACCESS_LEVELS
5262
};

docker/Dockerfile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# Use the base image with Node.js
2-
FROM node:8.12
2+
FROM node:20
33

4-
# Copy the current directory into the Docker image
5-
COPY . /topcoder-x-processor
6-
7-
# Set working directory for future use
84
WORKDIR /topcoder-x-processor
5+
COPY package.json package-lock.json ./
6+
RUN npm ci --silent --legacy-peer-deps
7+
COPY . .
98

10-
# Install the dependencies from package.json
11-
RUN npm install
12-
#RUN npm run build
13-
#RUN npm run test
14-
15-
CMD npm start
9+
CMD npm start

models/ProjectChallengeMapping.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2017 TopCoder, Inc. All rights reserved.
3+
*/
4+
'use strict';
5+
6+
/**
7+
* This defines TCX project to TC challenge mapping model.
8+
*/
9+
const dynamoose = require('dynamoose');
10+
11+
const Schema = dynamoose.Schema;
12+
13+
const schema = new Schema({
14+
id: {
15+
type: String,
16+
required: true,
17+
hashKey: true
18+
},
19+
projectId: {
20+
type: String,
21+
required: true,
22+
index: {
23+
global: true,
24+
project: true,
25+
name: 'ProjectIdIndex'
26+
}
27+
},
28+
challengeId: {
29+
type: String,
30+
required: true
31+
}
32+
});
33+
34+
module.exports = schema;

models/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ if (process.env.CREATE_DB) {
3737
const models = {
3838
Issue: dynamoose.model('Topcoder_X.Issue', require('./Issue')),
3939
Project: dynamoose.model('Topcoder_X.Project', require('./Project')),
40+
ProjectChallengeMapping: dynamoose.model('Topcoder_X.ProjectChallengeMapping', require('./ProjectChallengeMapping')),
4041
User: dynamoose.model('Topcoder_X.User', require('./User')),
4142
CopilotPayment: dynamoose.model('Topcoder_X.CopilotPayment', require('./CopilotPayment')),
4243
GithubUserMapping: dynamoose.model('Topcoder_X.GithubUserMapping', require('./GithubUserMapping')),

0 commit comments

Comments
 (0)