From 629b7aacbb6559fdd86503c36529a1e955141f35 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 8 Sep 2020 18:06:14 +0530 Subject: [PATCH] :recycle: Update group ID as attribute --- src/_staart/rest/group.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/_staart/rest/group.ts b/src/_staart/rest/group.ts index a27f0f585..b0c30692f 100644 --- a/src/_staart/rest/group.ts +++ b/src/_staart/rest/group.ts @@ -212,8 +212,14 @@ export const updateGroupBillingForUser = async ( result = await createCustomer( groupId, data, - (groupId: number, data: groupsUpdateInput) => - prisma.groups.update({ where: { id: groupId }, data }) + async (groupId: number, data: { stripeCustomerId: string }) => { + const attributes = + typeof group.attributes === "object" ? group.attributes : {}; + return prisma.groups.update({ + where: { id: groupId }, + data: { attributes: { ...attributes, ...data } }, + }); + } ); } queueWebhook(groupId, Webhooks.UPDATE_ORGANIZATION_BILLING, data);