Skip to content

Commit

Permalink
added profile expo filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
pm3512 committed Feb 3, 2024
1 parent c12f240 commit d19c162
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/_types/augment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ declare global {
JWT_SECRET: string;
AUTH_TOKEN_EXPIRY: string;
MONGODB_URI: string;
JUDGING_URL: string;
JUDGING_TOKEN: string;
// object id for the judging expo checkin item
EXPO_EVENT_ID: string;
// Email config
EMAIL_HOST?: string;
EMAIL_USER?: string;
Expand Down
18 changes: 18 additions & 0 deletions src/controllers/CheckInController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import {
getPointsPipeline,
} from "../aggregations/checkin";

import { ObjectId } from "bson";
import Team from "src/models/Team";
import Project from "src/models/Project";
import { findUserTeam } from "./TeamController";

export const recalculatePoints = async (
req: Request,
res: Response
Expand Down Expand Up @@ -273,6 +278,19 @@ export const checkInUser = async (
await checkIn.save();
await profile.save();

if (item._id.equals(process.env.EXPO_EVENT_ID)) {
// checking into judging expo
const team = await findUserTeam(user._id)
const project = await Project.findOne({ team: team._id });
const judgingUrl = process.env.JUDGING_URL;
fetch(`${judgingUrl}/checkin?helixProjectId=${project._id}`, {
method: "PUT",
headers: {
authorization: process.env.JUDGING_TOKEN,
},
});
}

const json = checkIn.toJSON();
res.json(json);
} catch (err) {
Expand Down

0 comments on commit d19c162

Please sign in to comment.