mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 07:27:58 +00:00
Fix: Allow query function to be called with undefined orgId, and handle it as an error
This commit is contained in:
@@ -168,8 +168,12 @@ export const projectDALFactory = (db: TDbClient) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const findProjectBySlug = async (slug: string, orgId: string) => {
|
const findProjectBySlug = async (slug: string, orgId: string | undefined) => {
|
||||||
try {
|
try {
|
||||||
|
if (!orgId) {
|
||||||
|
throw new BadRequestError({ message: "Organization ID is required when querying with slugs" });
|
||||||
|
}
|
||||||
|
|
||||||
const projects = await db(TableName.ProjectMembership)
|
const projects = await db(TableName.ProjectMembership)
|
||||||
.where(`${TableName.Project}.slug`, slug)
|
.where(`${TableName.Project}.slug`, slug)
|
||||||
.where(`${TableName.Project}.orgId`, orgId)
|
.where(`${TableName.Project}.orgId`, orgId)
|
||||||
|
|||||||
Reference in New Issue
Block a user