prettier fix

This commit is contained in:
Danel Kungla
2025-09-19 17:22:36 +03:00
parent efa94b3322
commit 0c2cfe6d18
509 changed files with 17988 additions and 9920 deletions

View File

@@ -148,12 +148,17 @@ export const deleteAccountAction = adminAction(
}
const medusa = getAdminSdk();
const { customer_groups } = await medusa.admin.customerGroup.list();
const customerGroup = customer_groups.find(({ name }) => name === customerGroupName);
const customerGroup = customer_groups.find(
({ name }) => name === customerGroupName,
);
if (customerGroup) {
try {
await medusa.admin.customerGroup.delete(customerGroup.id);
} catch (e) {
logger.error({ accountId }, `Error deleting Medusa customer group for company ${customerGroupName}`);
logger.error(
{ accountId },
`Error deleting Medusa customer group for company ${customerGroupName}`,
);
throw e;
}
}
@@ -288,22 +293,29 @@ export const createCompanyAccountAction = enhanceAction(
logger.info(ctx, `Creating Medusa customer group`);
const medusa = getAdminSdk();
const { customer_groups: existingCustomerGroups } = await medusa.admin.customerGroup.list();
const isExisting = existingCustomerGroups.find((group) => group.name === name);
const { customer_groups: existingCustomerGroups } =
await medusa.admin.customerGroup.list();
const isExisting = existingCustomerGroups.find(
(group) => group.name === name,
);
if (isExisting) {
logger.info(ctx, `Customer group already exists`);
} else {
logger.info(ctx, `Creating Medusa customer group`);
const { data: account } = await client
.schema('medreport').from('accounts')
.schema('medreport')
.from('accounts')
.select('medusa_account_id')
.eq('personal_code', ownerPersonalCode)
.single().throwOnError();
.single()
.throwOnError();
const medusaAccountId = account.medusa_account_id;
if (!medusaAccountId) {
logger.error(ctx, `User has no Medusa account ID`);
} else {
const { customer_group: { id: customerGroupId } } = await medusa.admin.customerGroup.create({ name });
const {
customer_group: { id: customerGroupId },
} = await medusa.admin.customerGroup.create({ name });
const { customers } = await medusa.admin.customer.list({
id: medusaAccountId,
});
@@ -316,7 +328,6 @@ export const createCompanyAccountAction = enhanceAction(
});
}
}
}
redirect(`/admin/accounts/${data.id}`);