Skip to content

Commit

Permalink
feat: update schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Jul 25, 2024
1 parent 7557384 commit f48fd2c
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 25 deletions.
67 changes: 42 additions & 25 deletions packages/canyon-backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ model User {
favor String
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
@@map("user")
@@map("reactor_user")
}

model Git {
Expand All @@ -32,6 +32,8 @@ model Git {
providerAccessToken String
providerScope String
loggedIn DateTime @default(now()) @db.Timestamp(3)
@@map("reactor_git")
}

model GitProvider {
Expand All @@ -42,29 +44,40 @@ model GitProvider {
type String
name String
disabled Boolean
@@map("reactor_git_provider")
}

model Coverage {
id String @id @default(cuid())
key String // 防止重复插入
sha String @map("sha")
branch String
compareTarget String @map("compare_target")
provider String
buildProvider String @map("build_provider") // 通过侦测CI环境变量来判断
buildID String @map("build_id")
projectID String @map("project_id")
instrumentCwd String @map("instrument_cwd")
reporter String
reportID String @map("report_id") // 未来聚合的一句,区分case
covType String @map("cov_type") // 普通类型,默认normal
relationID Json @map("relation_id") // 关联ID,八位,{'0':'xxx','1':'xxx}
summary Json
tag Json // 存点额外的信息
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamp(3)
@@map("coverage")
id String @id @default(cuid())
key String // 防止重复插入
sha String @map("sha")
branch String
compareTarget String @map("compare_target")
provider String
buildProvider String @map("build_provider") // 通过侦测CI环境变量来判断
buildID String @map("build_id")
projectID String @map("project_id")
reporter String
reportID String @map("report_id") // 未来聚合的一句,区分case
covType String @map("cov_type") // 普通类型,all、method、agg
method String // UI自动化 auto,手动 manual,ut 单元测试
// 代码覆盖率
branchesTotal Int @map("branches_total")
branchesCovered Int @map("branches_covered")
functionsTotal Int @map("functions_total")
functionsCovered Int @map("functions_covered")
linesTotal Int @map("lines_total")
linesCovered Int @map("lines_covered")
statementsTotal Int @map("statements_total")
statementsCovered Int @map("statements_covered")
newlinesTotal Int @map("newlines_total")
newlinesCovered Int @map("newlines_covered")
// 通用
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamp(3)
@@map("reactor_coverage")
}

model CovMapTest {
Expand All @@ -74,11 +87,15 @@ model CovMapTest {
projectID String @map("project_id")
sha String
path String
@@map("reactor_cov_map_test")
}

model CovHit {
id String @id
mapJsonStr String @map("map_json_str")
@@map("reactor_cov_hit")
}

model Project {
Expand All @@ -95,7 +112,7 @@ model Project {
instrumentCwd String @map("instrument_cwd")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
@@map("project")
@@map("reactor_project")
}

model Codechange {
Expand All @@ -114,7 +131,7 @@ model Codechange {
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
@@map("codechange")
@@map("reactor_codechange")
}

model Filepath {
Expand All @@ -123,7 +140,7 @@ model Filepath {
sha String @map("sha")
path String
@@map("filepath")
@@map("reactor_filepath")
}

model Distributedlock {
Expand All @@ -132,5 +149,5 @@ model Distributedlock {
lockTimestamp DateTime?
lockExpiration DateTime?
@@map("distributedlock")
@@map("reactor_distributedlock")
}
132 changes: 132 additions & 0 deletions packages/canyon-platform/src/pages/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import EChartsReact from 'echarts-for-react';
const data = {
Month: ['1月', '2月', '3月', '4月', '5月', '6月'],
'Branch Coverage (%)': [50.59, 51.45, 50.05, 55.15, 57.84, 62.84],
'Branches Covered': [7989.63, 10342.33, 9282.85, 10135.42, 10833.31, 11423.75, 9865.54],
'Total Branches': [15793.13, 20100.67, 18545.65, 18379.0, 18730.27, 18179.46, 15800.5],
'Line Coverage (%)': [66.08, 67.18, 64.81, 68.7, 71.82, 76.37, 74.99],
'Lines Covered': [12419.25, 15639.6, 13336.25, 13874.58, 14477.35, 15446.29, 12824.38],
'Total Lines': [18793.88, 23281.6, 20575.95, 20197.21, 20159.0, 20224.75, 17101.77],
'Changed Line Coverage (%)': [null, 93.76, 93.95, 95.49, 95.1, 96.13],
'Changed Lines Covered': [7.38, 1073.27, 1162.4, 1460.53, 582.08, 224.88, 526.96],
'Changed Lines': [7.38, 1144.67, 1237.3, 1529.58, 612.08, 233.92, 558.38],
};
const d1 = [58.93, 59.07, 58.86, 58.93, 58.73, 59.04];
const d2 = [40.94, 42.18, 41.71, 42.13, 42.69, 44.37];
const data1 = {
Month: ['1月', '2月', '3月', '4月', '5月', '6月'],
'Branch Coverage (%)': d1,
'Branches Covered': [7989.63, 10342.33, 9282.85, 10135.42, 10833.31, 11423.75, 9865.54],
'Total Branches': [15793.13, 20100.67, 18545.65, 18379.0, 18730.27, 18179.46, 15800.5],
'Line Coverage (%)': d2,
'Lines Covered': [12419.25, 15639.6, 13336.25, 13874.58, 14477.35, 15446.29, 12824.38],
'Total Lines': [18793.88, 23281.6, 20575.95, 20197.21, 20159.0, 20224.75, 17101.77],
'Changed Line Coverage (%)': [null, 93.76, 93.95, 95.49, 95.1, 96.13],
'Changed Lines Covered': [7.38, 1073.27, 1162.4, 1460.53, 582.08, 224.88, 526.96],
'Changed Lines': [7.38, 1144.67, 1237.3, 1529.58, 612.08, 233.92, 558.38],
};

const option = {
title: {
text: 'UI自动化覆盖率',
},
tooltip: {
trigger: 'axis',
},
legend: {
data: ['Branch Coverage (%)', 'Line Coverage (%)', 'Changed Line Coverage (%)'],
right: 10,
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
toolbox: {
feature: {
saveAsImage: {},
},
},
xAxis: {
type: 'category',
boundaryGap: false,
data: data.Month,
},
yAxis: {
type: 'value',
max: 100,
},
series: [
{
name: 'Branch Coverage (%)',
type: 'line',
data: data['Branch Coverage (%)'],
},
{
name: 'Line Coverage (%)',
type: 'line',
data: data['Line Coverage (%)'],
},
{
name: 'Changed Line Coverage (%)',
type: 'line',
data: data['Changed Line Coverage (%)'],
},
],
};

const option1 = {
title: {
text: 'UT覆盖率',
},
tooltip: {
trigger: 'axis',
},
legend: {
data: ['Branch Coverage (%)', 'Line Coverage (%)', 'Changed Line Coverage (%)'],
right: 10,
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
toolbox: {
feature: {
saveAsImage: {},
},
},
xAxis: {
type: 'category',
boundaryGap: false,
data: data.Month,
},
yAxis: {
type: 'value',
max: 100,
},
series: [
{
name: 'Branch Coverage (%)',
type: 'line',
data: data1['Branch Coverage (%)'],
},
{
name: 'Line Coverage (%)',
type: 'line',
data: data1['Line Coverage (%)'],
},
],
};
const Test = () => {
return (
<div>
<EChartsReact className={'w-[700px]'} style={{ height: '300px' }} option={option} />
<EChartsReact className={'w-[700px]'} style={{ height: '300px' }} option={option1} />
</div>
);
};

export default Test;

0 comments on commit f48fd2c

Please sign in to comment.