Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const express = require('express');
const Sentry = require('@sentry/node');
const testRoutes = require('./routes/testRoutes');

Check warning on line 3 in src/app.js

View workflow job for this annotation

GitHub Actions / Lint Check

There should be no empty line between import groups

const app = express();
const logger = require('./startup/logger');
const globalErrorHandler = require('./utilities/errorHandling/globalErrorHandler');

Check warning on line 7 in src/app.js

View workflow job for this annotation

GitHub Actions / Lint Check

There should be no empty line between import groups
// const experienceRoutes = require('./routes/applicantAnalyticsRoutes');

logger.init();
Expand All @@ -15,6 +16,8 @@
require('./startup/cors')(app);
require('./startup/bodyParser')(app);

app.use('/api/test', testRoutes);

const helpFeedbackRouter = require('./routes/helpFeedbackRouter');
const helpRequestRouter = require('./routes/helpRequestRouter');

Expand Down
27 changes: 27 additions & 0 deletions src/routes/testRoutes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const express = require('express');

const router = express.Router();

router.post('/set-team-code', async (req, res) => {
try {
const userProfile = require('../models/userProfile');
const { userId, teamCode } = req.body;

if (!userId || !teamCode) {
return res.status(400).json({ error: 'userId and teamCode required' });
}

const updated = await userProfile.findByIdAndUpdate(userId, { teamCode }, { new: true });

if (!updated) {
return res.status(404).json({ error: 'User not found' });
}

res.json({ success: true, user: updated });
} catch (err) {
console.error('Error:', err);
res.status(500).json({ error: err.message });
}
});

module.exports = router;
Loading