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

Commit 031d16a

Browse files
authored
Merge pull request #113 from dhruvit-r/develop
feat: tweak patch-generation and submission logic for MR webhook
2 parents c4358f1 + b2b5960 commit 031d16a

16 files changed

+621
-99
lines changed

models/CopilotPayment.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ const dynamoose = require('dynamoose');
1414

1515
const Schema = dynamoose.Schema;
1616

17+
/**
18+
* @typedef {Object} CopilotPayment
19+
* @property {String} id The unique identifier for the CopilotPayment entity.
20+
* @property {String} project The project associated with the payment.
21+
* @property {Number} amount The payment amount.
22+
* @property {String} description The description of the payment.
23+
* @property {Number} challengeId The ID of the associated challenge (if applicable).
24+
* @property {String} challengeUUID The UUID of the associated challenge (if applicable).
25+
* @property {String} closed Indicates whether the payment is closed or not (default is 'false').
26+
* @property {String} username The username of the Copilot receiving the payment.
27+
* @property {String} status The status of the payment.
28+
*/
29+
1730
const schema = new Schema({
1831
id: {
1932
type: String,

models/GithubUserMapping.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ const dynamoose = require('dynamoose');
77

88
const Schema = dynamoose.Schema;
99

10+
/**
11+
* @typedef {Object} GithubUserMapping
12+
* @property {String} id The unique identifier for the GithubUserMapping entity.
13+
* @property {String} topcoderUsername The Topcoder username associated with the GitHub user.
14+
* @property {String} githubUsername The GitHub username.
15+
* @property {Number} githubUserId The GitHub user's numeric identifier.
16+
*/
17+
1018
const schema = new Schema({
1119
id: {
1220
type: String,

models/GitlabUserMapping.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ const dynamoose = require('dynamoose');
77

88
const Schema = dynamoose.Schema;
99

10+
/**
11+
* @typedef {Object} GitlabUserMapping
12+
* @property {String} id The unique identifier for the GitlabUserMapping entity.
13+
* @property {String} topcoderUsername The Topcoder username associated with the GitLab user.
14+
* @property {String} gitlabUsername The GitLab username.
15+
* @property {Number} gitlabUserId The GitLab user's numeric identifier.
16+
*/
17+
1018
const schema = new Schema({
1119
id: {
1220
type: String,

models/Issue.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ const dynamoose = require('dynamoose');
1212

1313
const Schema = dynamoose.Schema;
1414

15+
/**
16+
* @typedef {Object} Issue
17+
* @property {String} id The id.
18+
* @property {Number} number From the receiver service.
19+
* @property {String} title The title.
20+
* @property {String} body The body.
21+
* @property {Number[]} prizes Prizes extracted from title.
22+
* @property {String} provider Provider (github or gitlab).
23+
* @property {Number} repositoryId Repository ID.
24+
* @property {String} repoUrl Repository URL.
25+
* @property {String} repositoryIdStr Repository ID as a String.
26+
* @property {Array} labels Labels associated with the issue.
27+
* @property {String} assignee Assignee for the issue.
28+
* @property {Date} updatedAt Date when the issue was last updated.
29+
* @property {Number} challengeId Challenge ID from topcoder API.
30+
* @property {String} challengeUUID Challenge UUID.
31+
* @property {String} projectId Project ID.
32+
* @property {String} status Status of the issue.
33+
* @property {Date} assignedAt Date when the issue was assigned (if applicable).
34+
*/
35+
1536
const schema = new Schema({
1637
id: {type: String, hashKey: true, required: true},
1738
// From the receiver service

models/Project.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ const dynamoose = require('dynamoose');
1212

1313
const Schema = dynamoose.Schema;
1414

15+
/**
16+
* @typedef {Object} ProjectChallengeMapping
17+
* @property {String} id The id.
18+
* @property {String} title The title.
19+
* @property {Number} tcDirectId The tc direct id.
20+
* @property {String} tags The tags.
21+
* @property {String} rocketChatWebhook The rocket chat webhook.
22+
* @property {String} rocketChatChannelName The rocket chat channel name.
23+
* @property {String} archived The archived.
24+
* @property {String} owner The owner.
25+
* @property {String} secretWebhookKey The secret webhook key.
26+
* @property {String} copilot The copilot.
27+
* @property {Date} updatedAt The updated at.
28+
* @property {String} createCopilotPayments The create copilot payments.
29+
* @property {Boolean} isConnect Is Topcoder connect.
30+
*/
31+
1532
const schema = new Schema({
1633
id: {
1734
type: String,

models/ProjectChallengeMapping.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ const dynamoose = require('dynamoose');
1010

1111
const Schema = dynamoose.Schema;
1212

13+
/**
14+
* @typedef {Object} ProjectChallengeMapping
15+
* @property {String} id the id
16+
* @property {String} projectId the project id
17+
* @property {String} challengeId the challenge id
18+
*/
19+
1320
const schema = new Schema({
1421
id: {
1522
type: String,

models/Repository.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ const dynamoose = require('dynamoose');
1212

1313
const Schema = dynamoose.Schema;
1414

15+
/**
16+
* @typedef {Object} Repository
17+
* @property {String} id The unique identifier for the Repository entity.
18+
* @property {String} projectId The project ID associated with the repository.
19+
* @property {String} url The URL of the repository.
20+
* @property {String} archived Indicates whether the repository is archived or not.
21+
* @property {String} repoId The repository ID (if applicable).
22+
* @property {String} registeredWebhookId The ID of the registered webhook (if applicable).
23+
*/
24+
1525
const schema = new Schema({
1626
id: {
1727
type: String,

models/User.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ const constants = require('../constants');
1212

1313
const Schema = dynamoose.Schema;
1414

15+
/**
16+
* @typedef {Object} User
17+
* @property {String} id The user's unique identifier.
18+
* @property {Number} userProviderId The user provider's numeric identifier.
19+
* @property {String} userProviderIdStr The user provider's identifier as a string.
20+
* @property {String} username The user's username.
21+
* @property {String} role The user's role, one of the allowed constants.USER_ROLES.
22+
* @property {String} type The user's type, one of the allowed constants.USER_TYPES.
23+
* @property {String} accessToken GitLab token data (if applicable).
24+
* @property {Date} accessTokenExpiration Expiration date of the access token (if applicable).
25+
* @property {String} refreshToken GitLab token refresh token (if applicable).
26+
* @property {String} lockId Lock identifier (if applicable).
27+
* @property {Date} lockExpiration Expiration date of the lock (if applicable).
28+
*/
29+
1530
const schema = new Schema({
1631
id: {
1732
type: String,

models/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,23 @@ if (process.env.CREATE_DB) {
3535

3636
/* eslint-disable global-require */
3737
const models = {
38+
/** @type {import('dynamoose').ModelConstructor<import('./Issue').Issue>} */
3839
Issue: dynamoose.model('Topcoder_X.Issue', require('./Issue')),
40+
/** @type {import('dynamoose').ModelConstructor<import('./Project').Project>} */
3941
Project: dynamoose.model('Topcoder_X.Project', require('./Project')),
42+
/** @type {import('dynamoose').ModelConstructor<import('./ProjectChallengeMapping').ProjectChallengeMapping>} */
4043
ProjectChallengeMapping: dynamoose.model('Topcoder_X.ProjectChallengeMapping', require('./ProjectChallengeMapping')),
44+
/** @type {import('dynamoose').ModelConstructor<import('./User').User>} */
4145
User: dynamoose.model('Topcoder_X.User', require('./User')),
46+
/** @type {import('dynamoose').ModelConstructor<import('./CopilotPayment').CopilotPayment>} */
4247
CopilotPayment: dynamoose.model('Topcoder_X.CopilotPayment', require('./CopilotPayment')),
48+
/** @type {import('dynamoose').ModelConstructor<import('./GithubUserMapping').GithubUserMapping>} */
4349
GithubUserMapping: dynamoose.model('Topcoder_X.GithubUserMapping', require('./GithubUserMapping')),
50+
/** @type {import('dynamoose').ModelConstructor<import('./GitlabUserMapping').GitlabUserMapping>} */
4451
GitlabUserMapping: dynamoose.model('Topcoder_X.GitlabUserMapping', require('./GitlabUserMapping')),
52+
/** @type {import('dynamoose').ModelConstructor<import('./Repository').Repository>} */
4553
Repository: dynamoose.model('Topcoder_X.Repository', require('./Repository'))
4654
};
4755
/* eslint-enable global-require */
4856

49-
5057
module.exports = models;

0 commit comments

Comments
 (0)