fixing Flock rename
This commit is contained in:
@@ -196,19 +196,28 @@ export const updateWorkspace = async ({
|
||||
billingPlan: BillingPlan;
|
||||
}) => {
|
||||
const result = await db.query<WorkspaceRow>(
|
||||
`UPDATE workspaces
|
||||
SET name = $2,
|
||||
workspace_type = $3::varchar,
|
||||
billing_email = $4,
|
||||
billing_plan = $5::varchar,
|
||||
`WITH input AS (
|
||||
SELECT
|
||||
$1::integer AS workspace_id,
|
||||
$2::varchar AS name,
|
||||
$3::varchar AS workspace_type,
|
||||
$4::varchar AS billing_email,
|
||||
$5::varchar AS billing_plan
|
||||
)
|
||||
UPDATE workspaces
|
||||
SET name = input.name,
|
||||
workspace_type = input.workspace_type,
|
||||
billing_email = input.billing_email,
|
||||
billing_plan = input.billing_plan,
|
||||
rescue_verification_status = CASE
|
||||
WHEN $3::varchar = 'rescue' AND rescue_verification_status = 'not_required' THEN 'pending'
|
||||
WHEN $3::varchar = 'standard' THEN 'not_required'
|
||||
ELSE rescue_verification_status
|
||||
WHEN input.workspace_type = 'rescue' AND workspaces.rescue_verification_status = 'not_required' THEN 'pending'
|
||||
WHEN input.workspace_type = 'standard' THEN 'not_required'
|
||||
ELSE workspaces.rescue_verification_status
|
||||
END,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = $1
|
||||
RETURNING id, name, workspace_type, billing_email, billing_plan, subscription_status, rescue_verification_status, created_at, updated_at`,
|
||||
FROM input
|
||||
WHERE workspaces.id = input.workspace_id
|
||||
RETURNING workspaces.id, workspaces.name, workspaces.workspace_type, workspaces.billing_email, workspaces.billing_plan, workspaces.subscription_status, workspaces.rescue_verification_status, workspaces.created_at, workspaces.updated_at`,
|
||||
[workspaceId, name, workspaceType, billingEmail, billingPlan],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user