• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

teableio / teable / 12881890017

21 Jan 2025 07:13AM CUT coverage: 80.91%. First build
12881890017

Pull #1263

github

web-flow
Merge 1aab39586 into 2be93a15f
Pull Request #1263: feat: webhooks

6485 of 6849 branches covered (94.69%)

58 of 370 new or added lines in 7 files covered. (15.68%)

30774 of 38035 relevant lines covered (80.91%)

1827.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.58
/apps/nestjs-backend/src/features/webhook/webhook.controller.ts
1
/* eslint-disable sonarjs/no-duplicate-string */
2✔
2
import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common';
3
import type {
4
  IWebhookListVo,
5
  IWebhookRunHistoriesVo,
6
  IWebhookRunHistoryVo,
7
  IWebhookVo,
8
} from '@teable/openapi';
9
import {
10
  createWebhookRoSchema,
11
  getWebhookRunHistoryListQuerySchema,
12
  ICreateWebhookRo,
13
  IGetWebhookRunHistoryListQuery,
14
  IUpdateWebhookRo,
15
  updateWebhookRoSchema,
16
} from '@teable/openapi';
17
import { ZodValidationPipe } from '../../zod.validation.pipe';
18
import { Permissions } from '../auth/decorators/permissions.decorator';
19
import { WebhookService } from './webhook.service';
20

21
@Controller('api/:spaceId/webhook')
22
export class WebhookController {
2✔
23
  constructor(private readonly webhookService: WebhookService) {}
101✔
24

25
  @Get()
101✔
26
  @Permissions('space|create')
NEW
27
  async getWebhookList(@Param('spaceId') spaceId: string): Promise<IWebhookListVo> {
×
NEW
28
    return await this.webhookService.getWebhookList(spaceId);
×
NEW
29
  }
×
30

31
  @Get(':webhookId')
101✔
NEW
32
  async getWebhookById(@Param('webhookId') webhookId: string): Promise<IWebhookVo> {
×
NEW
33
    return await this.webhookService.getWebhookById(webhookId);
×
NEW
34
  }
×
35

36
  @Post()
101✔
NEW
37
  async createWebhook(
×
NEW
38
    @Body(new ZodValidationPipe(createWebhookRoSchema)) body: ICreateWebhookRo
×
NEW
39
  ): Promise<IWebhookVo> {
×
NEW
40
    return await this.webhookService.createWebhook(body);
×
NEW
41
  }
×
42

43
  @Delete(':webhookId')
101✔
NEW
44
  async deleteWebhook(@Param('webhookId') webhookId: string) {
×
NEW
45
    return await this.webhookService.deleteWebhook(webhookId);
×
NEW
46
  }
×
47

48
  @Put(':webhookId')
101✔
NEW
49
  async updateWebhook(
×
NEW
50
    @Param('webhookId') webhookId: string,
×
NEW
51
    @Body(new ZodValidationPipe(updateWebhookRoSchema)) body: IUpdateWebhookRo
×
NEW
52
  ): Promise<IWebhookVo> {
×
NEW
53
    return await this.webhookService.updateWebhook(webhookId, body);
×
NEW
54
  }
×
55

56
  @Get(':webhookId/run-history')
101✔
NEW
57
  async getWebhookRunHistoryList(
×
NEW
58
    @Param('webhookId') webhookId: string,
×
NEW
59
    @Query(new ZodValidationPipe(getWebhookRunHistoryListQuerySchema))
×
NEW
60
    query: IGetWebhookRunHistoryListQuery
×
NEW
61
  ): Promise<IWebhookRunHistoriesVo> {
×
NEW
62
    return await this.webhookService.getWebhookRunHistoryList(webhookId, query);
×
NEW
63
  }
×
64

65
  @Get('/run-history/:runHistoryId')
101✔
NEW
66
  async getWebhookRunHistoryById(
×
NEW
67
    @Param('runHistoryId') runHistoryId: string
×
NEW
68
  ): Promise<IWebhookRunHistoryVo> {
×
NEW
69
    return await this.webhookService.getWebhookRunHistoryById(runHistoryId);
×
NEW
70
  }
×
71
}
101✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc