mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 04:26:33 +00:00
wip
This commit is contained in:
@@ -1064,6 +1064,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
type: z.nativeEnum(ProjectType).optional(),
|
||||
orderBy: z.nativeEnum(SearchProjectSortBy).optional().default(SearchProjectSortBy.NAME),
|
||||
orderDirection: z.nativeEnum(SortDirection).optional().default(SortDirection.ASC),
|
||||
projectIds: z.string().trim().array().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.trim()
|
||||
|
||||
@@ -399,6 +399,7 @@ export const projectDALFactory = (db: TDbClient) => {
|
||||
name?: string;
|
||||
sortBy?: SearchProjectSortBy;
|
||||
sortDir?: SortDirection;
|
||||
projectIds?: string[];
|
||||
}) => {
|
||||
const { limit = 20, offset = 0, sortBy = SearchProjectSortBy.NAME, sortDir = SortDirection.ASC } = dto;
|
||||
|
||||
@@ -454,6 +455,11 @@ export const projectDALFactory = (db: TDbClient) => {
|
||||
if (dto.name) {
|
||||
void query.whereILike(`${TableName.Project}.name`, `%${dto.name}%`);
|
||||
}
|
||||
|
||||
if (dto.projectIds?.length) {
|
||||
void query.whereIn(`${TableName.Project}.id`, dto.projectIds);
|
||||
}
|
||||
|
||||
const docs = await query;
|
||||
|
||||
return { docs, totalCount: Number(docs?.[0]?.count ?? 0) };
|
||||
|
||||
@@ -1806,7 +1806,8 @@ export const projectServiceFactory = ({
|
||||
limit,
|
||||
type,
|
||||
orderBy,
|
||||
orderDirection
|
||||
orderDirection,
|
||||
projectIds
|
||||
}: TSearchProjectsDTO) => {
|
||||
// check user belong to org
|
||||
await permissionService.getOrgPermission(
|
||||
@@ -1822,6 +1823,7 @@ export const projectServiceFactory = ({
|
||||
offset,
|
||||
name,
|
||||
type,
|
||||
projectIds,
|
||||
orgId: permission.orgId,
|
||||
actor: permission.type,
|
||||
actorId: permission.id,
|
||||
|
||||
@@ -221,6 +221,7 @@ export type TSearchProjectsDTO = {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
orderBy?: SearchProjectSortBy;
|
||||
projectIds?: string[];
|
||||
orderDirection?: SortDirection;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user