Rename "Organization" to "Team" across web app and update related services
Renamed all instances of "Organization" with "Team" across the entire web application to reflect the latest change in terminology. This further extends to renaming related services, components, and their respective invocation instances. Separate billing permissions have been defined for Team accounts, and security actions have been updated in SQL schema along with some layout adjustments.
This commit is contained in:
@@ -35,25 +35,30 @@ export class DeletePersonalAccountService {
|
||||
productName: string;
|
||||
};
|
||||
}) {
|
||||
const userId = params.userId;
|
||||
|
||||
Logger.info(
|
||||
{ userId: params.userId, name: this.namespace },
|
||||
{ name: this.namespace, userId },
|
||||
'User requested deletion. Processing...',
|
||||
);
|
||||
|
||||
// Cancel all user subscriptions
|
||||
const billingService = new AccountBillingService(params.adminClient);
|
||||
|
||||
await billingService.cancelAllAccountSubscriptions(params.userId);
|
||||
await billingService.cancelAllAccountSubscriptions({
|
||||
userId,
|
||||
accountId: userId,
|
||||
});
|
||||
|
||||
// execute the deletion of the user
|
||||
try {
|
||||
await params.adminClient.auth.admin.deleteUser(params.userId);
|
||||
await params.adminClient.auth.admin.deleteUser(userId);
|
||||
} catch (error) {
|
||||
Logger.error(
|
||||
{
|
||||
userId: params.userId,
|
||||
error,
|
||||
name: this.namespace,
|
||||
userId,
|
||||
error,
|
||||
},
|
||||
'Error deleting user',
|
||||
);
|
||||
@@ -66,8 +71,8 @@ export class DeletePersonalAccountService {
|
||||
try {
|
||||
Logger.info(
|
||||
{
|
||||
userId: params.userId,
|
||||
name: this.namespace,
|
||||
userId,
|
||||
},
|
||||
`Sending account deletion email...`,
|
||||
);
|
||||
@@ -81,8 +86,8 @@ export class DeletePersonalAccountService {
|
||||
} catch (error) {
|
||||
Logger.error(
|
||||
{
|
||||
userId: params.userId,
|
||||
name: this.namespace,
|
||||
userId,
|
||||
error,
|
||||
},
|
||||
`Error sending account deletion email`,
|
||||
|
||||
@@ -17,6 +17,11 @@ export async function deleteTeamAccountAction(formData: FormData) {
|
||||
);
|
||||
|
||||
const client = getSupabaseServerActionClient();
|
||||
const auth = await requireAuth(client);
|
||||
|
||||
if (auth.error) {
|
||||
throw new Error('Authentication required');
|
||||
}
|
||||
|
||||
// Check if the user has the necessary permissions to delete the team account
|
||||
await assertUserPermissionsToDeleteTeamAccount(client, params.accountId);
|
||||
@@ -29,7 +34,10 @@ export async function deleteTeamAccountAction(formData: FormData) {
|
||||
getSupabaseServerActionClient({
|
||||
admin: true,
|
||||
}),
|
||||
params,
|
||||
{
|
||||
accountId: params.accountId,
|
||||
userId: auth.data.user.id,
|
||||
},
|
||||
);
|
||||
|
||||
return redirect('/home');
|
||||
|
||||
@@ -20,12 +20,16 @@ export class DeleteTeamAccountService {
|
||||
*/
|
||||
async deleteTeamAccount(
|
||||
adminClient: SupabaseClient<Database>,
|
||||
params: { accountId: string },
|
||||
params: {
|
||||
accountId: string;
|
||||
userId: string;
|
||||
},
|
||||
) {
|
||||
Logger.info(
|
||||
{
|
||||
name: this.namespace,
|
||||
accountId: params.accountId,
|
||||
userId: params.userId,
|
||||
},
|
||||
`Requested team account deletion. Processing...`,
|
||||
);
|
||||
@@ -34,6 +38,7 @@ export class DeleteTeamAccountService {
|
||||
{
|
||||
name: this.namespace,
|
||||
accountId: params.accountId,
|
||||
userId: params.userId,
|
||||
},
|
||||
`Deleting all account subscriptions...`,
|
||||
);
|
||||
@@ -41,7 +46,7 @@ export class DeleteTeamAccountService {
|
||||
// First - we want to cancel all Stripe active subscriptions
|
||||
const billingService = new AccountBillingService(adminClient);
|
||||
|
||||
await billingService.cancelAllAccountSubscriptions(params.accountId);
|
||||
await billingService.cancelAllAccountSubscriptions(params);
|
||||
|
||||
// now we can use the admin client to delete the account.
|
||||
const { error } = await adminClient
|
||||
@@ -54,6 +59,7 @@ export class DeleteTeamAccountService {
|
||||
{
|
||||
name: this.namespace,
|
||||
accountId: params.accountId,
|
||||
userId: params.userId,
|
||||
error,
|
||||
},
|
||||
'Failed to delete team account',
|
||||
@@ -66,6 +72,7 @@ export class DeleteTeamAccountService {
|
||||
{
|
||||
name: this.namespace,
|
||||
accountId: params.accountId,
|
||||
userId: params.userId,
|
||||
},
|
||||
'Successfully deleted team account',
|
||||
);
|
||||
|
||||
@@ -17,10 +17,10 @@ const badgeVariants = cva(
|
||||
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
|
||||
outline: 'text-foreground',
|
||||
success:
|
||||
'border-transparent bg-green-50 text-green-500 dark:bg-green-500/20',
|
||||
'border-transparent bg-green-50 hover:bg-green-50 text-green-500 dark:bg-green-500/20 dark:hover:bg-green-500/20',
|
||||
warning:
|
||||
'border-transparent bg-orange-50 text-orange-500 dark:bg-transparent',
|
||||
info: 'border-transparent bg-blue-50 text-blue-500 dark:bg-transparent',
|
||||
'border-transparent bg-orange-50 hover:bg-orange-50 text-orange-500 dark:bg-orange-500/20 dark:hover:bg-orange-500/20',
|
||||
info: 'border-transparent bg-blue-50 hover:bg-blue-50 text-blue-500 dark:bg-blue-500/20 dark:hover:bg-blue-500/20',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
|
||||
Reference in New Issue
Block a user