Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question service implementation #35

Merged
merged 184 commits into from
Sep 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
3b41350
Add question details and error page
nicolelim02 Sep 18, 2024
c8837fb
Create admin new question page
guanquann Sep 18, 2024
cb4b7b3
Add comments to new question frontend, clean code
guanquann Sep 18, 2024
e9bd29d
Fix styling for new question frontend
guanquann Sep 18, 2024
2dafe9e
Update upload button
guanquann Sep 19, 2024
1730d34
Refactor code
nicolelim02 Sep 19, 2024
c0d0ebf
Standardise styling for buttons
guanquann Sep 19, 2024
3d19658
Update file structure of add question frontend
guanquann Sep 20, 2024
8b95d68
Update QuestionImage folder
guanquann Sep 20, 2024
5788b54
Merge pull request #3 from nicolelim02/feat/questions
nicolelim02 Sep 20, 2024
2b998cc
Merge changes and fix conflicts
guanquann Sep 20, 2024
55bb509
Fix markdown editor styling
guanquann Sep 20, 2024
8dd0fcd
Set up mongodb backend and implement APIs for create and update quest…
jolynloh Sep 20, 2024
5c52e2f
Merge branch 'development' into BE/mongodbsetup
jolynloh Sep 20, 2024
8b0438a
Tidy up comments
jolynloh Sep 20, 2024
750e89b
Modify directory structure
jolynloh Sep 20, 2024
d4f7478
Merge pull request #4 from guanquann/admin-question-view
guanquann Sep 20, 2024
c40f85c
Add duplicate check for question creation
jolynloh Sep 20, 2024
58e051f
Fix navigation routes
nicolelim02 Sep 20, 2024
71503b9
Add duplicate check for update question
jolynloh Sep 20, 2024
b9db564
Edit package.json
jolynloh Sep 20, 2024
3706b11
Add character limit validation for question description
jolynloh Sep 20, 2024
3f1072c
Merge pull request #5 from jolynloh/BE/mongodbsetup
jolynloh Sep 20, 2024
2176d08
Merge pull request #6 from nicolelim02/feat/questions
nicolelim02 Sep 20, 2024
976fcf1
Integrate backend question service with frontend
guanquann Sep 20, 2024
951444d
Merge user service
guanquann Sep 20, 2024
21f3b88
Change file structure
guanquann Sep 20, 2024
ceef185
Add edit question page
guanquann Sep 21, 2024
d4d236b
Refractor code
guanquann Sep 21, 2024
25acf98
Fix merge conflicts
guanquann Sep 21, 2024
6c33cda
Merge branch 'development' of https://github.com/guanquann/cs3219-ay2…
guanquann Sep 21, 2024
622d15c
Update user service to typescript
guanquann Sep 21, 2024
90535e8
Add additional information to User schema
guanquann Sep 21, 2024
435a293
Add delete endpoint and document the apis
nicolelim02 Sep 21, 2024
b8d1773
Uninstall unused dependency
nicolelim02 Sep 21, 2024
29ff84c
Convert user service to TS
guanquann Sep 21, 2024
2589987
Update environment variables
guanquann Sep 21, 2024
028a506
Add user profile page
nicolelim02 Sep 21, 2024
f80dc69
Fix error
nicolelim02 Sep 21, 2024
0fb16ec
Refactor code
nicolelim02 Sep 21, 2024
ba96215
Add read endpoints
feliciagan Sep 21, 2024
b2e8328
Change to axios
guanquann Sep 22, 2024
793207f
Merge pull request #7 from guanquann/admin-question-view
ruiqi7 Sep 22, 2024
650d7a0
Merge branch 'development' into feat/questions
nicolelim02 Sep 22, 2024
29ffac1
Update question reducer to set error message
nicolelim02 Sep 22, 2024
849af5f
Fix linting issues
nicolelim02 Sep 22, 2024
fc45f03
change read API request type
feliciagan Sep 22, 2024
6bdb6a2
resolve merge conflict
feliciagan Sep 22, 2024
9266593
Merge pull request #8 from nicolelim02/feat/questions
ruiqi7 Sep 23, 2024
6ea317a
Merge pull request #9 from guanquann/user-service-backend
nicolelim02 Sep 23, 2024
8cc8d35
Merge branch 'development' into feat/users
nicolelim02 Sep 23, 2024
b688388
Set up swagger for api documentation
nicolelim02 Sep 23, 2024
9ce038a
Integrate backend and frontend
nicolelim02 Sep 23, 2024
8618bde
Modify api that fetches user by id
nicolelim02 Sep 23, 2024
0a55a23
Update api documentation
nicolelim02 Sep 23, 2024
0abeb97
Add freesolo autocomplete field for categories, clean code
guanquann Sep 23, 2024
0ef57ee
resolve merge conflict
feliciagan Sep 23, 2024
454ed1f
add read category endpoint
feliciagan Sep 23, 2024
da0938f
change readQuestionsList return field
feliciagan Sep 23, 2024
0a30922
Add question list page
ruiqi7 Sep 23, 2024
1a20c4f
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 23, 2024
03372f0
Fix cors error
nicolelim02 Sep 24, 2024
4e94624
Disable eslint
nicolelim02 Sep 24, 2024
e4fbc17
Merge pull request #10 from nicolelim02/feat/users
ruiqi7 Sep 24, 2024
1f411f3
Merge branch 'development' of https://github.com/guanquann/cs3219-ay2…
guanquann Sep 24, 2024
c79c851
Fix indentation
ruiqi7 Sep 24, 2024
d798d3e
Merge pull request #11 from feliciagan/be_question_read
ruiqi7 Sep 24, 2024
d9e5e71
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 24, 2024
4f60321
Merge pull request #12 from ruiqi7/feature/question-list
nicolelim02 Sep 24, 2024
8451c3e
Merge branch 'development' of https://github.com/guanquann/cs3219-ay2…
guanquann Sep 24, 2024
a2e4ebd
Remove .js extension
guanquann Sep 24, 2024
0113acc
Fix lint
guanquann Sep 24, 2024
71e8d43
Integrate backend and frontend
nicolelim02 Sep 24, 2024
9c0dd83
Wrap categories
nicolelim02 Sep 24, 2024
40b4841
Verify a user's auth state
nicolelim02 Sep 24, 2024
2818c18
Fix typo
nicolelim02 Sep 24, 2024
ba2a021
Merge pull request #13 from guanquann/admin-question-view
nicolelim02 Sep 25, 2024
13324f8
Merge branch 'development' into feat/questions
nicolelim02 Sep 25, 2024
daf3354
Fix lint
nicolelim02 Sep 25, 2024
9f7e6cb
Update github workflow
nicolelim02 Sep 25, 2024
a003b4a
Update dependencies
nicolelim02 Sep 25, 2024
4ed3fe0
Merge pull request #14 from nicolelim02/feat/questions
feliciagan Sep 25, 2024
0c5f684
Merge pull request #16 from nicolelim02/feat/users
feliciagan Sep 25, 2024
51b8da7
Add home page structure
jolynloh Sep 25, 2024
5cebc16
Integrate APIs for reading and deleting questions
ruiqi7 Sep 25, 2024
5c2c575
Fix bug in category autocomplete, add isAdmin to user token
guanquann Sep 26, 2024
04ed0f8
Update cors
nicolelim02 Sep 26, 2024
fc75bab
Update autocomplete
guanquann Sep 26, 2024
29def4b
Add form labels and align input components
jolynloh Sep 26, 2024
16ff3b5
Set up tests for frontend app
nicolelim02 Sep 26, 2024
2257ee4
Add styling for complexity input form control
jolynloh Sep 26, 2024
823ec82
Merge pull request #17 from guanquann/admin-question-view
guanquann Sep 26, 2024
19538c7
Add validation for match timeout input
jolynloh Sep 26, 2024
a674c80
Add confirmation dialog and error handling for question delete
ruiqi7 Sep 26, 2024
cd39672
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 26, 2024
4853448
Merge pull request #18 from nicolelim02/chore/cors
guanquann Sep 26, 2024
865eb3d
Modify homepage css
jolynloh Sep 26, 2024
f72b43a
Merge dev
jolynloh Sep 26, 2024
1f1d523
Check if user is admin for question edit and delete permissions
ruiqi7 Sep 26, 2024
4d9eb02
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 26, 2024
5a67210
Remove unused message
ruiqi7 Sep 26, 2024
87f2b58
Call API for category dropdown list
jolynloh Sep 26, 2024
b101d65
Attempt to add image
jolynloh Sep 26, 2024
35b8f6c
Fix lint errors
jolynloh Sep 26, 2024
e8b157b
Fix .env.sample file
jolynloh Sep 26, 2024
a0f5fda
add edit profile and password functionality
feliciagan Sep 26, 2024
f0c2488
pass check
feliciagan Sep 26, 2024
80ab7c8
pass check
feliciagan Sep 26, 2024
4f0b5e5
Merge pull request #19 from nicolelim02/chore/tests
guanquann Sep 27, 2024
ca6dea6
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 27, 2024
749087c
Update tests for not found component
ruiqi7 Sep 27, 2024
39a3157
resolve merge conflicts
feliciagan Sep 27, 2024
f35de04
update user service api
feliciagan Sep 27, 2024
b830fdb
disallow updating to empty first and last name
feliciagan Sep 27, 2024
c81680a
remove unused faker from user repo
feliciagan Sep 27, 2024
d110e8d
Update swagger.yml
feliciagan Sep 27, 2024
7209f2f
Set up signup, login and route protection based on user status
ruiqi7 Sep 27, 2024
7068d57
Add test for add questions
guanquann Sep 27, 2024
3c02f68
Fix lint
guanquann Sep 27, 2024
07cf4b9
Integrate sign up API
ruiqi7 Sep 27, 2024
2a2ce42
Change question form fields to sharp borders for consistency
ruiqi7 Sep 27, 2024
26edbd1
Merge pull request #20 from ruiqi7/feature/question-list
nicolelim02 Sep 27, 2024
4cbcfcd
Merge conflicts
guanquann Sep 27, 2024
13f909d
Get category dynamically
guanquann Sep 27, 2024
3e7ba87
Add form field validations
ruiqi7 Sep 27, 2024
597eb46
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 27, 2024
0aec78e
resolve merge conflicts and resolve comments
feliciagan Sep 27, 2024
ead9856
correct eslint errors
feliciagan Sep 27, 2024
efd5c39
Add visibility toggle for password field
ruiqi7 Sep 27, 2024
e863d15
Add error notifications for failed sign up or log in
ruiqi7 Sep 27, 2024
adb23d6
update profilesection test according to frontend modal changes
feliciagan Sep 27, 2024
2888fa8
Add unauthorized and loading pages
ruiqi7 Sep 27, 2024
c659144
Fix linting error
ruiqi7 Sep 27, 2024
9559acd
Add middleware to verify admin status for questions and set up tests
nicolelim02 Sep 28, 2024
d8a082a
Update tests setup
nicolelim02 Sep 28, 2024
4ce4a70
Remove unused imports
nicolelim02 Sep 28, 2024
2246f81
Merge pull request #22 from feliciagan/edit_profile
ruiqi7 Sep 28, 2024
c8d996a
Merge pull request #23 from guanquann/frontend-testing
ruiqi7 Sep 28, 2024
cf564ab
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 28, 2024
34dd2ff
Add first and last name to user creation
ruiqi7 Sep 28, 2024
c4c3664
Refactor code
ruiqi7 Sep 28, 2024
afa9755
Merge pull request #24 from ruiqi7/feature/user-authentication
nicolelim02 Sep 28, 2024
ed60d0b
Exclude testing
nicolelim02 Sep 28, 2024
57b92e0
Merge branch 'development' into feat/questions
nicolelim02 Sep 28, 2024
9b3cb79
Merge pull request #25 from nicolelim02/feat/questions
ruiqi7 Sep 28, 2024
3f8451a
Attach token in request headers for question create, edit and delete
ruiqi7 Sep 28, 2024
2cfa93c
Update .env.sample
nicolelim02 Sep 28, 2024
6d9006d
Merge pull request #27 from nicolelim02/feat/users
guanquann Sep 28, 2024
16a76bf
Update swagger docs
guanquann Sep 28, 2024
637fb46
Merge pull request #28 from guanquann/user-qns-docs
ruiqi7 Sep 28, 2024
38e964b
Merge pull request #26 from ruiqi7/feature/user-authentication
nicolelim02 Sep 28, 2024
02dc420
add call to backend for editing profile and password
feliciagan Sep 28, 2024
04382b0
remove TODO comments
feliciagan Sep 28, 2024
fb40dfa
rerender profile page after changes
feliciagan Sep 28, 2024
44c8016
Update readme
guanquann Sep 28, 2024
c366eb0
Update readme
guanquann Sep 28, 2024
2873da7
Fix markdown rendered and test cases
nicolelim02 Sep 28, 2024
d0994fd
Fix linting
nicolelim02 Sep 28, 2024
d98d3a5
Merge pull request #30 from guanquann/user-qns-docs
nicolelim02 Sep 29, 2024
7ee68ca
Merge pull request #29 from feliciagan/edit_profile
nicolelim02 Sep 29, 2024
bec19bb
Merge branch 'development' into feat/questions
nicolelim02 Sep 29, 2024
db9fe24
Reformat code using prettier
nicolelim02 Sep 29, 2024
1d054e1
Fix test case errors
nicolelim02 Sep 29, 2024
ce30232
FIx linting
nicolelim02 Sep 29, 2024
72487f9
Update profile test cases
nicolelim02 Sep 29, 2024
672cf5f
Merge pull request #31 from nicolelim02/feat/questions
guanquann Sep 29, 2024
e8ecfdf
Fix merge conflicts
jolynloh Sep 29, 2024
ba46b14
Add test cases for question list page
ruiqi7 Sep 29, 2024
4f8e7ea
Return question categories sorted alphabetically
ruiqi7 Sep 29, 2024
39a9a6b
Change form input component from Select to Autocomplete
jolynloh Sep 29, 2024
6c0754e
Fix lint errors
jolynloh Sep 29, 2024
4446e92
Make minor change to README
jolynloh Sep 29, 2024
d760d8a
Add test cases for sign up and login pages
ruiqi7 Sep 29, 2024
482d587
Comment out matching form temporarily
jolynloh Sep 29, 2024
f2500c7
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 29, 2024
01972e0
Remove unused imports and variables from commented out parts
jolynloh Sep 29, 2024
3f9c7cc
Merge pull request #21 from jolynloh/FE/homepage
nicolelim02 Sep 29, 2024
6097796
Update readme
nicolelim02 Sep 29, 2024
8b69b75
Merge pull request #32 from nicolelim02/chore/docs
guanquann Sep 29, 2024
5775c8e
Fix question filter bug
ruiqi7 Sep 29, 2024
729d6c9
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 29, 2024
a327287
Merge pull request #33 from ruiqi7/qa/test-cases
nicolelim02 Sep 29, 2024
75d5451
Update README
feliciagan Sep 29, 2024
7f3ae1b
Merge pull request #34 from feliciagan/edit_profile
ruiqi7 Sep 29, 2024
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
Prev Previous commit
Next Next commit
Modify api that fetches user by id
nicolelim02 committed Sep 23, 2024
commit 8618bdeb6d66e9a13933407be6c176423b8c67fd
2 changes: 1 addition & 1 deletion backend/user-service/routes/user-routes.ts
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ router.patch(

router.post("/", createUser);

router.get("/:id", verifyAccessToken, getUser);
router.get("/:id", getUser);

router.patch("/:id", verifyAccessToken, verifyIsOwnerOrAdmin, updateUser);

40 changes: 25 additions & 15 deletions frontend/src/components/ProfileSection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Avatar, Box, Button, Stack, Typography } from "@mui/material";
import { Avatar, Box, Button, Divider, Stack, Typography } from "@mui/material";
import React from "react";

