mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-22 17:15:13 +00:00
refactor
This commit is contained in:
parent
1d6ccd9781
commit
e88f08ad7d
1 changed files with 4 additions and 5 deletions
|
@ -95,15 +95,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
// Check if the circular reference will occur
|
// Check if the circular reference will occur
|
||||||
const checkCircle = async (folderId: string): Promise<boolean> => {
|
const checkCircle = async (folderId: string): Promise<boolean> => {
|
||||||
// Fetch folder
|
const folder2 = await this.driveFoldersRepository.findOneByOrFail({
|
||||||
const folder2 = await this.driveFoldersRepository.findOneBy({
|
|
||||||
id: folderId,
|
id: folderId,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (folder2!.id === folder!.id) {
|
if (folder2.id === folder.id) {
|
||||||
return true;
|
return true;
|
||||||
} else if (folder2!.parentId) {
|
} else if (folder2.parentId) {
|
||||||
return await checkCircle(folder2!.parentId);
|
return await checkCircle(folder2.parentId);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue