1
This commit is contained in:
106
api/system/companyGit/index.ts
Normal file
106
api/system/companyGit/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '~/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { CompanyGit, CompanyGitParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/index';
|
||||
|
||||
/**
|
||||
* 分页查询代码仓库
|
||||
*/
|
||||
export async function pageCompanyGit(params: CompanyGitParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CompanyGit>>>(
|
||||
SERVER_API_URL + '/system/company-git/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询代码仓库列表
|
||||
*/
|
||||
export async function listCompanyGit(params?: CompanyGitParam) {
|
||||
const res = await request.get<ApiResult<CompanyGit[]>>(
|
||||
SERVER_API_URL + '/system/company-git',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加代码仓库
|
||||
*/
|
||||
export async function addCompanyGit(data: CompanyGit) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/company-git',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代码仓库
|
||||
*/
|
||||
export async function updateCompanyGit(data: CompanyGit) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/company-git',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代码仓库
|
||||
*/
|
||||
export async function removeCompanyGit(id?: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/company-git/' + id
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除代码仓库
|
||||
*/
|
||||
export async function removeBatchCompanyGit(data: (number | undefined)[]) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/company-git/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询代码仓库
|
||||
*/
|
||||
export async function getCompanyGit(id: number) {
|
||||
const res = await request.get<ApiResult<CompanyGit>>(
|
||||
SERVER_API_URL + '/system/company-git/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
41
api/system/companyGit/model/index.ts
Normal file
41
api/system/companyGit/model/index.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 代码仓库
|
||||
*/
|
||||
export interface CompanyGit {
|
||||
// 自增ID
|
||||
id?: number;
|
||||
// 仓库名称
|
||||
title?: string;
|
||||
// 厂商 0私有仓库 1github 2gitee 3其他
|
||||
brand?: string;
|
||||
// 语言
|
||||
language?: string;
|
||||
// 企业ID
|
||||
companyId?: number;
|
||||
// 仓库地址
|
||||
domain?: string;
|
||||
// 账号
|
||||
account?: string;
|
||||
// 密码
|
||||
password?: string;
|
||||
// 仓库描述
|
||||
comments?: string;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 状态, 0正常, 1待确认
|
||||
status?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代码仓库搜索条件
|
||||
*/
|
||||
export interface CompanyGitParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user