feat: unpause all members on pro activation
This commit is contained in:
@@ -220,6 +220,19 @@ export const initAuth = (db: dbClient) => {
|
|||||||
console.log(
|
console.log(
|
||||||
`Pro subscription ${stripeSubscription.id} activated with unlimited seats`,
|
`Pro subscription ${stripeSubscription.id} activated with unlimited seats`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const workspace = await workspaceRepo.getByPublicId(
|
||||||
|
db,
|
||||||
|
subscription.referenceId,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (workspace?.id) {
|
||||||
|
await memberRepo.unpauseAllMembers(db, workspace.id);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`Unpausing all members for workspace ${workspace.id}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -95,3 +95,15 @@ export const softDelete = async (
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const unpauseAllMembers = async (db: dbClient, workspaceId: number) => {
|
||||||
|
await db
|
||||||
|
.update(workspaceMembers)
|
||||||
|
.set({ status: "active" })
|
||||||
|
.where(
|
||||||
|
and(
|
||||||
|
eq(workspaceMembers.workspaceId, workspaceId),
|
||||||
|
eq(workspaceMembers.status, "paused"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user