Skip to content

Commit 1c29296

Browse files
authored
Merge pull request #12 from Visual-Regression-Tracker/47-comment
Add comment
2 parents e7151ff + 66bdf79 commit 1c29296

File tree

15 files changed

+456
-181
lines changed

15 files changed

+456
-181
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Migration `20200627134248-comment-added`
2+
3+
This migration has been generated by Pavel Strunkin at 6/27/2020, 1:42:48 PM.
4+
You can check out the [state of the schema](./schema.prisma) after the migration.
5+
6+
## Database Steps
7+
8+
```sql
9+
ALTER TABLE "public"."TestRun" ADD COLUMN "comment" text ;
10+
11+
ALTER TABLE "public"."TestVariation" ADD COLUMN "comment" text ;
12+
```
13+
14+
## Changes
15+
16+
```diff
17+
diff --git schema.prisma schema.prisma
18+
migration 20200526195312-approved-test-status-added..20200627134248-comment-added
19+
--- datamodel.dml
20+
+++ datamodel.dml
21+
@@ -3,9 +3,9 @@
22+
}
23+
datasource db {
24+
provider = "postgresql"
25+
- url = "***"
26+
+ url = env("DATABASE_URL")
27+
}
28+
model Build {
29+
id String @default(uuid()) @id
30+
@@ -51,9 +51,9 @@
31+
os String?
32+
viewport String?
33+
baselineName String?
34+
ignoreAreas String @default("[]")
35+
- // Baseline
36+
+ comment String?
37+
baseline Baseline?
38+
}
39+
model TestVariation {
40+
@@ -68,8 +68,9 @@
41+
projectId String
42+
project Project @relation(fields: [projectId], references: [id])
43+
testRuns TestRun[]
44+
baselines Baseline[]
45+
+ comment String?
46+
updatedAt DateTime @updatedAt
47+
createdAt DateTime @default(now())
48+
}
49+
@@ -102,5 +103,5 @@
50+
new
51+
ok
52+
unresolved
53+
approved
54+
-}
55+
+}
56+
```
57+
58+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
}
4+
5+
datasource db {
6+
provider = "postgresql"
7+
url = "***"
8+
}
9+
10+
model Build {
11+
id String @default(uuid()) @id
12+
number Int?
13+
branchName String?
14+
status String?
15+
testRuns TestRun[]
16+
projectId String
17+
project Project @relation(fields: [projectId], references: [id])
18+
updatedAt DateTime @updatedAt
19+
createdAt DateTime @default(now())
20+
user User? @relation(fields: [userId], references: [id])
21+
userId String?
22+
}
23+
24+
model Project {
25+
id String @default(uuid()) @id
26+
name String
27+
builds Build[]
28+
testVariations TestVariation[]
29+
updatedAt DateTime @updatedAt
30+
createdAt DateTime @default(now())
31+
}
32+
33+
model TestRun {
34+
id String @default(uuid()) @id
35+
imageName String
36+
diffName String?
37+
diffPercent Float?
38+
diffTollerancePercent Float @default(1.0)
39+
pixelMisMatchCount Int?
40+
status TestStatus
41+
buildId String
42+
build Build @relation(fields: [buildId], references: [id])
43+
testVariationId String
44+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
45+
updatedAt DateTime @updatedAt
46+
createdAt DateTime @default(now())
47+
// Test variation data
48+
name String @default("")
49+
browser String?
50+
device String?
51+
os String?
52+
viewport String?
53+
baselineName String?
54+
ignoreAreas String @default("[]")
55+
comment String?
56+
baseline Baseline?
57+
}
58+
59+
model TestVariation {
60+
id String @default(uuid()) @id
61+
name String
62+
browser String?
63+
device String?
64+
os String?
65+
viewport String?
66+
baselineName String?
67+
ignoreAreas String @default("[]")
68+
projectId String
69+
project Project @relation(fields: [projectId], references: [id])
70+
testRuns TestRun[]
71+
baselines Baseline[]
72+
comment String?
73+
updatedAt DateTime @updatedAt
74+
createdAt DateTime @default(now())
75+
}
76+
77+
model Baseline {
78+
id String @default(uuid()) @id
79+
baselineName String
80+
testVariationId String
81+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
82+
testRunId String?
83+
testRun TestRun? @relation(fields: [testRunId], references: [id])
84+
updatedAt DateTime @updatedAt
85+
createdAt DateTime @default(now())
86+
}
87+
88+
model User {
89+
id String @default(uuid()) @id
90+
email String @unique
91+
password String
92+
firstName String?
93+
lastName String?
94+
apiKey String @unique
95+
isActive Boolean @default(true)
96+
builds Build[]
97+
updatedAt DateTime @updatedAt
98+
createdAt DateTime @default(now())
99+
}
100+
101+
enum TestStatus {
102+
failed
103+
new
104+
ok
105+
unresolved
106+
approved
107+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "0.3.14-fixed",
3+
"steps": [
4+
{
5+
"tag": "CreateField",
6+
"model": "TestRun",
7+
"field": "comment",
8+
"type": "String",
9+
"arity": "Optional"
10+
},
11+
{
12+
"tag": "CreateField",
13+
"model": "TestVariation",
14+
"field": "comment",
15+
"type": "String",
16+
"arity": "Optional"
17+
}
18+
]
19+
}

