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

feat: support @computed decorator #153

Merged
merged 5 commits into from
Nov 9, 2023
Merged

Conversation

tpoisseau
Copy link
Member

Closes: #135

@tpoisseau tpoisseau linked an issue Nov 6, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
src/Model/Model.ts 98.05% <100.00%> (+0.09%) ⬆️
src/Model/proxyHandler.ts 100.00% <100.00%> (ø)
src/Odm/decorators.ts 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!

@targos
Copy link
Member

targos commented Nov 7, 2023

Did you try to make an API like Lucid?

@tpoisseau
Copy link
Member Author

Yes, I try.
I didn't found every places and it's hard to replicate code in two different codebase with differences.
The ActiveRecord pattern is very confusing by mixing db row instances with DB API, and metadata of collection.

But, I ended to be able to make a correct @computed() getter without breaking existent tests

@tpoisseau
Copy link
Member Author

I added support on toJSON serialization, if you see something else Lucid support with @computed you found important, Say it to me please

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

LGTM after fix to serializeAs: null

@tpoisseau tpoisseau merged commit 412af03 into main Nov 9, 2023
@tpoisseau tpoisseau deleted the feat/computed-decorator branch November 9, 2023 15:50
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.

Add @computed decorator
3 participants