Skip to content
Snippets Groups Projects
Commit a9b93cdd authored by aradjafari's avatar aradjafari
Browse files

Concatenating variables on server.ts fixed

parent 7f5db151
Branches
No related tags found
No related merge requests found
......@@ -127,7 +127,7 @@ const Mutation = new GraphQLObjectType({
cover_image: { type: GraphQLString }
},
async resolve(parent: any, args: any) {
const response = await sendQuery('INSERT INTO movie VALUES ({$args.id}, {$args.title}, {$args.genre}, {$args.rating_dice_throw}, {$args.year}, {$args.director_first_name}, {$args.director_last_name}, {$args.description}, {$args.cover_image})');
const response = await sendQuery('INSERT INTO movie VALUES (${args.id}, ${args.title}, ${args.genre}, ${args.rating_dice_throw}, ${args.year}, ${args.director_first_name}, ${args.director_last_name}, ${args.description}, ${args.cover_image})');
return response[0];
}
},
......@@ -137,7 +137,7 @@ const Mutation = new GraphQLObjectType({
id: {type: GraphQLInt}
},
async resolve(parent: any, args: any) {
const response = await sendQuery('DELETE FROM movie WHERE id = {$args.id}');
const response = await sendQuery('DELETE FROM movie WHERE id = ${args.id}');
return response[0];
}
},
......@@ -155,7 +155,7 @@ const Mutation = new GraphQLObjectType({
cover_image: { type: GraphQLString }
},
async resolve(parent: any, args: any) {
const response = await sendQuery('UPDATE movie SET title = {$args.title}, genre = {$args.genre}, rating_dice_throw = {$args.rating_dice_throw}, year = {$args.year}, director_first_name = {$args.director_first_name}, director_last_name = {$args.director_last_name} , description = {$args.description}, cover_image = {$args.cover_image} WHERE id = {$args.id}');
const response = await sendQuery('UPDATE movie SET title = ${args.title}, genre = ${args.genre}, rating_dice_throw = ${args.rating_dice_throw}, year = ${args.year}, director_first_name = ${args.director_first_name}, director_last_name = ${args.director_last_name} , description = ${args.description}, cover_image = ${args.cover_image} WHERE id = ${args.id}');
return response[0];
}
},
......@@ -166,7 +166,7 @@ const Mutation = new GraphQLObjectType({
rating_dice_throw: { type: GraphQLInt }
},
async resolve(parent: any, args: any) {
const response = await sendQuery('UPDATE movie SET rating_dice_throw = {$args.rating_dice_throw} WHERE id = {$args.id}');
const response = await sendQuery('UPDATE movie SET rating_dice_throw = ${args.rating_dice_throw} WHERE id = ${args.id}');
return response[0];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment