Skip to content

Commit 50e5593

Browse files
authored
Remove unused GraphQL v1 (#11234)
- Removes GraphQL v1 mutations: createWebhook, deleteNotification, editConnectedAccount, updatePaymentMethod, removePaymentMethod, activateBudget, and deactivateBudget - Removes the editTiers method from the Collective model (replaced by individual v2 mutations) - Adds deprecation notice to the tiers field in the GraphQL v1 schema to guide users toward v2 - Cleans up unused imports and test files
1 parent 3563c4a commit 50e5593

File tree

12 files changed

+12
-697
lines changed

12 files changed

+12
-697
lines changed

server/graphql/schemaV1.graphql

Lines changed: 7 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,7 @@ type Collective implements CollectiveInterface {
22302230
followers(limit: Int, offset: Int): [CollectiveInterface]
22312231
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
22322232
tiers(id: Int, slug: String, slugs: [String]): [Tier]
2233+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
22332234
orders(status: OrderStatus): [OrderType]
22342235
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
22352236
transactions(
@@ -2515,6 +2516,7 @@ type Event implements CollectiveInterface {
25152516
followers(limit: Int, offset: Int): [CollectiveInterface]
25162517
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
25172518
tiers(id: Int, slug: String, slugs: [String]): [Tier]
2519+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
25182520
orders(status: OrderStatus): [OrderType]
25192521
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
25202522
transactions(
@@ -2800,6 +2802,7 @@ type Fund implements CollectiveInterface {
28002802
followers(limit: Int, offset: Int): [CollectiveInterface]
28012803
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
28022804
tiers(id: Int, slug: String, slugs: [String]): [Tier]
2805+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
28032806
orders(status: OrderStatus): [OrderType]
28042807
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
28052808
transactions(
@@ -3085,6 +3088,7 @@ type Organization implements CollectiveInterface {
30853088
followers(limit: Int, offset: Int): [CollectiveInterface]
30863089
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
30873090
tiers(id: Int, slug: String, slugs: [String]): [Tier]
3091+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
30883092
orders(status: OrderStatus): [OrderType]
30893093
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
30903094
transactions(
@@ -3370,6 +3374,7 @@ type Project implements CollectiveInterface {
33703374
followers(limit: Int, offset: Int): [CollectiveInterface]
33713375
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
33723376
tiers(id: Int, slug: String, slugs: [String]): [Tier]
3377+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
33733378
orders(status: OrderStatus): [OrderType]
33743379
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
33753380
transactions(
@@ -3950,6 +3955,7 @@ type User implements CollectiveInterface {
39503955
followers(limit: Int, offset: Int): [CollectiveInterface]
39513956
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
39523957
tiers(id: Int, slug: String, slugs: [String]): [Tier]
3958+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
39533959
orders(status: OrderStatus): [OrderType]
39543960
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
39553961
transactions(
@@ -4237,6 +4243,7 @@ type Vendor implements CollectiveInterface {
42374243
followers(limit: Int, offset: Int): [CollectiveInterface]
42384244
notifications(limit: Int, offset: Int, channel: String, type: String, active: Boolean): [NotificationType]
42394245
tiers(id: Int, slug: String, slugs: [String]): [Tier]
4246+
@deprecated(reason: "2025-12-05: Will be deleted soon. Use GraphQL v2")
42404247
orders(status: OrderStatus): [OrderType]
42414248
ordersFromCollective(subscriptionsOnly: Boolean): [OrderType]
42424249
transactions(
@@ -4628,7 +4635,6 @@ type Mutation {
46284635
"""
46294636
email: String!
46304637
): UserDetails
4631-
editConnectedAccount(connectedAccount: ConnectedAccountInputType!): ConnectedAccountType
46324638

46334639
"""
46344640
Updates all the core contributors (role = ADMIN or MEMBER) for this collective.
@@ -4642,12 +4648,6 @@ type Mutation {
46424648
editPublicMessage(FromCollectiveId: Int!, CollectiveId: Int!, message: String): [Member]
46434649
@deprecated(reason: "2021-01-27: Please use editPublicMessage from GraphQLV2")
46444650

4645-
"""
4646-
Update a payment method
4647-
"""
4648-
updatePaymentMethod(id: Int!, name: String, monthlyLimitPerMember: Int): PaymentMethodType
4649-
@deprecated(reason: "2024-07-16: Please use updateOrder from GraphQLV2")
4650-
46514651
"""
46524652
Replace a payment method
46534653
"""
@@ -4716,16 +4716,6 @@ type Mutation {
47164716
): [PaymentMethodType]
47174717
claimPaymentMethod(code: String!, user: UserInputType): PaymentMethodType!
47184718

4719-
"""
4720-
Removes the payment method
4721-
"""
4722-
removePaymentMethod(
4723-
"""
4724-
ID of the payment method to remove
4725-
"""
4726-
id: Int!
4727-
): PaymentMethodType!
4728-
47294719
"""
47304720
Edits (by replacing) the admin-level webhooks for a collective.
47314721
"""
@@ -4741,31 +4731,6 @@ type Mutation {
47414731
notifications: [NotificationInputType]
47424732
): [NotificationType]
47434733

4744-
"""
4745-
Register user-level webhooks for a collective.
4746-
"""
4747-
createWebhook(
4748-
"""
4749-
Slug of the collective the webhook is created for.
4750-
"""
4751-
collectiveSlug: String!
4752-
4753-
"""
4754-
The notification object.
4755-
"""
4756-
notification: NotificationInputType
4757-
): NotificationType
4758-
4759-
"""
4760-
Deletes a notification by ID.
4761-
"""
4762-
deleteNotification(
4763-
"""
4764-
ID of the notification to delete.
4765-
"""
4766-
id: Int!
4767-
): NotificationType
4768-
47694734
"""
47704735
Activate a collective as Host.
47714736
"""
@@ -4785,26 +4750,6 @@ type Mutation {
47854750
"""
47864751
id: Int!
47874752
): CollectiveInterface
4788-
4789-
"""
4790-
Activate budget (For Host Organizations only)
4791-
"""
4792-
activateBudget(
4793-
"""
4794-
ID of the "collective" (Host Organization)
4795-
"""
4796-
id: Int!
4797-
): CollectiveInterface
4798-
4799-
"""
4800-
Deactivate budget (For Host Organizations only)
4801-
"""
4802-
deactivateBudget(
4803-
"""
4804-
ID of the "collective" (Host Organization)
4805-
"""
4806-
id: Int!
4807-
): CollectiveInterface
48084753
}
48094754

48104755
"""
@@ -4982,14 +4927,6 @@ input CaptchaInputType {
49824927
provider: String!
49834928
}
49844929

4985-
"""
4986-
Input type for ConnectedAccountInputType
4987-
"""
4988-
input ConnectedAccountInputType {
4989-
id: Int
4990-
settings: JSON
4991-
}
4992-
49934930
"""
49944931
Input for stripe credit card data
49954932
"""

server/graphql/v1/CollectiveInterface.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ const CollectiveFields = () => {
13061306
},
13071307
tiers: {
13081308
type: new GraphQLList(TierType),
1309+
deprecationReason: '2025-12-05: Will be deleted soon. Use GraphQL v2',
13091310
args: {
13101311
id: { type: GraphQLInt },
13111312
slug: { type: GraphQLString },

server/graphql/v1/inputTypes.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,6 @@ export const CollectiveInputType = new GraphQLInputObjectType({
139139
}),
140140
});
141141

142-
export const ConnectedAccountInputType = new GraphQLInputObjectType({
143-
name: 'ConnectedAccountInputType',
144-
description: 'Input type for ConnectedAccountInputType',
145-
fields: () => ({
146-
id: { type: GraphQLInt },
147-
settings: { type: GraphQLJSON },
148-
}),
149-
});
150-
151142
const CollectiveAttributesInputType = new GraphQLInputObjectType({
152143
name: 'CollectiveAttributesInputType',
153144
description: 'Input type for attributes of CollectiveInputType',

server/graphql/v1/mutations.js

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,28 @@ import { createUser } from '../common/user';
1414
import { NotFound, RateLimitExceeded, Unauthorized, ValidationFailed } from '../errors';
1515

1616
import {
17-
activateBudget,
1817
activateCollectiveAsHost,
1918
archiveCollective,
2019
createCollective,
2120
createCollectiveFromGithub,
22-
deactivateBudget,
2321
deactivateCollectiveAsHost,
2422
deleteCollective,
2523
editCollective,
2624
unarchiveCollective,
2725
} from './mutations/collectives';
28-
import { editConnectedAccount } from './mutations/connectedAccounts';
29-
import { createWebhook, deleteNotification, editWebhooks } from './mutations/notifications';
26+
import { editWebhooks } from './mutations/notifications';
3027
import * as paymentMethodsMutation from './mutations/paymentMethods';
3128
import { updateUserEmail } from './mutations/users';
3229
import { CollectiveInterfaceType } from './CollectiveInterface';
3330
import {
3431
CaptchaInputType,
3532
CollectiveInputType,
36-
ConnectedAccountInputType,
3733
MemberInputType,
3834
NotificationInputType,
3935
StripeCreditCardDataInputType,
4036
UserInputType,
4137
} from './inputTypes';
42-
import { ConnectedAccountType, MemberType, NotificationType, PaymentMethodType, UserType } from './types';
38+
import { MemberType, NotificationType, PaymentMethodType, UserType } from './types';
4339

4440
const mutations = {
4541
createCollective: {
@@ -194,15 +190,6 @@ const mutations = {
194190
return updateUserEmail(req.remoteUser, email);
195191
},
196192
},
197-
editConnectedAccount: {
198-
type: ConnectedAccountType,
199-
args: {
200-
connectedAccount: { type: new GraphQLNonNull(ConnectedAccountInputType) },
201-
},
202-
resolve(_, args, req) {
203-
return editConnectedAccount(req, args.connectedAccount);
204-
},
205-
},
206193
editCoreContributors: {
207194
type: CollectiveInterfaceType,
208195
description: 'Updates all the core contributors (role = ADMIN or MEMBER) for this collective.',
@@ -239,19 +226,6 @@ const mutations = {
239226
},
240227
resolve: editPublicMessage,
241228
},
242-
updatePaymentMethod: {
243-
type: PaymentMethodType,
244-
description: 'Update a payment method',
245-
deprecationReason: '2024-07-16: Please use updateOrder from GraphQLV2',
246-
args: {
247-
id: { type: new GraphQLNonNull(GraphQLInt) },
248-
name: { type: GraphQLString },
249-
monthlyLimitPerMember: { type: GraphQLInt },
250-
},
251-
resolve: async (_, args, req) => {
252-
return paymentMethodsMutation.updatePaymentMethod(args, req);
253-
},
254-
},
255229
replaceCreditCard: {
256230
type: PaymentMethodType,
257231
description: 'Replace a payment method',
@@ -362,19 +336,6 @@ const mutations = {
362336
},
363337
resolve: async (_, args, req) => paymentMethodsMutation.claimPaymentMethod(args, req),
364338
},
365-
removePaymentMethod: {
366-
type: new GraphQLNonNull(PaymentMethodType),
367-
description: 'Removes the payment method',
368-
args: {
369-
id: {
370-
type: new GraphQLNonNull(GraphQLInt),
371-
description: 'ID of the payment method to remove',
372-
},
373-
},
374-
resolve: async (_, args, req) => {
375-
return paymentMethodsMutation.removePaymentMethod(args.id, req);
376-
},
377-
},
378339
editWebhooks: {
379340
type: new GraphQLList(NotificationType),
380341
description: 'Edits (by replacing) the admin-level webhooks for a collective.',
@@ -392,36 +353,6 @@ const mutations = {
392353
return editWebhooks(args, req);
393354
},
394355
},
395-
createWebhook: {
396-
type: NotificationType,
397-
description: 'Register user-level webhooks for a collective.',
398-
args: {
399-
collectiveSlug: {
400-
type: new GraphQLNonNull(GraphQLString),
401-
description: 'Slug of the collective the webhook is created for.',
402-
},
403-
notification: {
404-
type: NotificationInputType,
405-
description: 'The notification object.',
406-
},
407-
},
408-
resolve(_, args, req) {
409-
return createWebhook(args, req);
410-
},
411-
},
412-
deleteNotification: {
413-
type: NotificationType,
414-
description: 'Deletes a notification by ID.',
415-
args: {
416-
id: {
417-
type: new GraphQLNonNull(GraphQLInt),
418-
description: 'ID of the notification to delete.',
419-
},
420-
},
421-
resolve(_, args, req) {
422-
return deleteNotification(args, req);
423-
},
424-
},
425356
activateCollectiveAsHost: {
426357
type: CollectiveInterfaceType,
427358
description: 'Activate a collective as Host.',
@@ -448,32 +379,6 @@ const mutations = {
448379
return deactivateCollectiveAsHost(_, args, req);
449380
},
450381
},
451-
activateBudget: {
452-
type: CollectiveInterfaceType,
453-
description: 'Activate budget (For Host Organizations only)',
454-
args: {
455-
id: {
456-
type: new GraphQLNonNull(GraphQLInt),
457-
description: 'ID of the "collective" (Host Organization)',
458-
},
459-
},
460-
resolve(_, args, req) {
461-
return activateBudget(_, args, req);
462-
},
463-
},
464-
deactivateBudget: {
465-
type: CollectiveInterfaceType,
466-
description: 'Deactivate budget (For Host Organizations only)',
467-
args: {
468-
id: {
469-
type: new GraphQLNonNull(GraphQLInt),
470-
description: 'ID of the "collective" (Host Organization)',
471-
},
472-
},
473-
resolve(_, args, req) {
474-
return deactivateBudget(_, args, req);
475-
},
476-
},
477382
};
478383

479384
export default mutations;

server/graphql/v1/mutations/collectives.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -724,41 +724,3 @@ export async function deactivateCollectiveAsHost(_, args, req) {
724724

725725
return collective;
726726
}
727-
728-
export async function activateBudget(_, args, req) {
729-
if (!req.remoteUser) {
730-
throw new Unauthorized('You need to be logged in to activate budget.');
731-
}
732-
733-
const collective = await req.loaders.Collective.byId.load(args.id);
734-
if (!collective) {
735-
throw new NotFound(`Collective with id ${args.id} not found`);
736-
}
737-
738-
if (!req.remoteUser.isAdminOfCollective(collective)) {
739-
throw new Unauthorized('You need to be logged in as an Admin.');
740-
}
741-
742-
await twoFactorAuthLib.enforceForAccount(req, collective, { onlyAskOnLogin: true });
743-
744-
return collective.activateBudget();
745-
}
746-
747-
export async function deactivateBudget(_, args, req) {
748-
if (!req.remoteUser) {
749-
throw new Unauthorized('You need to be logged in to deactivate budget.');
750-
}
751-
752-
const collective = await req.loaders.Collective.byId.load(args.id);
753-
if (!collective) {
754-
throw new NotFound(`Collective with id ${args.id} not found`);
755-
}
756-
757-
if (!req.remoteUser.isAdminOfCollective(collective)) {
758-
throw new Unauthorized('You need to be logged in as an Admin.');
759-
}
760-
761-
await twoFactorAuthLib.enforceForAccount(req, collective, { onlyAskOnLogin: true });
762-
763-
return collective.deactivateBudget();
764-
}

0 commit comments

Comments
 (0)