refactor: helper function manual throw
This change is to prevent swagger to infer empty type from return type
This commit is contained in:
parent
5b9472b466
commit
4da867cde1
4 changed files with 22 additions and 22 deletions
|
|
@ -26,7 +26,7 @@ import {
|
|||
} from "../services/permission";
|
||||
import { filterStatus } from "../services/prisma";
|
||||
import { connectOrDisconnect, connectOrNot } from "../utils/relation";
|
||||
import { throwNotFound } from "../utils/error";
|
||||
import { notFoundError } from "../utils/error";
|
||||
|
||||
if (!process.env.MINIO_BUCKET) {
|
||||
throw Error("Require MinIO bucket.");
|
||||
|
|
@ -298,7 +298,7 @@ export class BranchController extends Controller {
|
|||
where: { id: branchId },
|
||||
});
|
||||
|
||||
if (!record) return throwNotFound("Branch");
|
||||
if (!record) throw notFoundError("Branch");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ export class BranchController extends Controller {
|
|||
where: { id: branchId },
|
||||
});
|
||||
|
||||
if (!record) return throwNotFound("Branch");
|
||||
if (!record) throw notFoundError("Branch");
|
||||
|
||||
await permissionCheck(req.user, record);
|
||||
|
||||
|
|
@ -589,7 +589,7 @@ export class BranchFileController extends Controller {
|
|||
include: branchRelationPermInclude(user),
|
||||
where: { id },
|
||||
});
|
||||
if (!data) return throwNotFound("Branch");
|
||||
if (!data) throw notFoundError("Branch");
|
||||
await permissionCheck(user, data);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue