Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/lopatoj/hackrice14
Browse files Browse the repository at this point in the history
  • Loading branch information
SoberingRealityCheck committed Sep 22, 2024
2 parents 2c5f0c0 + 12be154 commit 9d52bc1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion client/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function App()
<Route path="/" element={<Home/>} />
<Route path="/userinfo" element={<Userinfo/>} />
<Route path="/catalog" element={<Catalog/>} />
<Route path="/chat" element={<Chat/>} />
<Route path="/chat/:id" element={<Chat/>} />
<Route path="/chatSelect" element={<ChatSelect/>} />
</Routes>
Expand Down
2 changes: 2 additions & 0 deletions server/src/routers/chats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ chats.get("/", async (_req, res: Response<Chat[], { user: UserData }>) => {
chats.get("/:id", async (req, res: Response<Chat | string, { user: UserData }>) => {
let chat;

console.log(req.params.id);

if (!res.locals.user.matches.map(m => m.chat_id).includes(req.params.id) || (chat = await collection.findOne<Chat>({ "id": req.params.id })) === null) {
res.status(404).send("Chat not found");
return;
Expand Down
2 changes: 1 addition & 1 deletion server/src/routers/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ profile.get("/me", (_req, res: Response<{}, { user: UserData }>) => {
profile.post("/me", async (req: Request<{}, {}, Partial<{ bio: string, open_to_wave: boolean }>>, res: Response<{}, { user: UserData }>) => {
let { bio, open_to_wave } = req.body;
const user = res.locals.user;
await users.updateOne({ firebase_id: user.firebase_id }, { "$set": { bio: (bio || user.bio), open_to_wave: (open_to_wave || user.open_to_wave) } });
await users.updateOne({ firebase_id: user.firebase_id }, { "$set": { bio: (bio || user.bio), open_to_wave: (open_to_wave !== null ? open_to_wave : user.open_to_wave) } });
res.json({ ...user, bio, open_to_wave });
});

Expand Down

0 comments on commit 9d52bc1

Please sign in to comment.