prisma/migrations/migrate.lock

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# IF THERE'S A GIT CONFLICT IN THIS FILE, DON'T SOLVE IT MANUALLY!
2-
# INSTEAD EXECUTE `prisma migrate fix`
31
# Prisma Migrate lockfile v1
4-
# Read more about conflict resolution here: TODO
52

63
20200503001556-init
74
20200524162125-baseline-history
8-
20200526195312-approved-test-status-added
5+
20200526195312-approved-test-status-added
6+
20200627134248-comment-added

prisma/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vrt-migration",
3-
"version": "1.1.3",
3+
"version": "1.2.0",
44
"description": "",
55
"author": "",
66
"private": true,

prisma/schema.prisma

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ model TestRun {
5252
viewport String?
5353
baselineName String?
5454
ignoreAreas String @default("[]")
55-
// Baseline
55+
comment String?
5656
baseline Baseline?
5757
}
5858

@@ -69,6 +69,7 @@ model TestVariation {
6969
project Project @relation(fields: [projectId], references: [id])
7070
testRuns TestRun[]
7171
baselines Baseline[]
72+
comment String?
7273
updatedAt DateTime @updatedAt
7374
createdAt DateTime @default(now())
7475
}
@@ -103,4 +104,4 @@ enum TestStatus {
103104
ok
104105
unresolved
105106
approved
106-
}
107+
}

src/builds/builds.service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ describe('BuildsService', () => {
8484
viewport: '1800x1600',
8585
baselineName: null,
8686
ignoreAreas: '[]',
87+
comment: 'some comment',
8788
},
8889
],
8990
};

src/builds/dto/build.dto.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ describe('BuildDto', () => {
5353
});
5454

5555
it('passed', () => {
56-
const build = {
56+
const build: Build & {
57+
testRuns: TestRun[];
58+
} = {
5759
id: 'a9385fc1-884d-4f9f-915e-40da0e7773d5',
5860
number: null,
5961
branchName: 'develop',
@@ -82,6 +84,7 @@ describe('BuildDto', () => {
8284
viewport: '1800x1600',
8385
baselineName: null,
8486
ignoreAreas: '[]',
87+
comment: 'some comment1',
8588
},
8689
{
8790
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -102,6 +105,7 @@ describe('BuildDto', () => {
102105
viewport: '1800x1600',
103106
baselineName: null,
104107
ignoreAreas: '[]',
108+
comment: 'some comment2',
105109
},
106110
],
107111
};
@@ -154,6 +158,7 @@ describe('BuildDto', () => {
154158
viewport: '1800x1600',
155159
baselineName: null,
156160
ignoreAreas: '[]',
161+
comment: 'some comment',
157162
},
158163
{
159164
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -174,6 +179,7 @@ describe('BuildDto', () => {
174179
viewport: '1800x1600',
175180
baselineName: null,
176181
ignoreAreas: '[]',
182+
comment: 'some comment1',
177183
},
178184
{
179185
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -194,6 +200,7 @@ describe('BuildDto', () => {
194200
viewport: '1800x1600',
195201
baselineName: null,
196202
ignoreAreas: '[]',
203+
comment: 'some comment2',
197204
},
198205
],
199206
};
@@ -246,6 +253,7 @@ describe('BuildDto', () => {
246253
viewport: '1800x1600',
247254
baselineName: null,
248255
ignoreAreas: '[]',
256+
comment: 'some comment1',
249257
},
250258
{
251259
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -266,6 +274,7 @@ describe('BuildDto', () => {
266274
viewport: '1800x1600',
267275
baselineName: null,
268276
ignoreAreas: '[]',
277+
comment: 'some comment2',
269278
},
270279
{
271280
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -286,6 +295,7 @@ describe('BuildDto', () => {
286295
viewport: '1800x1600',
287296
baselineName: null,
288297
ignoreAreas: '[]',
298+
comment: null,
289299
},
290300
{
291301
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -306,6 +316,7 @@ describe('BuildDto', () => {
306316
viewport: '1800x1600',
307317
baselineName: null,
308318
ignoreAreas: '[]',
319+
comment: 'some comment',
309320
},
310321
{
311322
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
@@ -326,6 +337,7 @@ describe('BuildDto', () => {
326337
viewport: '1800x1600',
327338
baselineName: null,
328339
ignoreAreas: '[]',
340+
comment: 'some comment',
329341
},
330342
],
331343
};

src/shared/dto/comment.dto.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsString } from 'class-validator';
3+
4+
export class CommentDto {
5+
@ApiProperty()
6+
@IsString()
7+
comment: string;
8+
}

0 commit comments

Comments
 (0)