0% found this document useful (0 votes)
66 views50 pages

Dbms Report Signed

The document presents a project report on 'Study Sync', a web-based application aimed at enhancing students' academic experience by centralizing study resources, improving time management, and fostering collaboration. Key features include digital note sharing, study groups, a Pomodoro timer, and a notification system, developed using technologies like React.js and Node.js. The report details the project's database design, implementation, and future enhancements such as AI recommendations and gamified features.

Uploaded by

hrishitaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views50 pages

Dbms Report Signed

The document presents a project report on 'Study Sync', a web-based application aimed at enhancing students' academic experience by centralizing study resources, improving time management, and fostering collaboration. Key features include digital note sharing, study groups, a Pomodoro timer, and a notification system, developed using technologies like React.js and Node.js. The report details the project's database design, implementation, and future enhancements such as AI recommendations and gamified features.

Uploaded by

hrishitaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

STUDY SYNC

A PROJECT REPORT
Submitted by
HRISHITA RAJ [RA2311029010012]

YOGITA JHA [RA231102010035]

Under the Guidance of

Dr. P. Visalakshi

Associate Professor, Department of Networking and Communications

in partial fulfilment of the requirements for the degree of


BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE AND ENGINEERING
With specialization in Computer Networking

DEPARTMENT OF NETWORKING AND


COMMUNICATIONS
COLLEGE OF ENGINEERING AND TECHNOLOGY
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
KATTANKULATHUR– 603203
MAY 2025
ABSTRACT

In the modern academic environment, students face challenges like scattered study
materials, ineffective time management, and limited collaborative opportunities. Study
Sync is a comprehensive web-based application designed to address these issues by
centralizing academic resource sharing, enhancing productivity, and promoting
collaborative learning. The platform integrates key features including digital note
sharing, collaborative study groups, a Pomodoro timer, to-do lists, and a real-time
notification system. Developed using React.js, Node.js, Python, and MySQL, Study
Sync ensures secure authentication, efficient data management, and a responsive user
interface. This project aims to improve students’ academic experience by providing an
all-in-one solution for study planning and resource collaboration. Future enhancements
include AI-powered study recommendations, LMS integrations, and gamified features
to further enrich user engagement and academic productivity.

(ii)
TABLE OF CONTENTS

Chapter Chapter Name Page No


No

Introduction

1. Problem understanding, Identification of Entity and 1


Relationships, Construction of DB using ER Model for the
project

Design of Relational Schemas, Creation of Database Tables


2. 3
for the project.

Complex queries based on the concepts of constraints, sets,


3. 6
joins, views, Triggers and Cursors.

Analysing the pitfalls, identifying the dependencies, and


4. 10
applying normalizations

Implementation of concurrency control and recovery


5. 19
mechanisms

6. Code for the project 21

7. Result (Screen shots of the implementation with front end) 36

8. NPTEL Course 42

9. Screenshot of Chart activity 1 44

10. Screenshot of Chart activity 2 45

11. Conclusion 46

(iii)
CHAPTER – 1
INTRODUCTION

In the current academic environment, students face several obstacles in managing their
academic resources, time, and collaborative learning opportunities. Study Sync is
designed to provide a centralized platform for sharing academic materials, organizing
study sessions, managing tasks, and collaborating effectively. The platform integrates
various features including digital note sharing, study groups, Pomodoro-based time
management, notifications, and resource rating to enhance the overall academic
productivity of students.

1.1 Problem Understanding:


Students often struggle with scattered study materials, ineffective time management,
and lack of communication within study groups. Without a centralized platform,
resources remain difficult to access, deadlines are missed, and collaboration becomes
inefficient. There’s also a need for timely reminders and productivity tools to maintain
academic discipline.

1.2 Identification of Entity and Relationships:


To develop this system, the following key entities and their relationships were
identified:
 Users — students and faculty using the platform
 Courses — subjects or modules under which resources are shared
 Resources — academic notes, PDFs, or documents uploaded by users
 Study_groups — collaborative study circles
 Pomodoro_sessions — Pomodoro session records
 Todos — user-defined task lists
 Reminder — scheduled notifications
 Resource_Rating — ratings and reviews for uploaded resources

