screwdriver-api 8.0.152 → 8.0.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.152",
3
+ "version": "8.0.154",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,28 +20,15 @@ module.exports = () => ({
20
20
 
21
21
  handler: async (request, h) => {
22
22
  const { eventFactory } = request.server.app;
23
+ const event = await eventFactory.getLatestCommitEvent({
24
+ pipelineId: request.params.id
25
+ });
23
26
 
24
- return eventFactory
25
- .list({
26
- params: {
27
- pipelineId: request.params.id,
28
- parentEventId: null,
29
- type: 'pipeline'
30
- },
31
- paginate: {
32
- count: 1
33
- }
34
- })
35
- .then(async events => {
36
- if (!events || Object.keys(events).length === 0) {
37
- throw boom.notFound('Event does not exist');
38
- }
27
+ if (!event) {
28
+ throw boom.notFound('Event does not exist');
29
+ }
39
30
 
40
- return h.response(await events[0].toJson());
41
- })
42
- .catch(err => {
43
- throw err;
44
- });
31
+ return h.response(await event.toJson());
45
32
  },
46
33
  response: {
47
34
  schema: getSchema