@plandesk/api 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/identity.js
CHANGED
|
@@ -176,6 +176,14 @@ export async function backfillProjectWorkspaces(db, auth) {
|
|
|
176
176
|
let projectsUpdated = 0;
|
|
177
177
|
for (const row of result.rows) {
|
|
178
178
|
const project = row;
|
|
179
|
+
// Only repair projects whose workspace_id does NOT reference a real team in
|
|
180
|
+
// their org (the placeholder column default, or a dangling id). A project
|
|
181
|
+
// already in a valid workspace — e.g. one legacy-upgrade/move/go-online
|
|
182
|
+
// placed in a non-default team — must be left alone, never reset to General.
|
|
183
|
+
if (project.workspace_id.length > 0 &&
|
|
184
|
+
(await getTeamInOrg(auth, project.workspace_id, project.org_id)) !== undefined) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
179
187
|
const teamId = await ensureDefaultTeamForOrg(auth, project.org_id);
|
|
180
188
|
if (project.workspace_id !== teamId) {
|
|
181
189
|
await updateProject(db, project.id, { workspaceId: teamId });
|