1.3 Construction of Database using ER Model:


An Entity-Relationship (ER) Diagram was created to model these entities and their
interconnections. The ER diagram represents the logical structure of the database,
illustrating how data is connected and how different entities interact with each other
within the system.

1
ER DIAGRAM

2
CHAPTER 2
DESIGN OF RELATIONAL SCHEMAS

Based on the identified entities and their relationships from the ER model, relational
schemas were designed to structure the database effectively. Each entity was mapped
to a table, with primary keys and appropriate foreign key relationships established to
maintain data integrity.
The relational schemas for the project are as follows:
 User (User_ID, Name, Email, Password, Role)
 Course (Course_ID, Course_Name, Instructor_ID)
 Resource (Resource_ID, Resource_Name, Resource_Type, Upload_Date,
Uploaded_By, Course_ID)
 Study_Group (Group_ID, Group_Name, Created_By, Creation_Date)
 Group_Member (Group_ID, User_ID)
 Pom_Sesh (Session_ID, User_ID, Session_Date, Focus_Minutes)
 ToDo(ToDo_ID, User_ID, Task_Name, Due_Date, Status)
 Reminder(Reminder_ID, User_ID, Reminder_Text, Reminder_DateTime)
 Resource_Rating(Rating_ID, User_ID, Resource_ID, Rating, Review)
These schemas reflect a normalized, scalable, and efficient design suited for handling
multiple users, resources, and collaborative academic activities.
2.1 Creation of Database Tables:
1. Users Table:
id name email password role

1 Hrishita Raj [email protected] Hrishi123 Student

2 Yogita Jha [email protected] Yj1935 Student

3 Gargi Mehta [email protected] Gm123 Student

2. Todos Table:
id User_id text completed priority Due_date notes
1 1 Complete dbms 0 high 2025-05-07 Revise

2 2 Report 0 Medium 2025-05-09 Get printout

3 3 Submission 1 High 2025-05-10 In cabin 123

3
3. Pomodoro Sessions Table:

Id User_id mode start_time End_time Duration_seconds


1 1 Work 25/05/07 10:00:00 25/05/07 1500
10:25:00
2 2 Short 25/04/08 11:00:00 25/04/08 300
11:05:00
3 3 long 25/05/10 15:00:00 25/05/10 2700
15:45:00

4. Resources Table:

Id Title Subject Res_type Description

1 SQL basics Dbms Link Learn

2 Improve design Ai/ml File Make changes

3 Learn docker devops file Step by step

5. Study Groups Table:

Id name Desc Subject Created_at


1 Js ninjas Learn and Programming 2025-05-07 09:30:00
discuss

2 Ai enthuse Advanced js Ai/ml 2025-05-08 09:40:00


3 Ui/ux creators Design best design 2025-05-17 10:30:00
practices

4
6. Resource Rating Table:

Id User_id Resource_id Rating Review Rated_on


1 1 1 5 Well-structured 2025-05-07 10:00:00

2 2 2 4 Great content 2025-06-07 11:00:00


3 3 3 5 Excellent guide 2025-05-09 12:30:00

7. Courses Table:

id name desc instructor created_at


1 SQL mastery Learn SQL Hrishita Raj 2025-05-07 11:00:00
2 Js essentials Js fundamentals Yogita Jha 2025-06-07 11:30:00
3 ML 101 Intro to ML Gargi Mehta 2025-05-09 10:00:30
4 UI/UX basics Explore UI/UX Ayush Dinesh 2025-06-08 10:40:00

8. Study_group_topics Table:

id Grp_id title Posted_by Posted_on desc


1 1 Advanced Sql 1 2025-05-07 12:00:00 Discuss
optimization
2 2 Async Js 2 2025-05-07 12:00:00 Async/await

3 3 Neural Network 3 2025-05-07 12:00:00 Understanding


