Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LordFarquaadtheCreator committed Jun 4, 2024
1 parent 53a3ace commit 282b8f5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions routes/databaseFunctions.ts
Original file line number Diff line number Diff line change
@@ -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);
}
const values = [
valuesToQuery.name,
valuesToQuery.shortDescription,
valuesToQuery.longDescription,
valuesToQuery.team,
valuesToQuery.link,
valuesToQuery.image,
valuesToQuery.techStack,
valuesToQuery.cohort,
valuesToQuery.topic,
];
client.query(query, values);
}

0 comments on commit 282b8f5

Please sign in to comment.