-
-
Notifications
You must be signed in to change notification settings - Fork 298
debt(PaymentMethod): surface bitcoin type #11952
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ import { GraphQLEnumType } from 'graphql'; | |
|
|
||
| import { PAYMENT_METHOD_TYPE } from '../../../constants/paymentMethods'; | ||
|
|
||
| const deprecatedValues: readonly PAYMENT_METHOD_TYPE[] = [PAYMENT_METHOD_TYPE.BITCOIN] as const; | ||
|
|
||
| export const GraphQLPaymentMethodType = new GraphQLEnumType({ | ||
| name: 'PaymentMethodType', | ||
| values: { | ||
|
|
@@ -10,7 +12,13 @@ export const GraphQLPaymentMethodType = new GraphQLEnumType({ | |
| {}, | ||
| ), | ||
| ...Object.keys(PAYMENT_METHOD_TYPE).reduce( | ||
| (values, key) => ({ ...values, [key]: { value: PAYMENT_METHOD_TYPE[key] } }), | ||
| (values, key: PAYMENT_METHOD_TYPE) => ({ | ||
| ...values, | ||
| [key]: { | ||
| deprecationReason: deprecatedValues.includes(key) ? 'This value is deprecated' : undefined, | ||
| value: PAYMENT_METHOD_TYPE[key], | ||
| }, | ||
|
Comment on lines
+18
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The deprecation check for the Suggested FixModify the deprecation check to compare enum values instead of keys. Change the condition Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| }), | ||
| {}, | ||
| ), | ||
| }, | ||
|
|
||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: opencollective/opencollective-api
Length of output: 171
🏁 Script executed:
Repository: opencollective/opencollective-api
Length of output: 5203
🏁 Script executed:
Repository: opencollective/opencollective-api
Length of output: 50390
🏁 Script executed:
Repository: opencollective/opencollective-api
Length of output: 214
🏁 Script executed:
Repository: opencollective/opencollective-api
Length of output: 2558
BITCOINnever picks up the deprecation reason in the second reduce.Object.keys(PAYMENT_METHOD_TYPE)yields member names ('BITCOIN'), whiledeprecatedValuesholds enum values ('bitcoin'), so this check stays false. The lowercasebitcoinenum is already deprecated by the first reduce; compare againstPAYMENT_METHOD_TYPE[key]if the uppercase alias should also be deprecated.🤖 Prompt for AI Agents