Skip to content

Commit fc78075

Browse files
authored
Merge pull request #7 from Visual-Regression-Tracker/23-build-stats
test runs added to build payload
2 parents 9347227 + 3e3e721 commit fc78075

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/builds/builds.service.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { TestRunsService } from '../test-runs/test-runs.service';
66

77
@Injectable()
88
export class BuildsService {
9-
constructor(
10-
private prismaService: PrismaService,
11-
private testRunsService: TestRunsService
12-
) { }
9+
constructor(private prismaService: PrismaService, private testRunsService: TestRunsService) {}
1310

1411
async findMany(projectId: string): Promise<Build[]> {
1512
return this.prismaService.build.findMany({
1613
where: { projectId },
17-
orderBy: { createdAt: 'desc' }
14+
include: {
15+
testRuns: true,
16+
},
17+
orderBy: { createdAt: 'desc' },
1818
});
1919
}
2020

@@ -35,14 +35,12 @@ export class BuildsService {
3535
const build = await this.prismaService.build.findOne({
3636
where: { id },
3737
include: {
38-
testRuns: true
39-
}
38+
testRuns: true,
39+
},
4040
});
4141

4242
try {
43-
await Promise.all(
44-
build.testRuns.map((testRun) => this.testRunsService.delete(testRun.id))
45-
);
43+
await Promise.all(build.testRuns.map(testRun => this.testRunsService.delete(testRun.id)));
4644
} catch (err) {
4745
console.log(err);
4846
}

0 commit comments

Comments
 (0)