Skip to content

Commit be04535

Browse files
committed
automatically create HexathonUser on submission of confirmation form
1 parent 86aa9c8 commit be04535

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

scripts/src/findHexathonUsers.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* eslint-disable no-await-in-loop */
2+
import { MongoClient, ObjectId } from "mongodb";
3+
4+
// Throw and show a stack trace on an unhandled Promise rejection instead of logging an unhelpful warning
5+
process.on("unhandledRejection", err => {
6+
throw err;
7+
});
8+
9+
const client = new MongoClient("mongodb://localhost:7777");
10+
11+
const findHexathonUsers = async () => {
12+
await client.connect();
13+
const applicationsCollection = client.db("registration").collection<any>("applications");
14+
const hexathonUsersCollection = client.db("hexathons").collection<any>("hexathonusers");
15+
16+
const user = await hexathonUsersCollection.findOne({
17+
hexathon: new ObjectId("683f9a9ab75ad31cd0f2ec67"),
18+
});
19+
20+
// print the user
21+
console.log(user);
22+
};
23+
24+
(async () => {
25+
await findHexathonUsers();
26+
27+
console.info("\nDone.");
28+
})();

services/registration/src/routes/application.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,20 @@ applicationRouter.route("/:id/actions/submit-application").post(
528528
},
529529
{ new: true }
530530
);
531+
if (
532+
existingApplication.applicationBranch.applicationGroup ===
533+
ApplicationGroupType.PARTICIPANT
534+
) {
535+
await apiCall(
536+
Service.HEXATHONS,
537+
{
538+
method: "POST",
539+
url: `/hexathon-users/${existingApplication.hexathon}/users/${existingApplication.userId}/actions/check-valid-user`,
540+
},
541+
req
542+
);
543+
}
544+
531545
break;
532546
// no default
533547
}

0 commit comments

Comments
 (0)