type ProfileSectionProps = {
firstName: string;
@@ -15,11 +16,17 @@ const ProfileSection: React.FC<ProfileSectionProps> = (props) => {
<Box>
<Box sx={{ display: "flex", flexDirection: "column" }}>
<Box
sx={{ display: "flex", flexDirection: "row", alignItems: "center" }}
sx={(theme) => ({
display: "flex",
flexDirection: "row",
alignItems: "center",
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
})}
>
<Avatar sx={{ width: 56, height: 56 }} />
<Box sx={(theme) => ({ marginLeft: theme.spacing(2) })}>
<Typography fontSize={"h5.fontSize"}>
<Typography fontSize={"h6.fontSize"}>
{firstName} {lastName}
</Typography>
<Typography>@{username}</Typography>
@@ -35,18 +42,21 @@ const ProfileSection: React.FC<ProfileSectionProps> = (props) => {
</Typography>
</Box>
{isCurrentUser && (
<Stack
spacing={2}
sx={(theme) => ({
marginTop: theme.spacing(4),
marginBottom: theme.spacing(4),
})}
>
<Button variant="contained">Edit profile</Button>
<Button variant="contained" color="secondary">
Edit password
</Button>
</Stack>
<>
<Divider />
<Stack
spacing={2}
sx={(theme) => ({
marginTop: theme.spacing(4),
marginBottom: theme.spacing(4),
})}
>
<Button variant="contained">Edit profile</Button>
<Button variant="contained" color="secondary">
Edit password
</Button>
</Stack>
</>
)}
</Box>
);
10 changes: 2 additions & 8 deletions frontend/src/pages/Profile/index.tsx
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ type UserProfile = {
isAdmin: boolean;
biography?: string;
profilePictureUrl?: string;
createdAt: Date;
createdAt: string;
};

const ProfilePage: React.FC = () => {
@@ -31,15 +31,9 @@ const ProfilePage: React.FC = () => {
const { user } = auth;

useEffect(() => {
// temp user token obtained from the backend to test cors
const accessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2ZWU2MDI1MTQzOWQ1YWRhNTNhOGIyMiIsImlhdCI6MTcyNzA4MDMzOSwiZXhwIjoxNzI3Njg1MTM5fQ.rofXQgtvcGuEkucv78MTQgqrP0XtPdQ-XPISiW9V_JM";
userClient
.get(`/users/${userId}`, {
headers: { Authorization: `Bearer ${accessToken}` },
})
.get(`/users/${userId}`)
.then((res) => {
console.log(res.data.data);
setUserProfile(res.data.data);
})
.catch(() => setUserProfile(null));