deep learning
4 4 Modern UI 4 2025-05-07 12:00:00 Best practices

5
CHAPTER 3
COMPLEX QUERIES ON THE CONCEPT OF CONSTRAINTS,
SETS, JOINS, VIEWS, TRIGGERS AND CURSORS

3.1 Constraints:
-- Add UNIQUE constraint to the email column
ALTER TABLE users
ADD CONSTRAINT unique_email UNIQUE (email);

-- Add NOT NULL constraint to the password column


ALTER TABLE users
MODIFY password VARCHAR(255) NOT NULL;

-- Set a DEFAULT value for the role column


ALTER TABLE users
MODIFY role ENUM('student', 'admin') DEFAULT 'student';

3.2 Sets:
1. UNION:
SELECT name FROM courses
UNION
SELECT name FROM study_groups;

2. EXCEPT:
SELECT name FROM courses
EXCEPT
SELECT name FROM study_groups;

6
3.3 Joins:
1. LEFT JOIN:
SELECT users.name, todos.text
FROM users
LEFT JOIN todos ON users.id = todos.user_id;

2. RIGHT JOIN:
SELECT study_groups.name, study_group_topics.title
FROM study_groups
RIGHT JOIN study_group_topics ON study_groups.id =
study_group_topics.group_id;

3. FULL JOIN:
SELECT users.name, pomodoro_sessions.mode
FROM users
LEFT JOIN pomodoro_sessions ON users.id = pomodoro_sessions.user_id
UNION
SELECT users.name, pomodoro_sessions.mode
FROM users
RIGHT JOIN pomodoro_sessions ON users.id = pomodoro_sessions.user_id;

4. SELF JOIN:
SELECT a.name AS 'User1', b.name AS 'User2'
FROM users a, users b
WHERE a.id != b.id;

7
3.4 Views:
CREATE VIEW user_course_view AS
SELECT users.name AS user_name, courses.name AS course_name
FROM users
INNER JOIN courses ON users.id = courses.instructor;

SELECT * FROM user_course_view;

3.5 Trigger:
DELIMITER $$

CREATE TRIGGER after_todos_insert


AFTER INSERT ON todos
FOR EACH ROW
BEGIN
-- Insert into action_log table when a new todo is added
INSERT INTO action_log (user_id, action, created_at)
VALUES (NEW.user_id, CONCAT('Added new todo: ', NEW.text), NOW());
END $$

DELIMITER ;

3.6 Cursor:
DELIMITER $$

CREATE PROCEDURE process_users()


BEGIN
-- Declare variables
DECLARE done INT DEFAULT 0;
8
DECLARE user_name VARCHAR(100);
DECLARE user_email VARCHAR(100);

-- Declare cursor
DECLARE user_cursor CURSOR FOR
SELECT name, email FROM users;

-- Declare handler for when no more rows are found


DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

-- Open cursor
OPEN user_cursor;

-- Loop through each row in the cursor


read_loop: LOOP
FETCH user_cursor INTO user_name, user_email;
IF done THEN
LEAVE read_loop;
END IF;

-- Example action: Insert into another table (action_log)


INSERT INTO action_log (user_name, user_email, action)
VALUES (user_name, user_email, 'Processed user');
END LOOP;

-- Close cursor
CLOSE user_cursor;
END $$
DELIMITER ;
9
CHAPTER 4
ANALYSING PITFALLS, IDENTIFYING DEPENDENCIES AND
APPLYING NORMALIZATIONS

4.1 Pitfalls:
1. Users Table:
ENUM role: Difficult to extend (e.g., adding ‘moderator’ requires schema
change). Better to use a roles table.

2. Todo Table:
No ON DELETE behaviour: If a user is deleted, todos could become orphaned
unless cascading is specified.

3. Pomodoro Sessions Table:


Data type mismatch: user_id is VARCHAR (255) but should be INT (to match
users.id).

4. Resources Table:
resource_type as a VARCHAR with default ‘link’ could lead to inconsistent
values

5. Study Groups Table:


No owner/admin field: Unclear who created or manages the group.

