Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
ccea0b4
SCRUM-75 implemented display settings and selected button
nicolelin322 Sep 20, 2024
4d47ed4
SCRUM-75 displayed light and dark images and added border, working on…
nicolelin322 Sep 24, 2024
a4fcdf7
SCRUM-75 selected dark and light img border display
nicolelin322 Sep 29, 2024
f5a9cf0
SCRUM-75 basic function for dark mode
nicolelin322 Oct 4, 2024
55f5f93
Merge branch 'main' of github.com:Study-Compass/Study-Compass into SC…
nicolelin322 Oct 8, 2024
4498851
SCRUM-75 added dark mode contect
nicolelin322 Oct 8, 2024
1df5d5e
SCRUM-75 edit dark mode context
nicolelin322 Oct 15, 2024
9473f82
SCRUM-75 finish dark mode context
nicolelin322 Oct 22, 2024
413412a
SCRUM-75 edited disply preference page
nicolelin322 Oct 25, 2024
06fc5a5
SCRUM-75 added save disply preference page
nicolelin322 Oct 25, 2024
0f55c5b
SCRUM-75 finished save button functionality and created a new page
nicolelin322 Oct 29, 2024
ad35904
Merge branch 'SCRUM-12-Events' of github.com:Study-Compass/Study-Comp…
nicolelin322 Nov 1, 2024
ec9aad0
SCRUM-75 editing the header of club page
nicolelin322 Nov 8, 2024
5cf6eab
SCRUM-75 editing the header of club page
nicolelin322 Nov 8, 2024
95f19ef
SCRUM-75 editing the header of club page
nicolelin322 Nov 8, 2024
33502c6
SCRUM-75 edited club header
nicolelin322 Nov 12, 2024
35cb6e6
SCRUM-75 completed club section
nicolelin322 Nov 15, 2024
faab449
SCRUM-75 added meeting schedule
nicolelin322 Nov 19, 2024
1d1e089
SCRUM-75 fixed meeting schedule
nicolelin322 Nov 22, 2024
bd05dd4
SCRUM-75 edited meeting schedule
nicolelin322 Dec 31, 2024
50f854c
SCRUM-12 adding tabs to full event
AZ0228 Nov 15, 2024
93dc184
SCRUM-54 adding quicky analytics
AZ0228 Nov 15, 2024
fb8affd
repeated visits
AZ0228 Nov 15, 2024
3c9ad2a
SCRUM-146 finished tab styling
AZ0228 Nov 17, 2024
4e93410
SCRUM-146 added popout animation
AZ0228 Nov 17, 2024
f7effed
SCRUM-146 added fade-in and fade-out
AZ0228 Nov 17, 2024
faf911a
SCRUM-146 menu select
AZ0228 Nov 17, 2024
58a19c5
SCRUM-146 added event getting with OIE
AZ0228 Nov 17, 2024
f1f481d
SCRUM-146 adding backend support for configuration
AZ0228 Nov 18, 2024
5dff541
SCRUM-146 added config
AZ0228 Nov 18, 2024
a2779ba
SCRUM-146 finished dynamic updating for checklist items
AZ0228 Nov 18, 2024
106df45
SCRUM-146 added approval and rejection, as well as status representation
AZ0228 Nov 19, 2024
cde8e0a
SCRUM-146 adapting useFetch hook to oie dash
AZ0228 Nov 20, 2024
b19b59a
SCRUM-146 making events view
AZ0228 Nov 21, 2024
723c0b6
SCRUM-89 adding role-based auth
AZ0228 Nov 21, 2024
0f4ff25
SCRUM-89 incorporating role based auth
AZ0228 Nov 21, 2024
770044b
SCRUM-54 adding new analytics
AZ0228 Nov 17, 2024
6aabe39
SCRUM-54 editing anayltics a little bit + login changes
AZ0228 Nov 17, 2024
ce4f794
refining anayltics
AZ0228 Nov 16, 2024
4f5627a
SCRUM-146 finished simlified events view
AZ0228 Nov 21, 2024
47328f0
SCRUM-146 adding loading
AZ0228 Nov 22, 2024
a00838c
SCRUM-54 enforcing https
AZ0228 Nov 26, 2024
09b3494
SCRUM-144 Events Calendar Setup
AZ0228 Dec 1, 2024
8346715
SCRUM-164 finished new badge routing
AZ0228 Dec 2, 2024
ace9d00
SCRUM-164 initializing new badge grant system
AZ0228 Dec 2, 2024
c144272
SCRUM-164-wrapping up badge adding
AZ0228 Dec 2, 2024
2bfbaa2
SCRUM-164 adjusting styling
AZ0228 Dec 2, 2024
889ee2f
SCRUM-164 more appealing + responsive styling
AZ0228 Dec 3, 2024
9016055
SCRUM-54-fixing minor bug:
AZ0228 Dec 3, 2024
a8f3755
SCRUM-54 quick bug fix
AZ0228 Dec 3, 2024
062d386
SCRUM-164 google login support
AZ0228 Dec 3, 2024
5dc59a1
SCRUM-164 google login support1
AZ0228 Dec 3, 2024
508ba08
SCRUM-144 styling calendar:
AZ0228 Dec 4, 2024
60aa8ce
SCRUM-144 backend event route
AZ0228 Dec 4, 2024
656dc46
SCRUM-144 enabling events rendering
AZ0228 Dec 4, 2024
26f1523
SCRUM-144 event row restructure
AZ0228 Dec 4, 2024
5fe4391
small tweak
AZ0228 Dec 4, 2024
7e39f28
fixing small error
AZ0228 Dec 4, 2024
dd16036
small fix
AZ0228 Dec 4, 2024
652c7ee
SCRUM-54 extending session length
AZ0228 Dec 5, 2024
4a35b77
SCRUM-54 removing debug steps
AZ0228 Dec 5, 2024
89f1b58
SCRUM-116 added get history and delete history routes
Phoenix9994 Oct 22, 2024
d829206
SCRUM-125 Club, Members, Followers Schema Created
Phoenix9994 Oct 25, 2024
10663e4
Get/Create/Edit/Delete Clubs
Phoenix9994 Nov 4, 2024
ad83732
SCRUM-125 Get/Create/Edit/Delete Clubs
Phoenix9994 Nov 4, 2024
6c436ad
SCRUM-125 Get/Create/Edit/Delete Clubs fixed errors
Phoenix9994 Nov 6, 2024
3040243
SCRUM-125 Added Profanity Blockers
Phoenix9994 Nov 6, 2024
73b9813
SCRUM-125 adding small fix to add first member to club
AZ0228 Nov 23, 2024
1de8580
SCRUM-125 adding club interactions
AZ0228 Nov 23, 2024
2f00edc
SCRUM-125 adding member club interactions
AZ0228 Nov 23, 2024
45edfe6
SCRUM-125 finsihed club creation
AZ0228 Nov 24, 2024
280edab
rebasing
AZ0228 Nov 30, 2024
ab07f7f
resolving conflict
AZ0228 Nov 30, 2024
53881ac
SCRUM-144-transition
AZ0228 Dec 1, 2024
d8beaf7
SCRUM-164 finished new badge routing
AZ0228 Dec 2, 2024
20c08d7
SCRUM-164 initializing new badge grant system
AZ0228 Dec 2, 2024
40abad5
SCRUM-155 on the club dashboard made the manage membership container
himekatie Nov 5, 2024
d56ba35
SCRUM-155 Finsihed template for member component and connected the da…
himekatie Nov 15, 2024
d6156c3
SCRUM-155 changed how the member and dashboard components switch when…
himekatie Nov 15, 2024
d683eec
SCRUM-155 on the manage button on the dash componeent under members m…
himekatie Nov 15, 2024
abb5a99
SCRUM-164 finished new badge routing
AZ0228 Dec 2, 2024
36c7a13
SCRUM-164 initializing new badge grant system
AZ0228 Dec 2, 2024
a22963e
SCRUM-125 finsihed club creation
AZ0228 Nov 24, 2024
ef01377
SCRUM-164 finished new badge routing
AZ0228 Dec 2, 2024
ea906dc
club merge
AZ0228 Dec 8, 2024
e6b0ae8
SCRUM-144 added month event hovering
AZ0228 Dec 8, 2024
f8a68e5
SCRUM-144 adding new events route, polishing styling on month component
AZ0228 Dec 9, 2024
8920b7e
SCRUM-144 changing club onboarding gradients, adding week view
AZ0228 Dec 9, 2024
bdb042a
SCRUM-54 adding base case to profanity function, adding check club na…
AZ0228 Dec 14, 2024
1f397d2
SCRUM-54 small quality of life improvement, styling the profile menu
AZ0228 Dec 14, 2024
244c1da
SCRUM-54 adding sections, renaming clubs to orgs in backend
AZ0228 Dec 14, 2024
3d62a81
SCRUM-54 implementing new card design
AZ0228 Dec 14, 2024
885bcf0
SCRUM-144 small changes with org structure
AZ0228 Dec 16, 2024
2cec96d
SCRUM-144 adding member interface
AZ0228 Dec 31, 2024
6f87d0a
adding dump
AZ0228 Dec 31, 2024
2bb83ba
SCRUM-164-wrapping up badge adding
AZ0228 Dec 2, 2024
b9796c6
SCRUM-54 fixed small analytics bug
AZ0228 Dec 7, 2024
3d5c6a1
SCRUM-164 initializing new badge grant system
AZ0228 Dec 2, 2024
3a23381
SCRUM-164-wrapping up badge adding
AZ0228 Dec 2, 2024
c07818e
fixing merge bug
AZ0228 Dec 31, 2024
e442213
adding backend connection
AZ0228 Dec 31, 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
6 changes: 6 additions & 0 deletions backend/.env.me
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#/!!!!!!!!!!!!!!!!!!!!.env.me!!!!!!!!!!!!!!!!!!!!!!!/
#/ credential file. DO NOT commit to source control /
#/ [how it works](https://dotenv.org/env-me) /
#/--------------------------------------------------/

