Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

Commit 646a024

Browse files
authored
Merge pull request #9 from OS-Builders/maincontainer
Maincontainer
2 parents c15614a + 3517725 commit 646a024

32 files changed

Lines changed: 1429 additions & 149 deletions

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,90 @@
11
# Task Pro
2+
3+
Task Pro is an intuitive web application crafted to streamline task and project management. It empowers users of all proficiency levels to enhance their time management and organizational abilities with its user-friendly interface. Whether you opt for private usage or collaboration, Task Pro offers a comprehensive solution for creating, organizing, and sharing projects seamlessly.
4+
5+
## Project Frames
6+
![Project Frame](src/assets/projectFrame.png)
7+
8+
9+
10+
## Features
11+
12+
### User Sign-Up and Login
13+
- Easily create a user profile to personalize user experience.
14+
- Secure authentication ensures your private boards are only accessible to you.
15+
![Authentication](src/assets/authPage.png)
16+
17+
18+
19+
### Board Management
20+
- Create new board with ease.
21+
- Organize your task for different stage for efficiently managing a project.
22+
23+
![Dashboard](src/assets/Dashboard.png)
24+
25+
26+
![taskCreation](src/assets/taskCreation.png)
27+
28+
29+
30+
31+
## Front End
32+
33+
- Developed using **React** for a responsive and dynamic user interface.
34+
- Utilizes **React Router** for smooth navigation between pages.
35+
- Stylish and customizable design with **SCSS** for a modern look and organized styling.
36+
37+
38+
## Back End
39+
40+
- Powered by **Node.js** and **Express** for robust server-side functionality.
41+
- Data storage and retrieval are handled by **MongoDB**, ensuring data persistence and flexibility.
42+
43+
44+
## Stretch Features
45+
46+
In the future, we plan to introduce the following features:
47+
48+
- Keep your project sets private for personal use or collaborate them with others.
49+
- Share sets can be accessed together with multiple method of invites, keeping team on the same page.
50+
- Enhance the Project-sharing system with comments for better communication.
51+
- Drag and drop to improve user experiences.
52+
- Light and Dark mode.
53+
- OTP/Email 2 step authentication.
54+
55+
56+
## Technologies Used
57+
58+
59+
**Front End:**
60+
- **React**
61+
- **React Router**
62+
- **React Portal**
63+
- **SCSS**
64+
65+
**Back End:**
66+
- **Node.js**
67+
- **TypeScript**
68+
- **Express**
69+
- **MongoDB**
70+
- **Vite**
71+
72+
73+
## To Contribute or Use the Application
74+
75+
**Step 1**. Clone repo to code editor
76+
77+
**Step 2**. Run npm install to install all dependencies
78+
79+
**Step 3**. Make sure node version is 18.17.1 or older, can use nvm to install the needed version.
80+
81+
**Step 4**. Create env file and make sure to have ```PORT = 3000``` and ```MONGO_URI = (Mongodb connection URI)```
82+
83+
**Step 5**. start the project with ```npm start``` or ```npm run dev``` (for dev mode)
84+
85+
#### Authors
86+
87+
- Nam Ha: [Github](https://github.com/username)
88+
89+
- John Costello: [Github](https://github.com/johnlcos)
90+

server/controllers/boardsController.ts

Lines changed: 97 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import User from '../models/userModel.ts';
2-
import Board from '../models/boardModel.ts';
3-
import { NextFunction, Request, Response } from 'express';
4-
import { BoardListItemState } from '../../src/types.ts';
1+
import User from "../models/userModel.ts";
2+
import Board from "../models/boardModel.ts";
3+
import { NextFunction, Request, Response } from "express";
4+
import { BoardListItemState, BoardType } from "../../src/types.ts";
55

66
const boardsController = {
77
getMyBoards: async (req: Request, res: Response, next: NextFunction) => {
88
try {
99
// find all boards beloning to the user, push board names into an array and save on locals
10-
console.log('req.params.userId: ', req.params.userId);
1110
const user = await User.findOne({ _id: req.params.userId }).populate(
12-
'boards'
11+
"boards"
1312
);
1413
if (!user) {
1514
return next({
1615
log: `boardsController.getMyBoards ERROR: User cannot be found.`,
1716
status: 500,
18-
message: { err: 'Cannot find user.' },
17+
message: { err: "Cannot find user." },
1918
});
2019
}
2120
res.locals.boards = user.boards;
@@ -25,7 +24,7 @@ const boardsController = {
2524
return next({
2625
log: `boardssController.getMyBoards ERROR: ${err}`,
2726
status: 500,
28-
message: { err: 'Error getting my boards' },
27+
message: { err: "Error getting my boards" },
2928
});
3029
}
3130
},
@@ -35,24 +34,21 @@ const boardsController = {
3534
next: NextFunction
3635
) => {
3736
try {
38-
console.log('res.locals.boards: ', res.locals.boards);
3937
const namesAndIds: BoardListItemState[] = [];
40-
res.locals.boards.forEach((board: any) => {
41-
console.log('board.name: ', board.name);
38+
res.locals.boards.forEach((board: BoardType) => {
4239
namesAndIds.push({
4340
name: board.name,
4441
id: board._id,
4542
});
4643
});
4744
res.locals.namesAndIds = namesAndIds;
48-
console.log('res.locals.namesAndIds: ', res.locals.namesAndIds);
4945
return next();
5046
} catch (err) {
5147
// pass error through to global error handler
5248
return next({
5349
log: `boardssController.getBoardNamesAndIds ERROR: ${err}`,
5450
status: 500,
55-
message: { err: 'Error refining boards down to names and ids' },
51+
message: { err: "Error refining boards down to names and ids" },
5652
});
5753
}
5854
},
@@ -73,7 +69,7 @@ const boardsController = {
7369
return next({
7470
log: `boardssController.createBoard ERROR: ${err}`,
7571
status: 500,
76-
message: { err: 'Error creating new board' },
72+
message: { err: "Error creating new board" },
7773
});
7874
}
7975
},
@@ -89,30 +85,110 @@ const boardsController = {
8985
return next({
9086
log: `boardssController.assignNewBoard ERROR: ${err}`,
9187
status: 500,
92-
message: { err: 'Error assigning board to user' },
88+
message: { err: "Error assigning board to user" },
9389
});
9490
}
9591
},
9692
getCurrentBoard: async (req: Request, res: Response, next: NextFunction) => {
9793
try {
98-
// find all boards beloning to the user, push board names into an array and save on locals
99-
const board = await User.findOne({ _id: req.params.boardID });
100-
console.log(board);
94+
// obtain the user document
95+
const user = await User.findOne({ _id: req.query.user }).populate(
96+
"boards"
97+
);
98+
if (!user) {
99+
return next({
100+
log: `boardsController.getCurrentBoard ERROR: User cannot be found.`,
101+
status: 500,
102+
message: { err: "Cannot find board." },
103+
});
104+
}
105+
// Find the board by ID
106+
const board = user.boards.find(
107+
(boardObj) => boardObj._id.toString() === req.query.board
108+
);
101109
if (!board) {
102110
return next({
103111
log: `boardsController.getCurrentBoard ERROR: Board cannot be found.`,
104112
status: 500,
105-
message: { err: 'Cannot find board.' },
113+
message: { err: "Cannot find board." },
106114
});
107115
}
108-
res.locals.boardInfo = board;
116+
res.locals.board = board;
109117
return next();
110118
} catch (err) {
111119
// pass error through to global error handler
112120
return next({
113121
log: `boardssController.getCurrentBoard ERROR: ${err}`,
114122
status: 500,
115-
message: { err: 'Error getting current board' },
123+
message: { err: "Error getting current board" },
124+
});
125+
}
126+
},
127+
getBoardFromId: async (req: Request, res: Response, next: NextFunction) => {
128+
try {
129+
// obtain the user document
130+
const board = await Board.findOne({ _id: req.params.boardId });
131+
res.locals.board = board;
132+
return next();
133+
} catch (err) {
134+
// pass error through to global error handler
135+
return next({
136+
log: `boardssController.getBoardFromId ERROR: ${err}`,
137+
status: 500,
138+
message: { err: "Error getting board" },
139+
});
140+
}
141+
},
142+
deleteBoard: async (req: Request, _res: Response, next: NextFunction) => {
143+
try {
144+
await Board.findOneAndDelete({
145+
_id: req.params.boardId,
146+
});
147+
console.log("board deleted");
148+
return next();
149+
} catch (err) {
150+
// pass error through to global error handler
151+
return next({
152+
log: `tasksController.deleteBoard ERROR: ${err}`,
153+
status: 500,
154+
message: { err: "Error deleting board" },
155+
});
156+
}
157+
},
158+
editBoard: async (req: Request, res: Response, next: NextFunction) => {
159+
try {
160+
const editedBoard = await Board.findByIdAndUpdate(
161+
req.body.id,
162+
{
163+
name: req.body.name,
164+
},
165+
{ new: true }
166+
);
167+
console.log("editedBoard: ", editedBoard);
168+
res.locals.board = editedBoard;
169+
return next();
170+
} catch (err) {
171+
// pass error through to global error handler
172+
return next({
173+
log: `tasksController.editBoard ERROR: ${err}`,
174+
status: 500,
175+
message: { err: "Error editing Board" },
176+
});
177+
}
178+
},
179+
pullBoard: async (req: Request, res: Response, next: NextFunction) => {
180+
try {
181+
await User.updateOne(
182+
{ _id: res.locals.board.boardOwner },
183+
{ $pull: { boards: req.params.boardId } }
184+
);
185+
return next();
186+
} catch (err) {
187+
// pass error through to global error handler
188+
return next({
189+
log: `tasksController.pullTask ERROR: ${err}`,
190+
status: 500,
191+
message: { err: "Error pulling Task" },
116192
});
117193
}
118194
},

0 commit comments

Comments
 (0)