mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 20:27:12 +00:00
Added new special query for getting org from project ID
This commit is contained in:
committed by
Akhil Mohan
parent
ce580f417e
commit
e4f00f74e9
@@ -47,6 +47,19 @@ export const orgDALFactory = (db: TDbClient) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const findOrgByProjectId = async (projectId: string): Promise<TOrganizations> => {
|
||||||
|
try {
|
||||||
|
const [org] = await db(TableName.Project)
|
||||||
|
.where({ [`${[TableName.Project]}.id`]: projectId })
|
||||||
|
.join(TableName.Organization, `${TableName.Project}.orgId`, `${TableName.Organization}.id`)
|
||||||
|
.select(`${TableName.Organization}.*`);
|
||||||
|
|
||||||
|
return org;
|
||||||
|
} catch (error) {
|
||||||
|
throw new DatabaseError({ error, name: "Find org by project id" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// special query
|
// special query
|
||||||
const findAllOrgMembers = async (orgId: string) => {
|
const findAllOrgMembers = async (orgId: string) => {
|
||||||
try {
|
try {
|
||||||
@@ -193,6 +206,7 @@ export const orgDALFactory = (db: TDbClient) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return withTransaction(db, {
|
return withTransaction(db, {
|
||||||
|
findOrgByProjectId,
|
||||||
findAllOrgMembers,
|
findAllOrgMembers,
|
||||||
findOrgById,
|
findOrgById,
|
||||||
findAllOrgsByUserId,
|
findAllOrgsByUserId,
|
||||||
|
|||||||
Reference in New Issue
Block a user