-
Notifications
You must be signed in to change notification settings - Fork 44
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
Convert getCommunities to TRPC and add additional flags. #8777
Conversation
I tried this in frontend
Everything else worked for me. Thanks cc: @jnaviask |
@mzparacha will look into the zod errors re (1). Re (2), 2598 results / limit 5 = 519.6 = 520 pages, seems correct to me. Re (3), we should adjust the client expectations to match the database schema, so we don't need to be rewriting the info on the server, unless it would be a heavy lift on your side. (4) seems completely unrelated. |
@mzparacha we cannot do a simple map because the idea is that the result type matches the entity schema defined in |
I think replacing
with
will be the simplest to get the desired format. Tried and works cc: @jnaviask |
@mzparacha OK I will update the Community entity to permit this special case of data transformation. |
per DM conversation we will NOT be updating the Community entity/queries to use the legacy Tag format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- Thanks for all the changes!
@jnaviask @timolegros @kurtisassad @rbennettcw - we should discuss the conventions we are establishing in this PR and capture the decisions in a new ADR. Then we can do a final cleanup bucket to make sure these conventions are enforced. For example, we found that the best way to represent timestamps (created_at, updated_at) in the schemas is with:
but there are still several schemas using variants like:
We should have just one pattern to represent these dates, primary keys, associations, and nullable values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Unfortunately, the only thing that works is to re-parse the object on the frontend along with z.coerce... Otherwise the types are wrong. I don't understand why zod doesn't attempt to re-parse them. |
@burtonator the underlying issue is that sequelize is internally always coercing Date objects back to String on query before returning them, so we then need to reparse them as Date via z.coerce to return them. Let's continue this discussion on a documentation ticket. |
Link to Issue
Closes: #8756
Description of Changes
CommunityTag
andTag
, but I did not want to make that extensive of a change here).Test Plan
Other Considerations