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

teableio / teable / 10056753074

23 Jul 2024 09:54AM UTC coverage: 82.459% (+64.6%) from 17.849%
10056753074

Pull #748

github

web-flow
Merge 756f11bd7 into 8d891a1e3
Pull Request #748: feat: copy and paste operations for pre-filled rows in the grid

4267 of 4468 branches covered (95.5%)

17 of 54 new or added lines in 2 files covered. (31.48%)

28421 of 34467 relevant lines covered (82.46%)

1220.35 hits per line

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

80.68
/apps/nestjs-backend/src/features/selection/selection.controller.ts
1
/* eslint-disable sonarjs/no-duplicate-string */
4✔
2
import { Body, Controller, Delete, Get, Param, Patch, Query } from '@nestjs/common';
4✔
3
import type {
4✔
4
  ICopyVo,
4✔
5
  IRangesToIdVo,
4✔
6
  IPasteVo,
4✔
7
  IDeleteVo,
4✔
8
  ITemporaryPasteVo,
4✔
9
} from '@teable/openapi';
4✔
10
import {
4✔
11
  IRangesToIdQuery,
4✔
12
  rangesToIdQuerySchema,
4✔
13
  rangesQuerySchema,
4✔
14
  IPasteRo,
4✔
15
  pasteRoSchema,
4✔
16
  rangesRoSchema,
4✔
17
  IRangesRo,
4✔
18
  temporaryPasteRoSchema,
4✔
19
  ITemporaryPasteRo,
4✔
20
} from '@teable/openapi';
4✔
21
import { ZodValidationPipe } from '../../zod.validation.pipe';
4✔
22
import { Permissions } from '../auth/decorators/permissions.decorator';
4✔
23
import { TqlPipe } from '../record/open-api/tql.pipe';
4✔
24
import { SelectionService } from './selection.service';
4✔
25

4✔
26
@Controller('api/table/:tableId/selection')
4✔
27
export class SelectionController {
4✔
28
  constructor(private selectionService: SelectionService) {}
132✔
29

132✔
30
  @Permissions('record|read')
132✔
31
  @Get('/range-to-id')
18✔
32
  async getIdsFromRanges(
18✔
33
    @Param('tableId') tableId: string,
18✔
34
    @Query(new ZodValidationPipe(rangesToIdQuerySchema), TqlPipe) query: IRangesToIdQuery
18✔
35
  ): Promise<IRangesToIdVo> {
18✔
36
    return this.selectionService.getIdsFromRanges(tableId, query);
18✔
37
  }
18✔
38

132✔
39
  @Permissions('record|read')
132✔
40
  @Get('/copy')
2✔
41
  async copy(
2✔
42
    @Param('tableId') tableId: string,
2✔
43
    @Query(new ZodValidationPipe(rangesQuerySchema), TqlPipe) query: IRangesRo
2✔
44
  ): Promise<ICopyVo> {
2✔
45
    return this.selectionService.copy(tableId, query);
2✔
46
  }
2✔
47

132✔
48
  @Permissions('record|update')
132✔
49
  @Patch('/paste')
6✔
50
  async paste(
6✔
51
    @Param('tableId') tableId: string,
6✔
52
    @Body(new ZodValidationPipe(pasteRoSchema), TqlPipe)
6✔
53
    pasteRo: IPasteRo
6✔
54
  ): Promise<IPasteVo> {
6✔
55
    const ranges = await this.selectionService.paste(tableId, pasteRo);
6✔
56
    return { ranges };
6✔
57
  }
6✔
58

132✔
59
  @Permissions('record|read')
132✔
NEW
60
  @Patch('/temporaryPaste')
×
NEW
61
  async temporaryPaste(
×
NEW
62
    @Param('tableId') tableId: string,
×
NEW
63
    @Body(new ZodValidationPipe(temporaryPasteRoSchema), TqlPipe)
×
NEW
64
    temporaryPasteRo: ITemporaryPasteRo
×
NEW
65
  ): Promise<ITemporaryPasteVo> {
×
NEW
66
    return await this.selectionService.temporaryPaste(tableId, temporaryPasteRo);
×
NEW
67
  }
×
68

132✔
69
  @Permissions('record|update')
132✔
70
  @Patch('/clear')
×
71
  async clear(
×
72
    @Param('tableId') tableId: string,
×
73
    @Body(new ZodValidationPipe(rangesRoSchema), TqlPipe)
×
74
    rangesRo: IRangesRo
×
75
  ) {
×
76
    await this.selectionService.clear(tableId, rangesRo);
×
77
    return null;
×
78
  }
×
79

132✔
80
  @Permissions('record|delete')
132✔
81
  @Delete('/delete')
8✔
82
  async delete(
8✔
83
    @Param('tableId') tableId: string,
8✔
84
    @Query(new ZodValidationPipe(rangesQuerySchema), TqlPipe) rangesRo: IRangesRo
8✔
85
  ): Promise<IDeleteVo> {
8✔
86
    return this.selectionService.delete(tableId, rangesRo);
8✔
87
  }
8✔
88
}
132✔
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