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

teableio / teable / 8389034572

22 Mar 2024 10:38AM CUT coverage: 26.087% (-2.1%) from 28.208%
8389034572

Pull #487

github

web-flow
Merge 3045b1f94 into a06c6afb1
Pull Request #487: refactor: move zod schema to openapi

2100 of 3363 branches covered (62.44%)

282 of 757 new or added lines in 74 files covered. (37.25%)

224 existing lines in 8 files now uncovered.

25574 of 98035 relevant lines covered (26.09%)

5.17 hits per line

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

0.0
/packages/openapi/src/table/get-list.ts
1
import type { RouteConfig } from '@asteasolutions/zod-to-openapi';
×
NEW
2
import { IdPrefix } from '@teable/core';
×
3
import { axios } from '../axios';
×
NEW
4
import { fieldKeyTypeRoSchema } from '../record';
×
5
import { registerRoute, urlBuilder } from '../utils';
×
6
import { z } from '../zod';
×
NEW
7
import { tableListVoSchema } from './create';
×
NEW
8

×
NEW
9
export type ITableListVo = z.infer<typeof tableListVoSchema>;
×
NEW
10

×
NEW
11
export const getTableQuerySchema = z.object({
×
NEW
12
  viewId: z.string().startsWith(IdPrefix.View).optional().openapi({
×
NEW
13
    description: 'Which view to get the data from.',
×
NEW
14
  }),
×
NEW
15
  includeContent: z
×
NEW
16
    .string()
×
NEW
17
    .or(z.boolean())
×
NEW
18
    .transform(Boolean)
×
NEW
19
    .pipe(z.boolean())
×
NEW
20
    .optional()
×
NEW
21
    .openapi({
×
NEW
22
      description: 'If true return table content. including fields, views, first 50 records.',
×
NEW
23
    }),
×
NEW
24
  fieldKeyType: fieldKeyTypeRoSchema,
×
NEW
25
});
×
NEW
26

×
NEW
27
export type IGetTableQuery = z.infer<typeof getTableQuerySchema>;
×
28

×
29
export const GET_TABLE_LIST = '/base/{baseId}/table';
×
30

×
31
export const GetTableListRoute: RouteConfig = registerRoute({
×
32
  method: 'get',
×
33
  path: GET_TABLE_LIST,
×
34
  description: 'Get table list',
×
35
  request: {
×
36
    params: z.object({
×
37
      baseId: z.string(),
×
38
    }),
×
39
  },
×
40
  responses: {
×
41
    200: {
×
42
      description: 'Returns the list of table.',
×
43
      content: {
×
44
        'application/json': {
×
45
          schema: tableListVoSchema,
×
46
        },
×
47
      },
×
48
    },
×
49
  },
×
50
  tags: ['table'],
×
51
});
×
52

×
53
export const getTableList = async (baseId: string) => {
×
54
  return axios.get<ITableListVo>(urlBuilder(GET_TABLE_LIST, { baseId }));
×
55
};
×
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