6. Courses Table:
No mechanism for assigning students to courses (e.g., missing enrollments
table)

7. Resource Rating Table:


No constraint on one user rating a resource only once — could allow duplicate
ratings.

8. Study Groups Topic Table:


No constraints on uniqueness of titles within a group

4.2 Functional Dependencies:


1. Users Table:
id → name, email, password, role
email → id, name, password, role

10
2. Todos Table:
id → user_id, text, completed, priority, due_date, notes

3. Pomodoro Sessions Table:


id → user_id, mode, start_time, end_time, duration_seconds
start_time → end_time, duration_seconds

4. Resources Table:
id → title, description, subject, resource_url, resource_type, created_at
resource_url → id

5. Study Groups Table:


id → name, description, subject, created_at

6. Courses Table:
id → name, description, instructor, created_at
name ↛ instructor

7. Resource Rating Table:


id → user_id, resource_id, rating, review, rated_on
user_id, resource_id → rating, review, rated_on

8. Study Groups Topic Table:


id → group_id, title, description, posted_by, posted_on
group_id, title → description, posted_by, posted_on

4.3 Normalization:
1. 1NF:
pomodoro_sessions Table:

11
Violation:
 user_info is a composite value includes both ID and name.
 mode has multiple values: “long, focus”.
 duration is stored as text, not numeric.

Apply 1NF:
1NF compliant Table:

The last unnormalized row with mode = long, focus is now split into two
atomic rows.

2. 2NF:

tasks Table:

Why This Violates 2NF:

 Composite key = (task_id, user_id)


 Then user_name depends only on user_id, not on the whole key → partial
dependency.

12
Apply 2NF:

tasks Table:

users Table:

Now, each non-key column depends only on the full primary key of its table:

 In tasks: task_id is the key; all columns depend on it.


 In users: user_id is the key, user_name depends on it.

3. 3NF:

goals Table:

Violations:
 user_name depends on user_id, not goal_id.
 goal_type_description depends on goal_type, not goal_id.
These are transitive dependencies, violating 3NF.

13
Apply 3NF:
goals Table:

users Table:

goal_types Table:

Now, no transitive dependencies: each non-key attribute depends only on the key of
its table.

4. BCNF:

resource_access Table:

14
Violations:

 resource_id → resource_name → resource_id is not a superkey.


 user_id → user_role → user_id is not a superkey.
 These violate BCNF because they are non-trivial dependencies where the left
side is not a candidate key.

Apply BCNF:

resources Tables:

users Table:

resource_access Table:

15
All functional dependencies have their determinants as superkeys in their respective
tables.

5. 4NF:

user_skills_projects Table:

Violations:

 skills and projects are unrelated — they are independent multi-valued


facts for each user.
 This leads to multi-valued dependencies

Apply 4NF:

user_skills Table:

16
user_Projects Table:

Each table has only one multi-valued fact and no MVDs between unrelated columns.

6. 5NF:

employee_training_projects Table:

Violations:
 This Table Has a Join Dependency
 This table can be losslessly decomposed into 3 smaller ones(if no
unique title assumption)

Apply 5NF:

employee_project Table:

17
employee_training Table:

project_training Table:

When these are joined, they reproduce the original employee_training_projects table
without redundancy or anomalies. All join dependencies are represented through
natural joins on candidate keys.

18
CHAPTER 5
IMPLEMENTATION OF CONCURRENCY CONTROL AND
RECOVERY MECHANISMS

5.1 Concurrency Control

5.2 Transaction Management

19
5.3 Recovery Mechanism

20
CHAPTER 6
CODE FOR THE PROJECT

pomodoroRoutes.js
const express = require('express');
const router = express.Router();
const {
logSession,
getSessions,
} = require('../controllers/pomodorocontroller');
router.post('/', logSession);
router.get('/', getSessions);
module.exports = router;

