diff --git a/client/src/features/projectsV2/api/projectV2.api.ts b/client/src/features/projectsV2/api/projectV2.api.ts index d685b66a4..4fb93ac43 100644 --- a/client/src/features/projectsV2/api/projectV2.api.ts +++ b/client/src/features/projectsV2/api/projectV2.api.ts @@ -4,11 +4,7 @@ const injectedRtkApi = api.injectEndpoints({ getProjects: build.query({ query: (queryArg) => ({ url: `/projects`, - params: { - namespace: queryArg["namespace"], - page: queryArg.page, - per_page: queryArg.perPage, - }, + params: { params: queryArg.params }, }), }), postProjects: build.mutation({ @@ -77,6 +73,14 @@ const injectedRtkApi = api.injectEndpoints({ method: "DELETE", }), }), + getProjectsByProjectIdDataConnectorLinks: build.query< + GetProjectsByProjectIdDataConnectorLinksApiResponse, + GetProjectsByProjectIdDataConnectorLinksApiArg + >({ + query: (queryArg) => ({ + url: `/projects/${queryArg.projectId}/data_connector_links`, + }), + }), }), overrideExisting: false, }); @@ -84,12 +88,8 @@ export { injectedRtkApi as projectV2Api }; export type GetProjectsApiResponse = /** status 200 List of projects */ ProjectsList; export type GetProjectsApiArg = { - /** A namespace, used as a filter. */ - namespace?: string; - /** Result's page number starting from 1 */ - page?: number; - /** The number of results per page */ - perPage?: number; + /** query parameters */ + params?: ProjectGetQuery; }; export type PostProjectsApiResponse = /** status 201 The project was created */ Project; @@ -138,6 +138,12 @@ export type DeleteProjectsByProjectIdMembersAndMemberIdApiArg = { /** This is user's KeyCloak ID */ memberId: UserId; }; +export type GetProjectsByProjectIdDataConnectorLinksApiResponse = + /** status 200 List of data connector to project links */ DataConnectorToProjectLinksList; +export type GetProjectsByProjectIdDataConnectorLinksApiArg = { + /** the ID of the project */ + projectId: Ulid; +}; export type Ulid = string; export type ProjectName = string; export type Slug = string; @@ -171,6 +177,16 @@ export type ErrorResponse = { message: string; }; }; +export type PaginationRequest = { + /** Result's page number starting from 1 */ + page?: number; + /** The number of results per page */ + per_page?: number; +}; +export type ProjectGetQuery = PaginationRequest & { + /** A namespace, used as a filter. */ + namespace?: string; +}; export type ProjectPost = { name: ProjectName; namespace: Slug; @@ -188,7 +204,6 @@ export type ProjectPatch = { description?: Description; keywords?: KeywordsList; }; -export type UserEmail = string; export type UserFirstLastName = string; export type Role = "viewer" | "editor" | "owner"; export type ProjectMemberResponse = { @@ -204,6 +219,14 @@ export type ProjectMemberPatchRequest = { role: Role; }; export type ProjectMemberListPatchRequest = ProjectMemberPatchRequest[]; +export type DataConnectorToProjectLink = { + id: Ulid; + data_connector_id: Ulid; + project_id: Ulid; + creation_date: CreationDate; + created_by: UserId; +}; +export type DataConnectorToProjectLinksList = DataConnectorToProjectLink[]; export const { useGetProjectsQuery, usePostProjectsMutation, @@ -214,4 +237,5 @@ export const { useGetProjectsByProjectIdMembersQuery, usePatchProjectsByProjectIdMembersMutation, useDeleteProjectsByProjectIdMembersAndMemberIdMutation, + useGetProjectsByProjectIdDataConnectorLinksQuery, } = injectedRtkApi; diff --git a/client/src/features/projectsV2/api/projectV2.enhanced-api.ts b/client/src/features/projectsV2/api/projectV2.enhanced-api.ts index 731211307..5094999b6 100644 --- a/client/src/features/projectsV2/api/projectV2.enhanced-api.ts +++ b/client/src/features/projectsV2/api/projectV2.enhanced-api.ts @@ -179,6 +179,7 @@ const injectedApi = api.injectEndpoints({ const enhancedApi = injectedApi.enhanceEndpoints({ addTagTypes: [ + "DataConnectors", "Group", "GroupMembers", "Namespace", @@ -237,6 +238,9 @@ const enhancedApi = injectedApi.enhanceEndpoints({ getProjectsByProjectId: { providesTags: ["Project"], }, + getProjectsByProjectIdDataConnectorLinks: { + providesTags: ["DataConnectors"], + }, getProjectsByProjectIdMembers: { providesTags: ["ProjectMembers"], }, @@ -289,6 +293,7 @@ export const { usePostProjectsMutation, useGetProjectsByNamespaceAndSlugQuery, useGetProjectsByProjectIdQuery, + useGetProjectsByProjectIdDataConnectorLinksQuery, usePatchProjectsByProjectIdMutation, useDeleteProjectsByProjectIdMutation, useGetProjectsByProjectIdMembersQuery, diff --git a/client/src/features/projectsV2/api/projectV2.openapi.json b/client/src/features/projectsV2/api/projectV2.openapi.json index a82f6afda..e9cf9d65e 100644 --- a/client/src/features/projectsV2/api/projectV2.openapi.json +++ b/client/src/features/projectsV2/api/projectV2.openapi.json @@ -20,34 +20,12 @@ "parameters": [ { "in": "query", - "description": "A namespace, used as a filter.", - "name": "namespace", - "required": false, + "description": "query parameters", + "name": "params", + "style": "form", + "explode": true, "schema": { - "type": "string" - } - }, - { - "in": "query", - "description": "Result's page number starting from 1", - "name": "page", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "default": 1 - } - }, - { - "in": "query", - "description": "The number of results per page", - "name": "per_page", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "maximum": 100, - "default": 20 + "$ref": "#/components/schemas/ProjectGetQuery" } } ], @@ -417,6 +395,38 @@ }, "tags": ["projects"] } + }, + "/projects/{project_id}/data_connector_links": { + "parameters": [ + { + "in": "path", + "name": "project_id", + "required": true, + "schema": { + "$ref": "#/components/schemas/Ulid" + }, + "description": "the ID of the project" + } + ], + "get": { + "summary": "Get all links from data connectors to a given project", + "responses": { + "200": { + "description": "List of data connector to project links", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataConnectorToProjectLinksList" + } + } + } + }, + "default": { + "$ref": "#/components/responses/Error" + } + }, + "tags": ["projects"] + } } }, "components": { @@ -556,7 +566,7 @@ "type": "string", "minLength": 26, "maxLength": 26, - "pattern": "^[A-Z0-9]{26}$" + "pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" }, "ProjectName": { "description": "Renku project name", @@ -667,15 +677,15 @@ "minItems": 0 }, "ProjectMemberResponse": { - "description": "A member with full info (email, name, ...) and the access level to the project", + "description": "A member with full info (namespace, name, ...) and the access level to the project", "type": "object", "additionalProperties": false, "properties": { "id": { "$ref": "#/components/schemas/UserId" }, - "email": { - "$ref": "#/components/schemas/UserEmail" + "namespace": { + "$ref": "#/components/schemas/Slug" }, "first_name": { "$ref": "#/components/schemas/UserFirstLastName" @@ -707,17 +717,83 @@ "minLength": 1, "maxLength": 256 }, - "UserEmail": { - "type": "string", - "format": "email", - "description": "User email", - "example": "some-user@gmail.com" - }, "ETag": { "type": "string", "description": "Entity Tag", "example": "9EE498F9D565D0C41E511377425F32F3" }, + "DataConnectorToProjectLinksList": { + "description": "A list of links from a data connector to a project", + "type": "array", + "items": { + "$ref": "#/components/schemas/DataConnectorToProjectLink" + } + }, + "DataConnectorToProjectLink": { + "description": "A link from a data connector to a project in Renku 2.0", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "$ref": "#/components/schemas/Ulid" + }, + "data_connector_id": { + "$ref": "#/components/schemas/Ulid" + }, + "project_id": { + "$ref": "#/components/schemas/Ulid" + }, + "creation_date": { + "$ref": "#/components/schemas/CreationDate" + }, + "created_by": { + "$ref": "#/components/schemas/UserId" + } + }, + "required": [ + "id", + "data_connector_id", + "project_id", + "creation_date", + "created_by" + ] + }, + "ProjectGetQuery": { + "description": "Query params for project get request", + "allOf": [ + { + "$ref": "#/components/schemas/PaginationRequest" + }, + { + "properties": { + "namespace": { + "description": "A namespace, used as a filter.", + "type": "string", + "default": "" + } + } + } + ] + }, + "PaginationRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "page": { + "description": "Result's page number starting from 1", + "type": "integer", + "minimum": 1, + "default": 1 + }, + "per_page": { + "description": "The number of results per page", + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 20 + } + } + }, "ErrorResponse": { "type": "object", "properties": {