Skip to content

Commit 9177c8c

Browse files
authored
Merge pull request #64 from topcoder-platform/dev
Production release
2 parents 2e20f20 + d0f3867 commit 9177c8c

File tree

14 files changed

+626
-97
lines changed

14 files changed

+626
-97
lines changed

migrations/elasticsearch_sync.js

Lines changed: 246 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -33,91 +33,264 @@ function getRequestBody(indexName) {
3333
const projectMapping = {
3434
_all: { enabled: false },
3535
properties: {
36-
id: { type: 'long' },
37-
directProjectId: { type: 'long' },
38-
billingAccountId: { type: 'long' },
39-
name: { type: 'string' },
40-
description: { type: 'string' },
41-
external: { type: 'object',
36+
actualPrice: {
37+
type: 'double',
38+
},
39+
attachments: {
40+
type: 'nested',
4241
properties: {
43-
id: { type: 'string', index: 'not_analyzed' },
44-
type: { type: 'string', index: 'not_analyzed' },
45-
data: { type: 'string' },
46-
} },
47-
bookmarks: { type: 'nested',
42+
category: {
43+
type: 'string',
44+
index: 'not_analyzed',
45+
},
46+
contentType: {
47+
type: 'string',
48+
index: 'not_analyzed',
49+
},
50+
createdAt: {
51+
type: 'date',
52+
format: 'strict_date_optional_time||epoch_millis',
53+
},
54+
createdBy: {
55+
type: 'integer',
56+
},
57+
description: {
58+
type: 'string',
59+
},
60+
filePath: {
61+
type: 'string',
62+
},
63+
id: {
64+
type: 'long',
65+
},
66+
projectId: {
67+
type: 'long',
68+
},
69+
size: {
70+
type: 'double',
71+
},
72+
title: {
73+
type: 'string',
74+
},
75+
updatedAt: {
76+
type: 'date',
77+
format: 'strict_date_optional_time||epoch_millis',
78+
},
79+
updatedBy: {
80+
type: 'integer',
81+
},
82+
},
83+
},
84+
billingAccountId: {
85+
type: 'long',
86+
},
87+
bookmarks: {
88+
type: 'nested',
4889
properties: {
49-
title: { type: 'string' },
50-
address: { type: 'string' },
51-
} },
52-
utm: { type: 'object',
90+
address: {
91+
type: 'string',
92+
},
93+
title: {
94+
type: 'string',
95+
},
96+
},
97+
},
98+
cancelReason: {
99+
type: 'string',
100+
},
101+
challengeEligibility: {
102+
type: 'nested',
53103
properties: {
54-
campaign: { type: 'string' },
55-
medium: { type: 'string' },
56-
source: { type: 'string' },
57-
} },
58-
estimatedPrice: { type: 'double' },
59-
actualPrice: { type: 'double' },
60-
terms: { type: 'integer' },
61-
type: { type: 'string', index: 'not_analyzed' },
62-
status: { type: 'string', index: 'not_analyzed' },
63-
details: { type: 'nested',
104+
groups: {
105+
type: 'long',
106+
},
107+
role: {
108+
type: 'string',
109+
index: 'not_analyzed',
110+
},
111+
users: {
112+
type: 'long',
113+
},
114+
},
115+
},
116+
createdAt: {
117+
type: 'date',
118+
format: 'strict_date_optional_time||epoch_millis',
119+
},
120+
createdBy: {
121+
type: 'integer',
122+
},
123+
description: {
124+
type: 'string',
125+
},
126+
details: {
127+
type: 'nested',
64128
properties: {
65-
summary: { type: 'string' },
66-
TBD_usageDescription: { type: 'string' },
67-
TBD_features: { type: 'nested',
129+
TBD_features: {
130+
type: 'nested',
68131
properties: {
69-
id: { type: 'integer' },
70-
title: { type: 'string' },
71-
description: { type: 'string' },
72-
isCustom: { type: 'boolean' },
73-
} },
74-
} },
75-
challengeEligibility: { type: 'nested',
132+
description: {
133+
type: 'string',
134+
},
135+
id: {
136+
type: 'integer',
137+
},
138+
isCustom: {
139+
type: 'boolean',
140+
},
141+
title: {
142+
type: 'string',
143+
},
144+
},
145+
},
146+
TBD_usageDescription: {
147+
type: 'string',
148+
},
149+
appDefinition: {
150+
properties: {
151+
goal: {
152+
properties: {
153+
value: {
154+
type: 'string',
155+
},
156+
},
157+
},
158+
primaryTarget: {
159+
type: 'string',
160+
},
161+
users: {
162+
properties: {
163+
value: {
164+
type: 'string',
165+
},
166+
},
167+
},
168+
},
169+
},
170+
hideDiscussions: {
171+
type: 'boolean',
172+
},
173+
products: {
174+
type: 'string',
175+
},
176+
summary: {
177+
type: 'string',
178+
},
179+
utm: {
180+
type: 'nested',
181+
properties: {
182+
code: {
183+
type: 'string',
184+
},
185+
},
186+
},
187+
},
188+
},
189+
directProjectId: {
190+
type: 'long',
191+
},
192+
estimatedPrice: {
193+
type: 'double',
194+
},
195+
external: {
76196
properties: {
77-
role: { type: 'string', index: 'not_analyzed' },
78-
users: { type: 'long' },
79-
groups: { type: 'long' },
80-
} },
81-
cancelReason: { type: 'string' },
82-
createdAt: { type: 'date' },
83-
updatedAt: { type: 'date' },
84-
createdBy: { type: 'integer' },
85-
updatedBy: { type: 'integer' },
86-
// project members nested data type
197+
data: {
198+
type: 'string',
199+
},
200+
id: {
201+
type: 'string',
202+
index: 'not_analyzed',
203+
},
204+
type: {
205+
type: 'string',
206+
index: 'not_analyzed',
207+
},
208+
},
209+
},
210+
id: {
211+
type: 'long',
212+
},
87213
members: {
88214
type: 'nested',
89215
properties: {
90-
id: { type: 'long' },
91-
userId: { type: 'long' },
92-
projectId: { type: 'long' },
93-
role: { type: 'string', index: 'not_analyzed' },
94-
firstName: { type: 'string' },
95-
lastName: { type: 'string' },
96-
email: { type: 'string', index: 'not_analyzed' },
97-
handle: { type: 'string', index: 'not_analyzed' },
98-
isPrimary: { type: 'boolean' },
99-
createdAt: { type: 'date' },
100-
updatedAt: { type: 'date' },
101-
createdBy: { type: 'integer' },
102-
updatedBy: { type: 'integer' },
216+
createdAt: {
217+
type: 'date',
218+
format: 'strict_date_optional_time||epoch_millis',
219+
},
220+
createdBy: {
221+
type: 'integer',
222+
},
223+
email: {
224+
type: 'string',
225+
index: 'not_analyzed',
226+
},
227+
firstName: {
228+
type: 'string',
229+
},
230+
handle: {
231+
type: 'string',
232+
index: 'not_analyzed',
233+
},
234+
id: {
235+
type: 'long',
236+
},
237+
isPrimary: {
238+
type: 'boolean',
239+
},
240+
lastName: {
241+
type: 'string',
242+
},
243+
projectId: {
244+
type: 'long',
245+
},
246+
role: {
247+
type: 'string',
248+
index: 'not_analyzed',
249+
},
250+
updatedAt: {
251+
type: 'date',
252+
format: 'strict_date_optional_time||epoch_millis',
253+
},
254+
updatedBy: {
255+
type: 'integer',
256+
},
257+
userId: {
258+
type: 'long',
259+
},
103260
},
104261
},
105-
// project attachments nested data type
106-
attachments: {
107-
type: 'nested',
262+
name: {
263+
type: 'string',
264+
},
265+
status: {
266+
type: 'string',
267+
index: 'not_analyzed',
268+
},
269+
terms: {
270+
type: 'integer',
271+
},
272+
type: {
273+
type: 'string',
274+
index: 'not_analyzed',
275+
},
276+
updatedAt: {
277+
type: 'date',
278+
format: 'strict_date_optional_time||epoch_millis',
279+
},
280+
updatedBy: {
281+
type: 'integer',
282+
},
283+
utm: {
108284
properties: {
109-
id: { type: 'long' },
110-
title: { type: 'string' },
111-
size: { type: 'double' },
112-
category: { type: 'string', index: 'not_analyzed' },
113-
description: { type: 'string' },
114-
filePath: { type: 'string' },
115-
projectId: { type: 'long' },
116-
contentType: { type: 'string', index: 'not_analyzed' },
117-
createdAt: { type: 'date' },
118-
updatedAt: { type: 'date' },
119-
createdBy: { type: 'integer' },
120-
updatedBy: { type: 'integer' },
285+
campaign: {
286+
type: 'string',
287+
},
288+
medium: {
289+
type: 'string',
290+
},
291+
source: {
292+
type: 'string',
293+
},
121294
},
122295
},
123296
},

src/constants.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const USER_ROLE = {
3535

3636
export const ADMIN_ROLES = [USER_ROLE.CONNECT_ADMIN, USER_ROLE.TOPCODER_ADMIN];
3737

38+
export const MANAGER_ROLES = [...ADMIN_ROLES, USER_ROLE.MANAGER];
3839

3940
export const EVENT = {
4041
ROUTING_KEY: {
@@ -71,3 +72,7 @@ export const BUS_API_EVENT = {
7172
PROJECT_FILE_UPLOADED: 'connect.project.fileUploaded',
7273
PROJECT_SPECIFICATION_MODIFIED: 'connect.project.specificationModified',
7374
};
75+
76+
export const REGEX = {
77+
URL: /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,15})+(\:[0-9]{2,5})?(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/, // eslint-disable-line
78+
};

0 commit comments

Comments
 (0)