Skip to content

Commit 6af09f6

Browse files
author
Joshua Zhou
committed
Update db with devpost url
1 parent 36f2517 commit 6af09f6

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

controllers/checkin.controller.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ async function submitCheckin(req, res) {
5757
}
5858
}
5959

60+
// Update team's devpostURL in the database if provided
61+
if (req.body.formData.devpostLink) {
62+
await Services.Team.updateOne(hacker.teamId, {
63+
devpostURL: req.body.formData.devpostLink
64+
});
65+
}
66+
6067
// Prepare data for Google Sheets with team member emails
6168
const teamIdString = team._id ? team._id.toString() : hacker.teamId.toString();
6269

middlewares/validators/checkin.validator.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ const { body } = require('express-validator');
66
* Validator for check-in form submission
77
*/
88
const checkinValidator = [
9-
body('formData.teamMember1').notEmpty().withMessage('Team member 1 is required'),
10-
body('formData.teamMember2').optional(),
11-
body('formData.teamMember3').optional(),
12-
body('formData.teamMember4').optional(),
139
body('formData.prizeCategories').isArray().withMessage('Prize categories must be an array'),
1410
body('formData.sponsorChallenges').isArray().withMessage('Sponsor challenges must be an array'),
1511
body('formData.workshopsAttended').isArray().withMessage('Workshops attended must be an array'),
1612
body('formData.discordTag').notEmpty().withMessage('Discord tag is required'),
17-
body('formData.devpostLink').notEmpty().withMessage('Devpost link is required')
13+
body('formData.devpostLink').notEmpty().withMessage('Devpost link is required').isURL().withMessage('Devpost link must be a valid URL')
1814
];
1915

2016
module.exports = checkinValidator;

services/sheets.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class SheetsService {
6565

6666
const request = {
6767
spreadsheetId: this.spreadsheetId,
68-
range: 'Sheet1!A:I', // Updated to include column I for teamId
68+
range: 'Sheet1!A:K', // Updated to include columns through K (teamId)
6969
valueInputOption: 'USER_ENTERED',
7070
insertDataOption: 'INSERT_ROWS',
7171
resource: {

0 commit comments

Comments
 (0)