Skip to content

Commit

Permalink
feat: use direct_member to filter projects and groups where the user …
Browse files Browse the repository at this point in the history
…is a member
  • Loading branch information
andre-code committed Oct 1, 2024
1 parent 703f7ff commit 4363e03
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions client/src/features/dashboardV2/DashboardV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function ProjectList() {
const { data, error, isLoading } = useGetProjectsQuery({
page: 1,
perPage: 5,
direct_member: true,
});

const noProjects = isLoading ? (
Expand Down Expand Up @@ -215,6 +216,7 @@ function GroupsList() {
const { data, error, isLoading } = useGetGroupsQuery({
page: 1,
perPage: 5,
direct_member: true,
});

const noGroups = isLoading ? (
Expand Down
2 changes: 2 additions & 0 deletions client/src/features/projectsV2/api/namespace.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export type GetGroupsApiArg = {
page?: number;
/** The number of results per page */
perPage?: number;
/** A flag to filter groups where the user is a direct member */
direct_member?: boolean;
};
export type PostGroupsApiResponse =
/** status 201 The group was created */ GroupResponse;
Expand Down
2 changes: 2 additions & 0 deletions client/src/features/projectsV2/api/projectV2.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export type GetProjectsApiArg = {
page?: number;
/** The number of results per page */
perPage?: number;
/** A flag to filter projects where the user is a direct member */
direct_member?: boolean;
};
export type PostProjectsApiResponse =
/** status 201 The project was created */ Project;
Expand Down
7 changes: 6 additions & 1 deletion client/src/features/projectsV2/api/projectV2.enhanced-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ const injectedApi = api.injectEndpoints({
getGroupsPaged: builder.query<GetGroupsApiResponse, GetGroupsApiArg>({
query: (queryArg) => ({
url: "/groups",
params: { page: queryArg.page, per_page: queryArg.perPage },
params: {
page: queryArg.page,
per_page: queryArg.perPage,
direct_member: queryArg["direct_member"],
},
}),
transformResponse: (response, meta, queryArg) => {
const groups = response as GroupResponseList;
Expand Down Expand Up @@ -113,6 +117,7 @@ const injectedApi = api.injectEndpoints({
url: "/projects",
params: {
namespace: queryArg["namespace"],
direct_member: queryArg["direct_member"],
page: queryArg.page,
per_page: queryArg.perPage,
},
Expand Down

0 comments on commit 4363e03

Please sign in to comment.