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

SCrolling box fix

parent 6605f522
Branches fixes/warningFix
No related tags found
No related merge requests found
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
} }
.header { .header {
position: fixed;
width: 100%;
background-color: rgb(1, 0, 34); background-color: rgb(1, 0, 34);
min-height: 5vh; min-height: 5vh;
display: flex; display: flex;
...@@ -26,7 +25,7 @@ ...@@ -26,7 +25,7 @@
color: white; color: white;
font-size: large; font-size: large;
margin: auto; margin: auto;
z-index: 10;
} }
#textfield1, #textfield2, #checkbox1 { #textfield1, #textfield2, #checkbox1 {
...@@ -57,10 +56,7 @@ ...@@ -57,10 +56,7 @@
} }
} }
#tableContainer{
position: absolute;
margin-top: 5vh;
}
table { table {
table-layout:fixed; table-layout:fixed;
......
...@@ -129,7 +129,7 @@ const Mutation = new GraphQLObjectType({ ...@@ -129,7 +129,7 @@ const Mutation = new GraphQLObjectType({
cover_image: { type: GraphQLString } cover_image: { type: GraphQLString }
}, },
async resolve(parent: any, args: any) { 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]; return response[0];
} }
}, },
...@@ -139,7 +139,7 @@ const Mutation = new GraphQLObjectType({ ...@@ -139,7 +139,7 @@ const Mutation = new GraphQLObjectType({
id: {type: GraphQLInt} id: {type: GraphQLInt}
}, },
async resolve(parent: any, args: any) { 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]; return response[0];
} }
}, },
...@@ -157,7 +157,7 @@ const Mutation = new GraphQLObjectType({ ...@@ -157,7 +157,7 @@ const Mutation = new GraphQLObjectType({
cover_image: { type: GraphQLString } cover_image: { type: GraphQLString }
}, },
async resolve(parent: any, args: any) { 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]; return response[0];
} }
}, },
...@@ -168,7 +168,7 @@ const Mutation = new GraphQLObjectType({ ...@@ -168,7 +168,7 @@ const Mutation = new GraphQLObjectType({
rating_dice_throw: { type: GraphQLInt } rating_dice_throw: { type: GraphQLInt }
}, },
async resolve(parent: any, args: any) { 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]; return response[0];
} }
} }
......
...@@ -76,7 +76,9 @@ const RootQuery = new GraphQLObjectType({ ...@@ -76,7 +76,9 @@ const RootQuery = new GraphQLObjectType({
let query = ''; let query = '';
if(typeof args.title!='undefined' && typeof args.genre!='undefined'){ if(typeof args.title!='undefined' && typeof args.genre!='undefined'){
console.log("resolve") console.log("resolve")
query = getSearchQuery(args.title, args.genre, args.order)} query = getSearchQuery(args.title, args.genre)}
if(args.order) {query += ' ORDER BY year DESC;';}
const response = await sendQuery(query); const response = await sendQuery(query);
return response[0]; return response[0];
} }
...@@ -88,7 +90,7 @@ function getQuery(key: string, value: string){ ...@@ -88,7 +90,7 @@ function getQuery(key: string, value: string){
return 'SELECT * FROM movie WHERE ' + key + ' = "' + value + '"' return 'SELECT * FROM movie WHERE ' + key + ' = "' + value + '"'
} }
function getSearchQuery(title: string, genre: string, order: boolean): string { function getSearchQuery(title: string, genre: string): string {
let query = 'SELECT * FROM movie' let query = 'SELECT * FROM movie'
if (title != '') { if (title != '') {
query = query + ' WHERE title LIKE "%' + title + '%"' query = query + ' WHERE title LIKE "%' + title + '%"'
...@@ -102,9 +104,6 @@ function getSearchQuery(title: string, genre: string, order: boolean): string { ...@@ -102,9 +104,6 @@ function getSearchQuery(title: string, genre: string, order: boolean): string {
if (genre != '') { if (genre != '') {
query = query + ' genre LIKE "%' + genre + '%"' query = query + ' genre LIKE "%' + genre + '%"'
} }
if (order) {
query = query + ' ORDER BY year DESC'
}
console.log(query) console.log(query)
return query return query
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment