Skip to content

Commit

Permalink
fix: add company field to achievement (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
nalves599 authored Apr 15, 2024
1 parent 66943ee commit c82aa5b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/db/achievement.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ let mongoose = require('mongoose')
let achievementSchema = mongoose.Schema({
id: { type: String, unique: true },
session: String,
company: String,
name: String,
description: String,
instructions: String,
Expand Down
3 changes: 2 additions & 1 deletion server/resources/achievement.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ async function create(data) {
name: data.name,
event: data.event,
session: data.session,
company: data.company,
description: data.description,
category: data.category,
instructions: data.instructions,
Expand Down Expand Up @@ -531,7 +532,7 @@ async function addUserToStandAchievement(companyId, userId) {
const now = new Date()

return Achievement.findOneAndUpdate({
id: { $regex: `stand-${companyId}-` },
'company': companyId,
'kind': 'stand',
'validity.from': { $lte: now },
'validity.to': { $gte: now }
Expand Down
1 change: 1 addition & 0 deletions server/routes/achievement/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ exports.create = {
name: Joi.string().required().description('Name of the achievement'),
event: Joi.string().default('22').description('Event the achievement is associated to'),
session: Joi.string().description('Id of a session associated to this achievement'),
company: Joi.string().description('Company associated to this achievement'),
img: Joi.any().meta({ swaggerType: 'file' }).description('Image of the achievement'),
description: Joi.string().description('Description of the achievement'),
category: Joi.string().description('Category of the achievement'),
Expand Down
1 change: 1 addition & 0 deletions server/views/achievement.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function renderObject (model, wCode) {
id: model.id,
event: model.event,
session: model.session,
company: model.company,
unregisteredUsers: model.unregisteredUsers,
name: model.name,
description: model.description,
Expand Down

0 comments on commit c82aa5b

Please sign in to comment.