@@ -33,39 +33,23 @@ module.exports = () => ({
33
33
params : { pipelineId }
34
34
} ;
35
35
36
- // Set groupEventId if provided
37
- if ( request . query . groupEventId ) {
38
- config . params . groupEventId = request . query . groupEventId ;
39
- }
40
- // Get specific stages if eventId is provided
41
- else if ( request . query . eventId ) {
42
- const events = await eventFactory . list ( { params : { id : request . query . eventId } } ) ;
43
-
44
- if ( ! events || Object . keys ( events ) . length === 0 ) {
45
- throw boom . notFound ( `Event ${ request . query . eventId } does not exist` ) ;
36
+ // Get latest stages
37
+ const latestCommitEvents = await eventFactory . list ( {
38
+ params : {
39
+ pipelineId,
40
+ parentEventId : null ,
41
+ type : 'pipeline'
42
+ } ,
43
+ paginate : {
44
+ count : 1
46
45
}
46
+ } ) ;
47
47
48
- config . params . groupEventId = events [ 0 ] . groupEventId ;
48
+ if ( ! latestCommitEvents || Object . keys ( latestCommitEvents ) . length === 0 ) {
49
+ throw boom . notFound ( `Latest event does not exist for pipeline ${ pipelineId } ` ) ;
49
50
}
50
- // Get latest stages if eventId not provided
51
- else {
52
- const latestCommitEvents = await eventFactory . list ( {
53
- params : {
54
- pipelineId,
55
- parentEventId : null ,
56
- type : 'pipeline'
57
- } ,
58
- paginate : {
59
- count : 1
60
- }
61
- } ) ;
62
51
63
- if ( ! latestCommitEvents || Object . keys ( latestCommitEvents ) . length === 0 ) {
64
- throw boom . notFound ( `Latest event does not exist for pipeline ${ pipelineId } ` ) ;
65
- }
66
-
67
- config . params . groupEventId = latestCommitEvents [ 0 ] . groupEventId ;
68
- }
52
+ config . params . eventId = latestCommitEvents [ 0 ] . id ;
69
53
70
54
return stageFactory . list ( config ) ;
71
55
} )
@@ -83,8 +67,6 @@ module.exports = () => ({
83
67
} ) ,
84
68
query : schema . api . pagination . concat (
85
69
joi . object ( {
86
- eventId : pipelineIdSchema ,
87
- groupEventId : pipelineIdSchema ,
88
70
search : joi . forbidden ( ) // we don't support search for Pipeline list stages
89
71
} )
90
72
)
0 commit comments