pomodoroController.js
const db = require('../config/db');
const formatToMySQLDatetime = (isoString) => {
return new Date(isoString).toISOString().slice(0, 19).replace('T', ' ');
};
exports.logSession = (req, res) => {
const { user_id, mode, start_time, end_time, duration_seconds } = req.body;
const formattedStart = formatToMySQLDatetime(start_time);
const formattedEnd = formatToMySQLDatetime(end_time);
db.query(
'INSERT INTO pomodoro_sessions (user_id, mode, start_time, end_time,
duration_seconds) VALUES (?, ?, ?, ?, ?)',
[user_id, mode, formattedStart, formattedEnd, duration_seconds],
(err) => {
if (err) {
21
console.error('DB Insert Error:', err);
return res.status(500).json({ error: 'Failed to log session' });
}
res.json({ message: 'Pomodoro session logged' });
}
);
};
exports.getSessions = (req, res) => {
const { userId } = req.query;
// Ensure userId is provided
if (!userId) {
return res.status(400).json({ error: 'User ID is required' });
}
db.query(
'SELECT * FROM pomodoro_sessions WHERE user_id = ? ORDER BY
start_time DESC', // Fetching most recent sessions first
[userId],
(err, results) => {
if (err) {
console.error('DB Fetch Error:', err);
return res.status(500).json({ error: 'Failed to fetch sessions' });
}
res.json(results);
}
);
};

22
resourcesRoutes.js
const express = require('express');
const router = express.Router();
const resourceController = require('../controllers/resourceController');
// GET all resources
router.get('/', resourceController.getAllResources);
// GET resource by id
router.get('/:id', resourceController.getResourceById);
// POST create new resource
router.post('/', resourceController.createResource);
// DELETE resource
router.delete('/:id', resourceController.deleteResource);
module.exports = router;

resourcesController.js
const db = require('../config/db');
// Get all resources
exports.getAllResources = (req, res) => {
db.query('SELECT * FROM resources ORDER BY created_at DESC', (err, results)
=> {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB error' });
}
res.json(results);
});
};

23
// Get resources by user ID
exports.getUserResources = (req, res) => {
const userId = req.query.userId;
db.query('SELECT * FROM resources WHERE user_id = ? ORDER BY created_at
DESC',
[userId],
(err, results) => {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB error' });
}
res.json(results);
}
);
};
// Create new resource
exports.createResource = (req, res) => {
const { title, description, subject, resource_url, resource_type } = req.body;
db.query(
'INSERT INTO resources (title, description, subject, resource_url, resource_type)
VALUES (?, ?, ?, ?, ?)',
[title, description, subject, resource_url, resource_type],
(err, result) => {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB insert failed' });
}
const newResourceId = result.insertId;

24
db.query('SELECT * FROM resources WHERE id = ?', [newResourceId], (err,
resourceResults) => {
if (err) {
console.error(err);
return res.status(500).json({ error: 'Failed to fetch new resource' });
}
res.status(201).json(resourceResults[0]);
});
}
);
};
// Get resource by ID
exports.getResourceById = (req, res) => {
db.query('SELECT * FROM resources WHERE id = ?', [req.params.id], (err, results)
=> {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB error' });
}
if (results.length === 0) {
return res.status(404).json({ message: 'Resource not found' });
}
res.json(results[0]);
});
};
// Delete resource
exports.deleteResource = (req, res) => {

25
db.query('DELETE FROM resources WHERE id = ?', [req.params.id], (err, result)
=> {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB delete failed' });
}
if (result.affectedRows === 0) {
return res.status(404).json({ message: 'Resource not found' });
}
res.json({ message: 'Resource deleted' });
});
};

studyGroupRoutes.js
const express = require('express');
const router = express.Router();
const studyGroupController = require('../controllers/studyGroupController');
// GET all study groups
router.get('/', studyGroupController.getAllStudyGroups);
// GET study group by id
router.get('/:id', studyGroupController.getStudyGroupById);
// POST create new study group
router.post('/', studyGroupController.createStudyGroup);
// DELETE study group
router.delete('/:id', studyGroupController.deleteStudyGroup);
module.exports = router;

26
studyGroupController.js
const db = require('../config/db');
// Get all study groups
exports.getAllStudyGroups = (req, res) => {
db.query('SELECT * FROM study_groups', (err, results) => {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB error' });
}
res.json(results);
});
};
// Create new study group
exports.createStudyGroup = (req, res) => {
const { name, description, subject } = req.body;
db.query(
'INSERT INTO study_groups (name, description, subject) VALUES (?, ?, ?)',
[name, description, subject],
(err, result) => {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB insert failed' });
}
const newGroupId = result.insertId;
db.query('SELECT * FROM study_groups WHERE id = ?', [newGroupId], (err,
groupResults) => {

27
if (err) {
console.error(err);
return res.status(500).json({ error: 'Failed to fetch new study group' });
}
res.status(201).json(groupResults[0]);
});
}
);
};
// Get study group by ID
exports.getStudyGroupById = (req, res) => {
db.query('SELECT * FROM study_groups WHERE id = ?', [req.params.id], (err,
results) => {
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB error' });
}
if (results.length === 0) {
return res.status(404).json({ message: 'Study group not found' });
}
res.json(results[0]);
});
};
// Delete study group
exports.deleteStudyGroup = (req, res) => {
db.query('DELETE FROM study_groups WHERE id = ?', [req.params.id], (err,
result) => {

28
if (err) {
console.error(err);
return res.status(500).json({ error: 'DB delete failed' });
}
if (result.affectedRows === 0) {
return res.status(404).json({ message: 'Study group not found' });
}
res.json({ message: 'Study group deleted' });
});
};
todosRoutes.js
const express = require('express');
const router = express.Router();
const {
getTasks,
addTask,
updateTask,
deleteTask,
} = require('../controllers/todocontroller');
router.get('/', getTasks);
router.post('/', addTask);
router.put('/', updateTask);
router.delete('/:id', deleteTask);
module.exports = router;

29
todosController.js
const db = require('../config/db');
exports.getTasks = (req, res) => {
db.query('SELECT * FROM todos WHERE user_id = ? ORDER BY id DESC',
[req.query.userId], (err, results) => {
if (err) return res.status(500).json({ error: 'DB error' });
res.json(results);
});
};
exports.addTask = (req, res) => {
const {
user_id,
text,
priority = 'Medium',
dueDate,
notes
} = req.body;
const cleanDueDate = dueDate === '' ? null : dueDate;
const cleanNotes = notes === '' ? null : notes;
db.query(
'INSERT INTO todos (user_id, text, priority, due_date, notes) VALUES (?, ?, ?, ?,
?)',
[user_id, text, priority, cleanDueDate, cleanNotes],
(err, result) => {
if (err) {
console.error('Insert error:', err);
return res.status(500).json({ error: 'DB insert failed' });
}

30
const newTaskId = result.insertId;
db.query('SELECT * FROM todos WHERE id = ?', [newTaskId], (err,
taskResults) => {
if (err) return res.status(500).json({ error: 'Failed to fetch new task' });
console.log('Newly inserted task:', taskResults[0]);
res.json(taskResults[0]);
});
}
);
};
exports.updateTask = (req, res) => {
const { id, completed, text, priority, dueDate, notes } = req.body;

db.query(
'UPDATE todos SET completed = ?, text = ?, priority = ?, due_date = ?, notes = ?
WHERE id = ?',
[completed, text, priority, dueDate, notes, id],
(err) => {
if (err) return res.status(500).json({ error: 'DB update failed' });
res.json({ message: 'Task updated' });
}
);
};
exports.deleteTask = (req, res) => {
db.query('DELETE FROM todos WHERE id = ?', [req.params.id], (err) => {
if (err) return res.status(500).json({ error: 'DB delete failed' });
res.json({ message: 'Task deleted' });
});
};

31
userRoutes.js
const express = require('express');
const router = express.Router();
const db = require('../config/db');
// User Registration
router.post('/register', (req, res) => {
const { name, email, password, role } = req.body;
if (!name || !email || !password) {
return res.status(400).json({ error: 'Please fill all fields.' });
}
const checkQuery = 'SELECT * FROM users WHERE email = ?';
db.query(checkQuery, [email], (err, result) => {
if (err) return res.status(500).json({ error: err.message });
if (result.length > 0) {
return res.status(400).json({ error: 'Email already exists.' });
}
const insertQuery = 'INSERT INTO users (name, email, password, role) VALUES
(?, ?, ?, ?)';
db.query(insertQuery, [name, email, password, role || 'student'], (err, result) => {
if (err) return res.status(500).json({ error: err.message });
res.status(201).json({ message: 'User registered successfully.' });
});
});
});
// User Login
router.post('/login', (req, res) => {
const { email, password } = req.body;
const query = 'SELECT * FROM users WHERE email = ? AND password = ?';

32
db.query(query, [email, password], (err, results) => {
if (err) return res.status(500).json({ error: err.message });
if (results.length === 0) {
return res.status(401).json({ error: 'Invalid email or password.' });
}
res.json({
message: 'Login successful.',
user: {
id: results[0].id,
name: results[0].name,
email: results[0].email,
role: results[0].role
}
});
});
});
module.exports = router;

db.config
const mysql = require('mysql2');
const dotenv = require('dotenv');
dotenv.config();
const connection = mysql.createConnection({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
});

33
connection.connect((err) => {
if (err) throw err;
console.log('Connected to MySQL database!');
});
module.exports = connection;

Server.js
// backend/server.js
const express = require('express');
const cors = require('cors');
const dotenv = require('dotenv');
const app = express();
dotenv.config();
app.use(cors());
app.use(express.json());
const db = require('./config/db');
// Test route
app.get('/', (req, res) => {
res.send('StudySync backend running.');
});
// Import user routes
const userRoutes = require('./routes/userRoutes');
app.use('/api/users', userRoutes);
const todoRoutes = require('./routes/todoRoutes');
const pomodoroRoutes = require('./routes/pomodoroRoutes');
const studyGroupRoutes = require('./routes/studyGroupRoutes');
const resourceRoutes = require('./routes/resourceRoutes');
app.use('/api/todo', todoRoutes);

34
app.use('/api/pomodoro', pomodoroRoutes);
app.use('/api/studygroups', studyGroupRoutes);
app.use('/api/resources', resourceRoutes);
// Start server
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);});

35
CHAPTER 7
RESULT AND DISCUSSION

Login/Register Page:

Dashboard Page

36
To-Do Page

Pomodoro Session Page

37
Study Group Page

38
Study Resource Page

39
QuizMe Page

40
QuizMe Resuls Page

41
CHAPTER 8
NPTEL COURSE

HRISHITA RAJ(RA2311029010012)

42
YOGITA JHA(RA2311029010035)

43
CHAPTER 9
CHART ACTIVITY 1: ER DIAGRAMS TO RELATIONAL
TABLES

44
CHAPTER 10
CHART ACTIVITY 2: FUNCTIONAL DEPENDENCIES AND
CLOSURE, NORMALIZATION

45
CHAPTER 11
CONCLUSION

The StudySync project successfully achieves its objective of providing an efficient,


interactive, and organized platform to enhance students' academic productivity and
collaborative learning experience. By integrating essential features such as task
management, Pomodoro session tracking, study resource sharing, group discussions,
and academic course management, the system caters comprehensively to the diverse
needs of students and educators alike. The carefully designed database schema ensures
data consistency, security, and scalability, while the implementation of advanced SQL
concepts like constraints, joins, views, triggers, and cursors enhances the reliability
and performance of the application. This project not only demonstrates the practical
application of database management and system design principles but also lays a strong
foundation for future enhancements like real-time chat, notification systems,
analytics dashboards, and mobile compatibility. In essence, StudySync bridges the
gap between digital productivity tools and academic collaboration, empowering
students to manage their study routines efficiently, access valuable resources, and
engage in meaningful group activities, ultimately contributing to improved learning
outcomes and academic success.

46

You might also like