core: fix contest discussion parentId (#662)

pull/664/head
panda 1 year ago committed by GitHub
parent 385d90fa39
commit a9b2f68d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -288,7 +288,7 @@ export async function getVnode(domainId: string, type: number, id: string, uid?:
tdoc.attend = tsdoc?.attend || tsdoc?.enroll;
}
return {
...tdoc, type, id, hidden: false,
...tdoc, type, id: _id, hidden: false,
};
}
return {

@ -616,6 +616,20 @@ const scripts: UpgradeScript[] = [
}
return true;
},
async function _84_85() {
return await iterateAllDomain(async ({ _id }) => {
const cursor = discussion.getMulti(_id, { parentType: document.TYPE_CONTEST });
for await (const ddoc of cursor) {
const parentId = new ObjectId(ddoc.parentId);
await discussion.edit(_id, ddoc.docId, { parentId });
try {
await contest.get(_id, parentId);
} catch (e) {
await discussion.del(_id, ddoc.docId);
}
}
});
},
];
export default scripts;

Loading…
Cancel
Save