DOTENV_ME="me_2876f4651cca3df3e9bad1256d77c64b7fe75eb300047597538726fbdc0680e8"
25 changes: 25 additions & 0 deletions backend/.env.vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#/-------------------.env.vault---------------------/
#/ cloud-agnostic vaulting standard /
#/ [how it works](https://dotenv.org/env-vault) /
#/--------------------------------------------------/

# development
DOTENV_VAULT_DEVELOPMENT="CMIx45zMeUvOZgr36iRsrH4Du2UirHqfgfbvaZhn5KB9qr/CxlXwqnbJttXmFNye3XwFcZyoGKG6I6lfjBbzKNlNFGfzCu1jJ+y44iIbZqcZswwyhgYP5BvAir9+a1pTwtmIp2suZ9ofSs9nTwRmTpi4/75bwNG9wBm/5xGY++fJ5qacM+zOEAnvfeb6Wl/b3Adq7sBTjtiXTK4ByMmLFeOwm6nE7InNG665EBmdQE+UVd7GXpxCTsGZrWDxyLfUvbL15iF03vL3GkG2I+C+SkCOuGGkBN8Rv5RnNFXi9yUeG2eNCRYXGTEKyXYEC4LGT8Infq7RRAWvsJxe59aDPHdGyiHHa21EDMi63sEHTSdrXiqq9PwMu0SUg/NNx9xaANBWtvKMLAW0zmclq7lua3ewUHTQQoe8fDlWmviVCfPumG5K+QnwJQP9i8c77kdKZQHhkKG3IfAO06s8cMOFJ+25Md5JbgFXiz05GOdxRW4AFEHATG+yEIfe0rWWaNlGAXr4Ws4em2NOML6ULthGEbaOZt/w6JxNsrQkZYrqFu/LxZdp/+QlcXeYbcT4TVs0lK0B26H4O/Lly3GN3luvnM6/c8IXyhoz0Ytp5zqQISo/RK//JXA+VrM9y6fa536y4nKHboGOMr83NR7wz7WFWBsjuFD66Zob23S0AmRQLXr9/rnZYYRpeMo9yOtluWiVAP6bh91OGziUHHh+03MWOP/rgz7CVT55jDQbAL1wMkJxfZnlx2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ION=1

