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 only category and kind #14

Merged
merged 7 commits into from
Mar 16, 2025
Merged

Add only category and kind #14

merged 7 commits into from
Mar 16, 2025

Conversation

But2ene
Copy link
Contributor

@But2ene But2ene commented Feb 15, 2025

No description provided.

@But2ene But2ene requested a review from Gbury February 15, 2025 20:03
@But2ene But2ene self-assigned this Feb 15, 2025
@But2ene But2ene linked an issue Mar 2, 2025 that may be closed by this pull request
Copy link
Contributor

@Gbury Gbury left a comment

Choose a reason for hiding this comment

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

I'm really not sure what's the practical use of this PR (apart from getting used to modify the code, which is in itself a worthy goal) : the two newly exposed API calls are redundant with the type information already present in the openapi doc.

let categories = Types.Category.all in
let res : Types.CategoryList.t = { categories; } in
Ok res
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what's the use of an API call to return the list of categories: the type of categories already defines that list, so it seems a bit redundant and wasteful to have an API call to return something that is static and known at compile-time for both the backend and frontend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since EventIdList was implemented (which also feels redundant to me) by you, I thought it was mandatory to create a "List" type for all things that could be recuperated as a list.

It's true that is it known by backend at compile time, but I'm not sure for frontend since frontend only knows of stuff from the dynamically generated openapi spec. Can the frontend be in sync to the list of possible division categories without an API? For me, we will need the lists when we want to show forms for creating events and competitions.

I feel like we should give it some ways to access the list of possible values for all concepts defined in doc/concepts.md. Do you have an alternative ways to transmit the list of possible values to the frontend?

Copy link
Contributor

Choose a reason for hiding this comment

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

The frontend will *have to statically know about the different categories, if onyl to properly print and display them for each competition. Said otherwise, if at any point the frontend does not statically know about all of the categories, then it is a bug. I agree that it means additional work to ensure that the frontend and backend are in sync, but it's unavoidable since the two have separate code.

let kinds = Types.Kind.all in
let res : Types.KindList.t = { kinds; } in
Ok res
)
Copy link
Contributor

Choose a reason for hiding this comment

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

same remark as for category lists (also, you forgot to rename the list to kind_list).

But2ene and others added 2 commits March 2, 2025 23:44
@But2ene
Copy link
Contributor Author

But2ene commented Mar 2, 2025

I'm really not sure what's the practical use of this PR (apart from getting used to modify the code, which is in itself a worthy goal) : the two newly exposed API calls are redundant with the type information already present in the openapi doc.

It's mainly to get used to modify code. But I believe the openapi doc is dynamically generated by the ocaml code. If we don't represent them, we won't be able to access them for forms!

@But2ene But2ene requested a review from Gbury March 12, 2025 21:41
@Gbury
Copy link
Contributor

Gbury commented Mar 16, 2025

I'm inclined to close this PR: in practice we will hve to keep the frontend and backend in sync so they can properly interact and work. Just like the backend, the frontend needs to know about:

  • the various categories to properly display them
  • same, or actually even more for kinds, since depending on the competition kind, API, the pages, UI and API calls will differ.

So an API to return the list of kinds is superfluous since the frontend code needs this list hardcoded.

@But2ene
Copy link
Contributor Author

But2ene commented Mar 16, 2025

@Gbury all changes you asked for were deleted, please accept this MR to improve doc

@Gbury Gbury merged commit ba4f346 into main Mar 16, 2025
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.

Ajouts concepts de category et kind
2 participants