-
Notifications
You must be signed in to change notification settings - Fork 49
/
app-constants.js
157 lines (142 loc) · 5.4 KB
/
app-constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
const config = require("config");
/**
* App constants
*/
const UserRoles = {
Admin: "administrator",
Copilot: "copilot",
Manager: "Connect Manager",
User: "Topcoder User",
SelfServiceCustomer: "Self-Service Customer",
};
const prizeSetTypes = {
ChallengePrizes: "placement",
CopilotPayment: "copilot",
ReviewerPayment: "reviewer",
CheckpointPrizes: "checkpoint",
};
const prizeTypes = {
USD: "USD",
POINT: "POINT",
};
const challengeStatuses = {
New: "New",
Draft: "Draft",
Approved: "Approved",
Cancelled: "Cancelled",
Active: "Active",
Completed: "Completed",
Deleted: "Deleted",
CancelledFailedReview: "Cancelled - Failed Review",
CancelledFailedScreening: "Cancelled - Failed Screening",
CancelledZeroSubmissions: "Cancelled - Zero Submissions",
CancelledWinnerUnresponsive: "Cancelled - Winner Unresponsive",
CancelledClientRequest: "Cancelled - Client Request",
CancelledRequirementsInfeasible: "Cancelled - Requirements Infeasible",
CancelledZeroRegistrations: "Cancelled - Zero Registrations",
CancelledPaymentFailed: "Cancelled - Payment Failed",
};
const validChallengeParams = {
UpdatedBy: "updatedBy",
Updated: "updated",
CreatedBy: "createdBy",
Created: "created",
EndDate: "endDate",
StartDate: "startDate",
ProjectId: "projectId",
Name: "name",
Type: "type",
NumOfSubmissions: "numOfSubmissions",
NumOfRegistrants: "numOfRegistrants",
Status: "status",
TypeId: "typeId",
Prizes: "overview.totalPrizes",
};
const EVENT_ORIGINATOR = "topcoder-challenges-api";
const EVENT_MIME_TYPE = "application/json";
const DiscussionTypes = {
Challenge: "challenge",
};
// using a testing topc, should be changed to use real topics in comments when they are created
const Topics = {
ChallengeCreated: "challenge.notification.create",
ChallengeUpdated: "challenge.notification.update",
ChallengeDeleted: "challenge.notification.delete",
ChallengeTypeCreated: "test.new.bus.events", // 'challenge.action.type.created',
ChallengeTypeUpdated: "test.new.bus.events", // 'challenge.action.type.updated',
ChallengeTypeDeleted: "test.new.bus.events", // 'challenge.action.type.deleted',
ChallengeTrackCreated: "test.new.bus.events", // 'challenge.action.track.created',
ChallengeTrackUpdated: "test.new.bus.events", // 'challenge.action.track.updated',
ChallengeTrackDeleted: "test.new.bus.events", // 'challenge.action.track.deleted',
ChallengePhaseCreated: "test.new.bus.events", // 'challenge.action.phase.created',
ChallengePhaseUpdated: "test.new.bus.events", // 'challenge.action.phase.updated',
ChallengePhaseDeleted: "test.new.bus.events", // 'challenge.action.phase.deleted',
TimelineTemplateCreated: "test.new.bus.events", // 'challenge.action.timeline.template.created',
TimelineTemplateUpdated: "test.new.bus.events", // 'challenge.action.timeline.template.updated',
TimelineTemplateDeleted: "test.new.bus.events", // 'challenge.action.timeline.template.deleted',
ChallengeTypeTimelineTemplateCreated: "test.new.bus.events", // 'challenge.action.type.timeline.template.created',
ChallengeTypeTimelineTemplateUpdated: "test.new.bus.events", // 'challenge.action.type.timeline.template.updated',
ChallengeTypeTimelineTemplateDeleted: "test.new.bus.events", // 'challenge.action.type.timeline.template.deleted'
ChallengeAttachmentCreated: "test.new.bus.events", // 'challenge.action.attachment.created',
ChallengeAttachmentUpdated: "test.new.bus.events", // 'challenge.action.attachment.updated',
ChallengeAttachmentDeleted: "test.new.bus.events", // 'challenge.action.attachment.deleted',
ChallengeTimelineTemplateCreated: "challenge.action.challenge.timeline.created",
ChallengeTimelineTemplateUpdated: "challenge.action.challenge.timeline.updated",
ChallengeTimelineTemplateDeleted: "challenge.action.challenge.timeline.deleted",
// Self Service topics
Notifications: "notifications.action.create",
};
const challengeTracks = {
DEVELOP: "DEVELOP",
DESIGN: "DESIGN",
DATA_SCIENCE: "DATA_SCIENCE",
QA: "QA",
};
const challengeTextSortField = {
Name: "name",
TypeId: "typeId",
};
const reviewTypes = {
Community: "COMMUNITY",
Internal: "INTERNAL",
};
const SelfServiceNotificationTypes = {
WORK_REQUEST_SUBMITTED: "self-service.notifications.work-request-submitted",
WORK_REQUEST_STARTED: "self-service.notifications.work-request-started",
WORK_REQUEST_REDIRECTED: "self-service.notifications.work-request-redirected",
WORK_COMPLETED: "self-service.notifications.work-completed",
};
const SelfServiceNotificationSettings = {
[SelfServiceNotificationTypes.WORK_REQUEST_SUBMITTED]: {
sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_REQUEST_SUBMITTED,
cc: [],
},
[SelfServiceNotificationTypes.WORK_REQUEST_STARTED]: {
sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_REQUEST_STARTED,
cc: [],
},
[SelfServiceNotificationTypes.WORK_REQUEST_REDIRECTED]: {
sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_REQUEST_REDIRECTED,
cc: [...config.SELF_SERVICE_EMAIL_CC_ACCOUNTS],
},
[SelfServiceNotificationTypes.WORK_COMPLETED]: {
sendgridTemplateId: config.SENDGRID_TEMPLATES.WORK_COMPLETED,
cc: [],
},
};
module.exports = {
UserRoles,
prizeSetTypes,
prizeTypes,
challengeStatuses,
validChallengeParams,
EVENT_ORIGINATOR,
EVENT_MIME_TYPE,
Topics,
challengeTracks,
challengeTextSortField,
DiscussionTypes,
reviewTypes,
SelfServiceNotificationTypes,
SelfServiceNotificationSettings,
};