Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: removal of refillInterval #2709
feat: removal of refillInterval #2709
Changes from all commits
b320bce
c38f7e0
eeea567
cd95856
da2f8f7
130f749
5cbccbc
0617d38
84b3929
ffbb21d
ea6fd74
624bb92
a55c17d
68f270e
932b4b6
775fc54
16df3fc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Remove interval from response to align with PR objectives
The PR objective is to remove the refillInterval concept, but the response still includes the interval field. This could cause confusion for API consumers.
Consider updating the refill object construction:
k.refillAmount && k.lastRefillAt ? { - interval: k.refillInterval ?? undefined, amount: k.refillAmount, refillDay: k.refillDay ?? null, lastRefillAt: k.lastRefillAt?.getTime(), } : undefined,
📝 Committable suggestion
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.
Test case needs to be updated for new refill logic
This test case appears to be testing the old behavior where daily interval cannot have a refillDay. However, according to the PR objectives, we're removing the refillInterval concept entirely. This test should either be removed or updated to reflect the new behavior.
Consider removing this test case entirely since it's testing deprecated behavior, or update it to test the new requirements where:
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.
💡 Codebase verification
Schema consistency needs to be updated across multiple files
The verification reveals inconsistencies in the
interval
schema definition across different files:v1_keys_createKey.ts
: interval is correctly marked as optionalv1_migrations_enqueueKeys.ts
: interval is not optionalv1_keys_updateKey.ts
: interval is not optionalschema.ts
: interval is correctly marked as optionalThese files need to be updated to maintain consistency with the PR objective of removing
refillInterval
:apps/api/src/routes/v1_migrations_enqueueKeys.ts
apps/api/src/routes/v1_keys_updateKey.ts
🔗 Analysis chain
Verify schema consistency across the codebase
The change to make
interval
optional aligns with the PR objective. Let's verify this change is consistent across all schema definitions.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 10139
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.
see comments below.
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.
0
amount will cause false negative here.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.
🛠️ Refactor suggestion
Remove redundant validation
This validation for
refill.amount
is redundant as it's already enforced by the schema definition (required field withmin(1).positive()
).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.
Fix inconsistency with refillDay default value
According to the PR objectives,
refillDay
should be set to 1 only when the interval is monthly, but the current implementation sets it to 1 by default even when the interval is null.📝 Committable suggestion
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.
See comments below.
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.
If remaining being
0
is not a concern let's just do!form.watch("remaining")
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.
getValues
won't get updated whenlimitEnabled
changes, so that might cause some issues. Just giving heads up.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.
If remaining being
0
is not a concern let's just do!form.watch("remaining")
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.
Maybe we can do this
!form.watch("limitEnabled")
instead of!form.watch("limitEnabled") === true