#/----------------settings/metadata-----------------/
DOTENV_VAULT="vlt_b7c9def2e36a7ec5674985772e9f60c1ef0b75063e493d0136b80bcc17ed11ca"
DOTENV_API_URL="https://vault.dotenv.org"
DOTENV_CLI="npx dotenv-vault@latest"
28 changes: 18 additions & 10 deletions backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const multer = require('multer');
require('dotenv').config();
const { createServer } = require('http');
const { Server } = require('socket.io');
const enforce = require('express-sslify');

const app = express();
const port = process.env.PORT || 5001;
Expand All @@ -25,6 +26,7 @@ const io = new Server(server, {
});

if (process.env.NODE_ENV === 'production') {
app.use(enforce.HTTPS({ trustProtoHeader: true }));
const corsOptions = {
origin: ['https://www.study-compass.com', 'https://studycompass.com'],
optionsSuccessStatus: 200 // for legacy browser support
Expand Down Expand Up @@ -65,17 +67,32 @@ const classroomChangeRoutes = require('./routes/classroomChangeRoutes.js');
const ratingRoutes = require('./routes/ratingRoutes.js');
const searchRoutes = require('./routes/searchRoutes.js');
const eventRoutes = require('./routes/eventRoutes.js');
const oieRoutes = require('./routes/oie-routes.js');
const orgRoutes = require('./routes/orgRoutes.js');

app.use(authRoutes);
app.use(dataRoutes);
app.use(friendRoutes);
app.use(userRoutes);
app.use(analyticsRoutes);app.use(eventRoutes);
app.use(analyticsRoutes);
app.use(eventRoutes);

app.use(classroomChangeRoutes);
app.use(ratingRoutes);
app.use(searchRoutes);
app.use(eventRoutes);
app.use(oieRoutes);
app.use(orgRoutes);

// Serve static files from the React app in production
if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, '../frontend/build')));

