Skip to content

Commit

Permalink
Adjust projectApi
Browse files Browse the repository at this point in the history
  • Loading branch information
harminius committed Dec 13, 2024
1 parent c28dc1d commit 8a518af
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
28 changes: 24 additions & 4 deletions web-app/packages/lib/src/modules/project/projectApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
ProjectVersion,
ProjectAccessDetail,
ProjectAccess,
ProjectVersionFileChange
ProjectVersionFileChange, CreateProjectAccessParams

Check warning on line 28 in web-app/packages/lib/src/modules/project/projectApi.ts

View workflow job for this annotation

GitHub Actions / JavaScript code convention check

Insert `⏎·`
} from '@/modules/project/types'

export const ProjectApi = {
Expand Down Expand Up @@ -175,12 +175,32 @@ export const ProjectApi = {

async updateProjectAccess(
id: string,
userId: number,
data: UpdateProjectAccessParams,
withRetry?: boolean
): Promise<AxiosResponse<ProjectAccess>> {
return ProjectModule.httpService.patch(`/app/project/${id}/access`, data, {
...(withRetry ? getDefaultRetryOptions() : {})
})
return ProjectModule.httpService.patch(
`/v2/projects/${id}/collaborators/${userId}`,
data,
{
...(withRetry ? getDefaultRetryOptions() : {})
}
)
},

async createProjectAccess(
id: string,
userId: number,
data: CreateProjectAccessParams,
withRetry?: boolean
): Promise<AxiosResponse<ProjectAccess>> {
return ProjectModule.httpService.post(
`/v2/projects/${id}/collaborators/${userId}`,
data,
{
...(withRetry ? getDefaultRetryOptions() : {})
}
)
},

async pushProjectChanges(
Expand Down
6 changes: 6 additions & 0 deletions web-app/packages/lib/src/modules/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ export interface UpdateProjectAccessParams {
public?: boolean
}

export interface CreateProjectAccessParams {
user_id?: number
role?: ProjectRoleName
public?: boolean
}

export interface DownloadPayload {
url: string
}
Expand Down

0 comments on commit 8a518af

Please sign in to comment.