Skip to content

refactor: Return template version name in the workspace build API #5178

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

Merged
merged 6 commits into from
Nov 28, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

The UI will use the template version name in some places so we need to have it returned from the API. I tried doing a JOIN but it looks like it does not update the workspaceBuild model properly. We are running some queries to get extra "workspace build" data so I made it there but I'm not sure if it is the best approach.

@BrunoQuaresma BrunoQuaresma requested a review from a team November 28, 2022 14:47
@BrunoQuaresma BrunoQuaresma requested a review from a team as a code owner November 28, 2022 14:47
@BrunoQuaresma BrunoQuaresma self-assigned this Nov 28, 2022
@BrunoQuaresma BrunoQuaresma requested review from Kira-Pilot and removed request for a team November 28, 2022 14:47
Copy link
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

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

FE ✅

Copy link
Contributor

@f0ssel f0ssel left a comment

Choose a reason for hiding this comment

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

Looks good so far. Need to update the fakeQuerier struct to have the new database method GetTemplateVersionByID to fulfill the database.Store interface. That will make lint and tests start passing.

@@ -51,6 +51,7 @@ func (api *API) workspaceBuild(rw http.ResponseWriter, r *http.Request) {
data.metadata,
data.agents,
data.apps,
data.templateVersions[0],
Copy link
Contributor

Choose a reason for hiding this comment

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

This will panic if the length is not at least 1. That may be fine if we have the expectation that this is always true, but wanted to point it out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we always expect to have at least 1. Thanks for pointing it out.

@BrunoQuaresma BrunoQuaresma requested a review from f0ssel November 28, 2022 19:41
@BrunoQuaresma BrunoQuaresma enabled auto-merge (squash) November 28, 2022 19:48
@BrunoQuaresma BrunoQuaresma merged commit d402914 into main Nov 28, 2022
@BrunoQuaresma BrunoQuaresma deleted the bq/return-template-version-name branch November 28, 2022 19:53
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants