2025-12-20 11:18:59 +00:00
|
|
|
/**
|
|
|
|
|
* 项目管理相关 API
|
|
|
|
|
*/
|
|
|
|
|
import request from '@/utils/request'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取我的项目列表
|
|
|
|
|
*/
|
|
|
|
|
export function getMyProjects() {
|
|
|
|
|
return request({
|
|
|
|
|
url: '/projects/',
|
|
|
|
|
method: 'get',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-29 12:53:50 +00:00
|
|
|
/**
|
|
|
|
|
* 获取我创建的项目列表
|
|
|
|
|
*/
|
|
|
|
|
export function getOwnedProjects() {
|
|
|
|
|
return request({
|
|
|
|
|
url: '/projects/my',
|
|
|
|
|
method: 'get',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取我参与的项目列表
|
|
|
|
|
*/
|
|
|
|
|
export function getSharedProjects() {
|
|
|
|
|
return request({
|
|
|
|
|
url: '/projects/shared',
|
|
|
|
|
method: 'get',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-20 11:18:59 +00:00
|
|
|
/**
|
|
|
|
|
* 创建项目
|
|
|
|
|
*/
|
|
|
|
|
export function createProject(data) {
|
|
|
|
|
return request({
|
|
|
|
|
url: '/projects/',
|
|
|
|
|
method: 'post',
|
|
|
|
|
data,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取项目详情
|
|
|
|
|
*/
|
|
|
|
|
export function getProject(projectId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}`,
|
|
|
|
|
method: 'get',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新项目信息
|
|
|
|
|
*/
|
|
|
|
|
export function updateProject(projectId, data) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}`,
|
|
|
|
|
method: 'put',
|
|
|
|
|
data,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除项目
|
|
|
|
|
*/
|
|
|
|
|
export function deleteProject(projectId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}`,
|
|
|
|
|
method: 'delete',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-09 10:08:38 +00:00
|
|
|
/**
|
|
|
|
|
* 转移项目所有权
|
|
|
|
|
*/
|
|
|
|
|
export function transferProject(projectId, newOwnerId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/transfer`,
|
|
|
|
|
method: 'post',
|
|
|
|
|
data: { new_owner_id: newOwnerId },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-20 11:18:59 +00:00
|
|
|
/**
|
|
|
|
|
* 获取项目成员
|
|
|
|
|
*/
|
|
|
|
|
export function getProjectMembers(projectId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/members`,
|
|
|
|
|
method: 'get',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加项目成员
|
|
|
|
|
*/
|
|
|
|
|
export function addProjectMember(projectId, data) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/members`,
|
|
|
|
|
method: 'post',
|
|
|
|
|
data,
|
|
|
|
|
})
|
|
|
|
|
}
|
2025-12-29 12:53:50 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除项目成员
|
|
|
|
|
*/
|
|
|
|
|
export function removeProjectMember(projectId, userId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/members/${userId}`,
|
|
|
|
|
method: 'delete',
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-01-05 10:50:29 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Git Pull
|
|
|
|
|
*/
|
|
|
|
|
export function gitPull(projectId, repoId = null, force = false) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/git/pull`,
|
|
|
|
|
method: 'post',
|
|
|
|
|
params: { repo_id: repoId, force }
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Git Push
|
|
|
|
|
*/
|
|
|
|
|
export function gitPush(projectId, repoId = null, force = false) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/git/push`,
|
|
|
|
|
method: 'post',
|
|
|
|
|
params: { repo_id: repoId, force }
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取Git仓库列表
|
|
|
|
|
*/
|
|
|
|
|
export function getGitRepos(projectId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/git-repos`,
|
|
|
|
|
method: 'get',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加Git仓库
|
|
|
|
|
*/
|
|
|
|
|
export function createGitRepo(projectId, data) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/git-repos`,
|
|
|
|
|
method: 'post',
|
|
|
|
|
data,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新Git仓库
|
|
|
|
|
*/
|
|
|
|
|
export function updateGitRepo(projectId, repoId, data) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/git-repos/${repoId}`,
|
|
|
|
|
method: 'put',
|
|
|
|
|
data,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除Git仓库
|
|
|
|
|
*/
|
|
|
|
|
export function deleteGitRepo(projectId, repoId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/projects/${projectId}/git-repos/${repoId}`,
|
|
|
|
|
method: 'delete',
|
|
|
|
|
})
|
|
|
|
|
}
|