Skip to content

Commit be17afd

Browse files
2 parents 92df3d4 + 4956c90 commit be17afd

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

app-constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const UserRoles = {
99
const prizeSetTypes = {
1010
ChallengePrizes: 'Challenge prizes',
1111
CopilotPayment: 'Copilot payment',
12-
ReviewerPayment: 'Reviewer payment'
12+
ReviewerPayment: 'Reviewer payment',
13+
CheckpointPrizes: 'Checkpoint prizes'
1314
}
1415

1516
const challengeStatuses = {

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/models/Challenge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const schema = new Schema({
6363
},
6464
forumId: {
6565
type: Number,
66-
required: true
66+
required: false
6767
},
6868
status: {
6969
type: String,

src/routes.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ module.exports = {
127127
get: {
128128
controller: 'ChallengePhaseController',
129129
method: 'searchPhases',
130-
auth: 'jwt',
131-
access: [constants.UserRoles.Admin, constants.UserRoles.Copilot],
132130
scopes: [CHALLENGE_PHASES.READ, CHALLENGE_PHASES.ALL]
133131
},
134132
post: {
@@ -173,8 +171,6 @@ module.exports = {
173171
get: {
174172
controller: 'TimelineTemplateController',
175173
method: 'searchTimelineTemplates',
176-
auth: 'jwt',
177-
access: [constants.UserRoles.Admin, constants.UserRoles.Copilot],
178174
scopes: [TIMELINE_TEMPLATES.READ, TIMELINE_TEMPLATES.ALL]
179175
},
180176
post: {

src/services/ChallengeService.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async function createChallenge (currentUser, challenge) {
148148
await ensureAccessibleByGroupsAccess(currentUser, challenge)
149149

150150
const ret = await helper.create('Challenge', _.assign({
151-
id: uuid(), created: new Date(), createdBy: currentUser.handle }, challenge))
151+
id: uuid(), created: new Date(), createdBy: currentUser.handle || currentUser.sub }, challenge))
152152

153153
// post bus event
154154
await helper.postBusEvent(constants.Topics.ChallengeCreated, ret)
@@ -187,7 +187,7 @@ createChallenge.schema = {
187187
reviewType: Joi.string().required(),
188188
tags: Joi.array().items(Joi.string().required()).min(1).required(), // tag names
189189
projectId: Joi.number().integer().positive().required(),
190-
forumId: Joi.number().integer().positive().required(),
190+
forumId: Joi.number().integer().positive(),
191191
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
192192
groups: Joi.array().items(Joi.string()) // group names
193193
}).required()
@@ -234,7 +234,7 @@ async function getChallenge (currentUser, id) {
234234
// populate type property based on the typeId
235235
const type = await helper.getById('ChallengeType', challenge.typeId)
236236
challenge.type = type.name
237-
delete challenge.typeId
237+
// delete challenge.typeId
238238

239239
return populateSettings(challenge)
240240
}
@@ -366,7 +366,7 @@ async function update (currentUser, challengeId, data, isFull) {
366366
}
367367

368368
data.updated = new Date()
369-
data.updatedBy = currentUser.handle
369+
data.updatedBy = currentUser.handle || currentUser.sub
370370
const updateDetails = {}
371371
const auditLogs = []
372372
_.each(data, (value, key) => {
@@ -552,7 +552,7 @@ fullyUpdateChallenge.schema = {
552552
reviewType: Joi.string().required(),
553553
tags: Joi.array().items(Joi.string().required()).min(1).required(), // tag names
554554
projectId: Joi.number().integer().positive().required(),
555-
forumId: Joi.number().integer().positive().required(),
555+
forumId: Joi.number().integer().positive(),
556556
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
557557
attachmentIds: Joi.array().items(Joi.optionalId()),
558558
groups: Joi.array().items(Joi.string()) // group names

0 commit comments

Comments
 (0)