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: add name to view for the get views endpoint #256

Merged
merged 7 commits into from
Aug 23, 2024

Conversation

MatthijsSmets
Copy link
Contributor

In order to make sure that the view models have all the data needed in the frontend, I've added their name to the map that is returned in the endpoint, so the name is not just the key in the map.

@philipsens philipsens changed the title Refactor: add name to view for the get views endpoint refactor: add name to view for the get views endpoint Jun 27, 2024
public String toString() {
return getName();
}
protected String name;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you keep whitespaces on tabs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the default java formatting in IntelliJ

Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep the formatting as is (like all other files in the project) to keep the project consistent and make reviewing easier

Copy link
Contributor Author

@MatthijsSmets MatthijsSmets Aug 20, 2024

Choose a reason for hiding this comment

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

I would like to, however there's no way to enforce this or tell my IDE to use a specific format, as there is none defined.
The only way to do this that I see is to ask ChatGPT to fix my indentation by supplying the new file and the old file with the indentation. I don't think that's supposed to be the way as it makes contributing to this project very cumbersome. Can you tell me how I can do this more efficiently?

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 tried to ask ChatGPT and it couldn't even do it.

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 fixed it as much as possible

}

public Map<String, Object> toHashMap(boolean isDefaultView) {
Map<String, String> metadataTypes = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why call it toHashMap instead of toMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because Map is the interface type and HashMap the implemented returned type, I think it makes sense to return the actual type instead of its supertype.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say use interface types for your "API" / what you expose to the outside world and use a specific type internally which you can change when needed without breaking the contract of your method (as far as I know this is common practice)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this

return Response.status(Response.Status.BAD_REQUEST).entity("No settings have been provided - detailed error message - The settings that have been provided are " + map).build();
}
private @Setter
@Inject
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened on this line (newlines added)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the default java formatting again

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, please change :)

@jacodg jacodg merged commit 664dec9 into master Aug 23, 2024
1 check passed
@jacodg jacodg deleted the refactor/add-name-to-view-model branch August 23, 2024 15:40
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