// The "catchall" handler: for any request that doesn't match one above, send back React's index.html file.
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '../frontend/build/index.html'));
});
}

//deprecated, should lowk invest in this
// app.get('/update-database', (req, res) => {
Expand Down Expand Up @@ -129,15 +146,6 @@ app.post('/upload-image/:classroomName', upload.single('image'), async (req, res
}
});

// Serve static files from the React app in production
if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, '../frontend/build')));

// The "catchall" handler: for any request that doesn't match one above, send back React's index.html file.
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '../frontend/build/index.html'));
});
}

// Socket.io functionality
io.on('connection', (socket) => {
Expand Down
27 changes: 22 additions & 5 deletions backend/middlewares/verifyToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,30 @@ const verifyToken = (req, res, next) => {

if (token == null) return res.sendStatus(401); // if there's no token

jwt.verify(token, process.env.JWT_SECRET, (err, user) => {
jwt.verify(token, process.env.JWT_SECRET, (err, decodedToken) => {
if (err) return res.sendStatus(403); // if the token is not valid
req.user = user;
// if (decodedToken && decodedToken.exp) {
// const currentTime = Math.floor(Date.now() / 1000); // Current time in seconds
// const timeLeft = decodedToken.exp - currentTime; // Time left in seconds
// const hoursLeft = (timeLeft / 3600).toFixed(2); // Convert to hours and format to 2 decimal places

// console.debug(`Token has ${hoursLeft} hours left until expiration.`);
// }
req.user = decodedToken;
next();
});
};

function authorizeRoles(...allowedRoles) {
return (req, res, next) => {
const { roles } = req.user;
if (!roles || !allowedRoles.some(role => roles.includes(role))) {
return res.status(403).json({ message: 'Forbidden' });
}
next();
};
}

const verifyTokenOptional = (req, res, next) => {
const authHeader = req.headers['authorization'];
const token = authHeader && authHeader.split(' ')[1]; // Bearer TOKEN
Expand All @@ -22,13 +39,13 @@ const verifyTokenOptional = (req, res, next) => {
return next();
}

jwt.verify(token, process.env.JWT_SECRET, (err, user) => {
jwt.verify(token, process.env.JWT_SECRET, (err, decodedToken) => {
if (!err) {
req.user = user; // Set the user if the token is valid
req.user = decodedToken; // Set the user if the token is valid
}
// Proceed regardless of token validity
next();
});
};

module.exports = { verifyToken, verifyTokenOptional };
module.exports = { verifyToken, verifyTokenOptional, authorizeRoles };
31 changes: 31 additions & 0 deletions backend/migrations/version1.10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
import os
from dotenv import load_dotenv

from helpers.datamigration import addNewField, updateVersion


# ============================== starter code ==========================================

VERSION = 1.10 # set version here

load_dotenv()
uri = os.environ.get('MONGO_URL_LOCAL')
database = input("Indicate which database you would like to update (d for development or p for production): ").strip()
if(database == "d"):
pass
elif (database == "p"):
sure = input("WARNING: This will effect a production database, type 'studycompass' to proceed: ").strip()
if(sure.lower() == 'studycompass'):
uri = os.environ.get('MONGO_URL')
else:
exit(1)
else:
print(f"Improper usage: invalid input {database}")

# =====================================================================================

addNewField(uri, "users", {"roles" : ["user"]})

updateVersion(uri, VERSION)
31 changes: 31 additions & 0 deletions backend/migrations/version1.12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
import os
from dotenv import load_dotenv

from helpers.datamigration import addNewField, updateVersion


# ============================== starter code ==========================================

VERSION = 1.10 # set version here

load_dotenv()
uri = os.environ.get('MONGO_URL_LOCAL')
database = input("Indicate which database you would like to update (d for development or p for production): ").strip()
if(database == "d"):
pass
elif (database == "p"):
sure = input("WARNING: This will effect a production database, type 'studycompass' to proceed: ").strip()
if(sure.lower() == 'studycompass'):
uri = os.environ.get('MONGO_URL')
else:
exit(1)
else:
print(f"Improper usage: invalid input {database}")

# =====================================================================================

addNewField(uri, "users", {"clubAssociations" : []})

updateVersion(uri, VERSION)
7 changes: 7 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"date-fns": "^4.1.0",
"dotenv": "^16.3.2",
"express": "^4.18.2",
"express-sslify": "^1.2.0",
"google-auth-library": "^9.4.2",
"googleapis": "^131.0.0",
"jsonwebtoken": "^9.0.2",
Expand Down
Loading