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

feat: tweak patch-generation and submission logic for MR webhook #113

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions models/CopilotPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} CopilotPayment
* @property {String} id The unique identifier for the CopilotPayment entity.
* @property {String} project The project associated with the payment.
* @property {Number} amount The payment amount.
* @property {String} description The description of the payment.
* @property {Number} challengeId The ID of the associated challenge (if applicable).
* @property {String} challengeUUID The UUID of the associated challenge (if applicable).
* @property {String} closed Indicates whether the payment is closed or not (default is 'false').
* @property {String} username The username of the Copilot receiving the payment.
* @property {String} status The status of the payment.
*/

const schema = new Schema({
id: {
type: String,
Expand Down
8 changes: 8 additions & 0 deletions models/GithubUserMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} GithubUserMapping
* @property {String} id The unique identifier for the GithubUserMapping entity.
* @property {String} topcoderUsername The Topcoder username associated with the GitHub user.
* @property {String} githubUsername The GitHub username.
* @property {Number} githubUserId The GitHub user's numeric identifier.
*/

const schema = new Schema({
id: {
type: String,
Expand Down
8 changes: 8 additions & 0 deletions models/GitlabUserMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} GitlabUserMapping
* @property {String} id The unique identifier for the GitlabUserMapping entity.
* @property {String} topcoderUsername The Topcoder username associated with the GitLab user.
* @property {String} gitlabUsername The GitLab username.
* @property {Number} gitlabUserId The GitLab user's numeric identifier.
*/

const schema = new Schema({
id: {
type: String,
Expand Down
21 changes: 21 additions & 0 deletions models/Issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} Issue
* @property {String} id The id.
* @property {Number} number From the receiver service.
* @property {String} title The title.
* @property {String} body The body.
* @property {Number[]} prizes Prizes extracted from title.
* @property {String} provider Provider (github or gitlab).
* @property {Number} repositoryId Repository ID.
* @property {String} repoUrl Repository URL.
* @property {String} repositoryIdStr Repository ID as a String.
* @property {Array} labels Labels associated with the issue.
* @property {String} assignee Assignee for the issue.
* @property {Date} updatedAt Date when the issue was last updated.
* @property {Number} challengeId Challenge ID from topcoder API.
* @property {String} challengeUUID Challenge UUID.
* @property {String} projectId Project ID.
* @property {String} status Status of the issue.
* @property {Date} assignedAt Date when the issue was assigned (if applicable).
*/

const schema = new Schema({
id: {type: String, hashKey: true, required: true},
// From the receiver service
Expand Down
17 changes: 17 additions & 0 deletions models/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} ProjectChallengeMapping
* @property {String} id The id.
* @property {String} title The title.
* @property {Number} tcDirectId The tc direct id.
* @property {String} tags The tags.
* @property {String} rocketChatWebhook The rocket chat webhook.
* @property {String} rocketChatChannelName The rocket chat channel name.
* @property {String} archived The archived.
* @property {String} owner The owner.
* @property {String} secretWebhookKey The secret webhook key.
* @property {String} copilot The copilot.
* @property {Date} updatedAt The updated at.
* @property {String} createCopilotPayments The create copilot payments.
* @property {Boolean} isConnect Is Topcoder connect.
*/

const schema = new Schema({
id: {
type: String,
Expand Down
7 changes: 7 additions & 0 deletions models/ProjectChallengeMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} ProjectChallengeMapping
* @property {String} id the id
* @property {String} projectId the project id
* @property {String} challengeId the challenge id
*/

const schema = new Schema({
id: {
type: String,
Expand Down
10 changes: 10 additions & 0 deletions models/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ const dynamoose = require('dynamoose');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} Repository
* @property {String} id The unique identifier for the Repository entity.
* @property {String} projectId The project ID associated with the repository.
* @property {String} url The URL of the repository.
* @property {String} archived Indicates whether the repository is archived or not.
* @property {String} repoId The repository ID (if applicable).
* @property {String} registeredWebhookId The ID of the registered webhook (if applicable).
*/

const schema = new Schema({
id: {
type: String,
Expand Down
15 changes: 15 additions & 0 deletions models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ const constants = require('../constants');

const Schema = dynamoose.Schema;

/**
* @typedef {Object} User
* @property {String} id The user's unique identifier.
* @property {Number} userProviderId The user provider's numeric identifier.
* @property {String} userProviderIdStr The user provider's identifier as a string.
* @property {String} username The user's username.
* @property {String} role The user's role, one of the allowed constants.USER_ROLES.
* @property {String} type The user's type, one of the allowed constants.USER_TYPES.
* @property {String} accessToken GitLab token data (if applicable).
* @property {Date} accessTokenExpiration Expiration date of the access token (if applicable).
* @property {String} refreshToken GitLab token refresh token (if applicable).
* @property {String} lockId Lock identifier (if applicable).
* @property {Date} lockExpiration Expiration date of the lock (if applicable).
*/

const schema = new Schema({
id: {
type: String,
Expand Down
9 changes: 8 additions & 1 deletion models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,23 @@ if (process.env.CREATE_DB) {

/* eslint-disable global-require */
const models = {
/** @type {import('dynamoose').ModelConstructor<import('./Issue').Issue>} */
Issue: dynamoose.model('Topcoder_X.Issue', require('./Issue')),
/** @type {import('dynamoose').ModelConstructor<import('./Project').Project>} */
Project: dynamoose.model('Topcoder_X.Project', require('./Project')),
/** @type {import('dynamoose').ModelConstructor<import('./ProjectChallengeMapping').ProjectChallengeMapping>} */
ProjectChallengeMapping: dynamoose.model('Topcoder_X.ProjectChallengeMapping', require('./ProjectChallengeMapping')),
/** @type {import('dynamoose').ModelConstructor<import('./User').User>} */
User: dynamoose.model('Topcoder_X.User', require('./User')),
/** @type {import('dynamoose').ModelConstructor<import('./CopilotPayment').CopilotPayment>} */
CopilotPayment: dynamoose.model('Topcoder_X.CopilotPayment', require('./CopilotPayment')),
/** @type {import('dynamoose').ModelConstructor<import('./GithubUserMapping').GithubUserMapping>} */
GithubUserMapping: dynamoose.model('Topcoder_X.GithubUserMapping', require('./GithubUserMapping')),
/** @type {import('dynamoose').ModelConstructor<import('./GitlabUserMapping').GitlabUserMapping>} */
GitlabUserMapping: dynamoose.model('Topcoder_X.GitlabUserMapping', require('./GitlabUserMapping')),
/** @type {import('dynamoose').ModelConstructor<import('./Repository').Repository>} */
Repository: dynamoose.model('Topcoder_X.Repository', require('./Repository'))
};
/* eslint-enable global-require */


module.exports = models;
Loading