Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

added db and get/post endpoints #8

wants to merge 1 commit into from

Conversation

greeenbeans
Copy link
Contributor

added db and get/post endpoints

Copy link

vercel bot commented May 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
klefki ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 1, 2024 11:22pm
testing-klefki ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 1, 2024 11:22pm

@leestanley
Copy link
Member

nice!

Copy link
Member

@nik-dange nik-dange left a 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" });
Copy link
Member

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

Copy link
Contributor Author

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};`;
Copy link
Member

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)

Copy link
Contributor Author

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};`;
Copy link
Member

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 😷

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants