-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added db and get/post endpoints #8
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
nice! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vercel postgres 🤩 left a few questions. Also, is there a schema or model anywhere for this database? Curious what other fields we need to add to the schema (ie name should maybe be firstName and lastName, if there's other stuff to add, etc.)
// } | ||
|
||
// Validate body provided | ||
if (!req.body) return res.status(400).json({ error: "No body provided" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with Klefki, but how is this functionality anticipated to be used? Is it something where you search by the user name or discord to fetch a single board member? GET requests don't normally have a body so curious if this is the way it has to be structured
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea this is dead code mb
try { | ||
if(Name){ | ||
console.log("Name found") | ||
const row = await sql`SELECT * FROM Board WHERE name = ${Name};`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe limit 1? Not sure how names are enforced (if we have multiple people named "Alex" or if you need to have a last name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to rework to add a separate endpoint to get single user
} | ||
else{ | ||
console.log("discord found"); | ||
const row = await sql`SELECT * FROM Board WHERE discord = ${Discord};`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we explore using an ORM, or is this the way it's done in vercel postgres? I don't remember 127 but I feel like they told us not to do this bc sql injection 😷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vercel postgres is sanitized so it shud be fine but I'll do some testing
added db and get/post endpoints