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

Add /api/projects endpoints #34

Closed
wants to merge 12 commits into from

Conversation

swellander
Copy link
Collaborator

@swellander swellander commented Jul 2, 2024

Description

Creates the following endpoints to fetch project data from our db:

Copy link

vercel bot commented Jul 2, 2024

@swellander is attempting to deploy a commit to the BuidlGuidl Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jul 2, 2024

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

Name Status Preview Comments Updated (UTC)
onchain-impact-dashboard ❌ Failed (Inspect) Jul 4, 2024 0:14am

return data.map(item => ({
id: item.id,
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/stub/project_ids`);
const data: Project[] = await response.json();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a string[] no a project[]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@swellander swellander changed the title Add /api/stub/project_ids endpoint Add /api/projects endpoints Jul 3, 2024
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the seed sample file projects with agora projects with OSO id mappings

@escottalexander
Copy link
Collaborator

I am going to dig in to why the build is still failing. This looks good so nice work!

Copy link
Collaborator

@escottalexander escottalexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing with two parts that made me have issues. Almost there. Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file won't display for me due to lines 43-56 where [...data?.github, ...data?.packages]. If the project doesn't have github or packages properties then the spread operator is trying to act upon undefined causing this error:
Error: (intermediate value) is not iterable.

We should check for the existence of github and packages before using the spread operator.

@escottalexander
Copy link
Collaborator

I am going to dig in to why the build is still failing. This looks good so nice work!

I might need to reseed the production data for the build to succeed. I will give that a try when you commit the fixes I discussed in my review.

if (!id) return res.status(400).json({ message: "Must include project ID" });
try {
const projectDetail = await getProjectById(id);
const projectDetailDto = convertProjectToDto(projectDetail);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request from the project page needs more than the dto version. It needs the whole Project.

@escottalexander
Copy link
Collaborator

@swellander #46 has the seed data changes for projects covered. If it gets merged in before this then you can remove your changes to seed.sample.json and just get the changes contained in that PR.

@escottalexander
Copy link
Collaborator

Closing this since all the relevant changes were absorbed by #46. Thanks for your help with this @swellander.

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.

API Definition [ProjectById] API Definition [projects GET]
3 participants