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

refactor: splits templates API into list and fetch by id #481

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

stalniy
Copy link
Contributor

@stalniy stalniy commented Nov 18, 2024

  1. Splits templates API into 2: list and getById
  2. Reduces amount of properties for every template in response. It contains only 4 properties that is used on UI:
    • id
    • summary
    • logoUrl
    • name

Not tested. Fixes #102

@stalniy
Copy link
Contributor Author

stalniy commented Nov 18, 2024

DO NOT MERGE it. Because very likely it will break template detail page on UI as UI currently does not fetch template by id from API.

@stalniy stalniy force-pushed the refactor/split-templates-api branch 2 times, most recently from f95af47 to 7b67f1a Compare November 18, 2024 20:33
@stalniy stalniy force-pushed the refactor/split-templates-api branch from 7b67f1a to de5de71 Compare November 18, 2024 20:46
@baktun14
Copy link
Contributor

Thanks for your work!

Sorry if it wasn't in the requirements, but following your comments about the impact on the frontend; I suggest we keep the old /templates api endpoint as-is and create a new one /template-list with your changes. That way it won't affect the frontend and we'll be able to merge your pr without effect and implement it on the frontend in another pr.

@baktun14 baktun14 mentioned this pull request Nov 18, 2024
2 tasks
@stalniy
Copy link
Contributor Author

stalniy commented Nov 18, 2024

Probably I could create this extra api endpoints under /v2. To make this evolution more clear from api perspective and at the same time keeping /v1/templates to keep old clients work without issues. Some people also may have cached version of SPA in their browsers (long lived browser tabs), and their version of client app may try to use older API version

@baktun14
Copy link
Contributor

baktun14 commented Nov 18, 2024

Probably I could create this extra api endpoints under /v2. To make this evolution more clear from api perspective and at the same time keeping /v1/templates to keep old clients work without issues. Some people also may have cached version of SPA in their browsers (long lived browser tabs), and their version of client app may try to use older API version

Great suggestion and I discussed this internally, but for the sake of keeping the scope of this pr small, I suggest we just keep the old version and add the 2 new endpoints you added.

@stalniy stalniy force-pushed the refactor/split-templates-api branch from c4d9e0a to ac6e616 Compare November 19, 2024 13:57
@stalniy
Copy link
Contributor Author

stalniy commented Nov 19, 2024

Changed, now it's safe to merge it

@stalniy stalniy force-pushed the refactor/split-templates-api branch from ac6e616 to 8e7d413 Compare November 19, 2024 15:48
@stalniy stalniy force-pushed the refactor/split-templates-api branch from 8e7d413 to 8095bad Compare November 19, 2024 15:50
@stalniy stalniy marked this pull request as ready for review November 19, 2024 15:50
@stalniy stalniy requested a review from a team as a code owner November 19, 2024 15:50

export default new OpenAPIHono().openapi(route, async c => {
const templatesPerCategory = await getCachedTemplatesGallery();
// TODO: remove manual response filtering when https://github.com/honojs/middleware/issues/181 is done
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

Copy link
Contributor

@baktun14 baktun14 left a comment

Choose a reason for hiding this comment

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

Tested it locally, works great. Good job!

@baktun14 baktun14 merged commit e65d61d into akash-network:main Nov 19, 2024
5 checks passed
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.

Improve templates API
4 participants