Skip to content

Commit

Permalink
Add 'user' parameter to 'createProject' function
Browse files Browse the repository at this point in the history
The 'createProject' function in resolvers.js has been modified to include a 'user' parameter. This change enables the function to utilize current 'user.id' for ProjectPermission creation further enhancing the functionality of the code.
  • Loading branch information
claygorman committed Dec 27, 2023
1 parent b5ecab2 commit 0b77259
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ const resolvers = {

return { message: 'issue deleted', status: 'success' };
},
createProject: async (parent, { input }, { db }) => {
createProject: async (parent, { input }, { db, user }) => {
// TODO: we should do a sequelize transaction here
const project = await db.sequelize.models.Project.create({
name: input.name,
Expand All @@ -357,7 +357,7 @@ const resolvers = {
});

await db.sequelize.models.ProjectPermission.create({
userId: input.userId,
userId: user.id,
projectId: project.id,
});

Expand Down

0 comments on commit 0b77259

Please sign in to comment.