7
7
} from "~/components/runs/RunStatuses" ;
8
8
import { PrismaClient , prisma } from "~/db.server" ;
9
9
import { getUsername } from "~/utils/username" ;
10
+ import { BasePresenter } from "./v3/basePresenter.server" ;
10
11
11
12
type RunListOptions = {
12
13
userId : string ;
@@ -27,12 +28,8 @@ const DEFAULT_PAGE_SIZE = 20;
27
28
28
29
export type RunList = Awaited < ReturnType < RunListPresenter [ "call" ] > > ;
29
30
30
- export class RunListPresenter {
31
- #prismaClient: PrismaClient ;
32
-
33
- constructor ( prismaClient : PrismaClient = prisma ) {
34
- this . #prismaClient = prismaClient ;
35
- }
31
+ export class RunListPresenter extends BasePresenter {
32
+
36
33
37
34
public async call ( {
38
35
userId,
@@ -53,7 +50,7 @@ export class RunListPresenter {
53
50
const directionMultiplier = direction === "forward" ? 1 : - 1 ;
54
51
55
52
// Find the organization that the user is a member of
56
- const organization = await this . #prismaClient . organization . findFirstOrThrow ( {
53
+ const organization = await this . _replica . organization . findFirstOrThrow ( {
57
54
select : {
58
55
id : true ,
59
56
} ,
@@ -64,7 +61,7 @@ export class RunListPresenter {
64
61
} ) ;
65
62
66
63
// Find the project scoped to the organization
67
- const project = await this . #prismaClient . project . findFirstOrThrow ( {
64
+ const project = await this . _replica . project . findFirstOrThrow ( {
68
65
select : {
69
66
id : true ,
70
67
} ,
@@ -75,7 +72,7 @@ export class RunListPresenter {
75
72
} ) ;
76
73
77
74
const job = jobSlug
78
- ? await this . #prismaClient . job . findFirstOrThrow ( {
75
+ ? await this . _replica . job . findFirstOrThrow ( {
79
76
where : {
80
77
slug : jobSlug ,
81
78
projectId : project . id ,
@@ -84,10 +81,10 @@ export class RunListPresenter {
84
81
: undefined ;
85
82
86
83
const event = eventId
87
- ? await this . #prismaClient . eventRecord . findUnique ( { where : { id : eventId } } )
84
+ ? await this . _replica . eventRecord . findUnique ( { where : { id : eventId } } )
88
85
: undefined ;
89
86
90
- const runs = await this . #prismaClient . jobRun . findMany ( {
87
+ const runs = await this . _replica . jobRun . findMany ( {
91
88
select : {
92
89
id : true ,
93
90
number : true ,
0 commit comments