Skip to content

Commit

Permalink
Merge pull request #25 from Code-the-Dream-School/error_fix_01
Browse files Browse the repository at this point in the history
adding username to getAllProject API
  • Loading branch information
iamrahimi authored Jan 20, 2025
2 parents 6c82c52 + 2e913a5 commit cb9f649
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/middlewares/authMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const authenticateJWT = async (req, res, next) => {
if (!token) {
return res.status(401).json({ message: 'Authorization token is required' });
}

console.log('I ahalskjdflaksjdf');
try {
const decoded = jwt.verify(token, SECRET_KEY);

Expand All @@ -29,6 +29,7 @@ const authenticateJWT = async (req, res, next) => {
};

const authenticateToken = (req, res, next) => {
console.log('workaklsdjf;as')
const token = req.headers.authorization?.split(' ')[1];
if (!token) {
return res.status(401).json({ error: 'Access denied, token missing' });
Expand Down
10 changes: 9 additions & 1 deletion src/models/projectModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ const projectModel = {
getAllProjects: async () => {
try {
console.log("Fetching all projects...");
const projects = await prisma.projects.findMany();
const projects = await prisma.projects.findMany({
include: {
users: {
select: {
username: true
}
}
}
});
return projects;
} catch (error) {
console.error("Error while fetching projects:", error);
Expand Down

0 comments on commit cb9f649

Please sign in to comment.