diff --git a/routes/databaseFunctions.ts b/routes/databaseFunctions.ts index fd57326..58b852a 100644 --- a/routes/databaseFunctions.ts +++ b/routes/databaseFunctions.ts @@ -1,11 +1,21 @@ -import { Client } from 'pg'; +import { Client } from "pg"; // todo: wrap everything in a try catch block and pass the exception to the user export function addToDB(client: Client, valuesToQuery: any) { - const query = ` + const query = ` INSERT INTO projects (name, "short-desc", "long-desc", team, link, image, "tech-stack", cohort, topic) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)`; - const values = [valuesToQuery.name, valuesToQuery.shortDescription, valuesToQuery.longDescription, valuesToQuery.team, valuesToQuery.link, valuesToQuery.image, valuesToQuery.techStack, valuesToQuery.cohort, valuesToQuery.topic]; - client.query(query, values); -} \ No newline at end of file + const values = [ + valuesToQuery.name, + valuesToQuery.shortDescription, + valuesToQuery.longDescription, + valuesToQuery.team, + valuesToQuery.link, + valuesToQuery.image, + valuesToQuery.techStack, + valuesToQuery.cohort, + valuesToQuery.topic, + ]; + client.query(query, values); +}