mirror of https://github.com/fantasticit/think.git
server: remove fix script
parent
914f7dcc00
commit
67549e3aa7
|
@ -41,26 +41,7 @@ export class WikiService {
|
||||||
|
|
||||||
@Inject(forwardRef(() => ViewService))
|
@Inject(forwardRef(() => ViewService))
|
||||||
private readonly viewService: ViewService
|
private readonly viewService: ViewService
|
||||||
) {
|
) {}
|
||||||
this.fixWikiData();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修正脚本
|
|
||||||
async fixWikiData() {
|
|
||||||
const wikis = await this.wikiRepo.find();
|
|
||||||
const needFixWikis = wikis.filter((wiki) => !wiki.homeDocumentId);
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
needFixWikis.map(async (wiki) => {
|
|
||||||
const doc = await this.documentService.findWikiHomeDocument(wiki.id);
|
|
||||||
const homeDocumentId = doc.id;
|
|
||||||
const withHomeDocumentIdWiki = await this.wikiRepo.merge(wiki, { homeDocumentId });
|
|
||||||
await this.wikiRepo.save(withHomeDocumentIdWiki);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log('修正完成');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按 id 查取知识库
|
* 按 id 查取知识库
|
||||||
|
|
Loading…
Reference in New Issue