• 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/share/view-form-submit.ts
1
import type { RouteConfig } from '@asteasolutions/zod-to-openapi';
×
NEW
2
import { recordSchema, type IRecord } from '@teable/core';
×
3
import { axios } from '../axios';
×
4
import { registerRoute, urlBuilder } from '../utils';
×
5
import { z } from '../zod';
×
6

×
7
export const SHARE_VIEW_FORM_SUBMIT = '/share/{shareId}/view/form-submit';
×
8

×
9
export const shareViewFormSubmitRoSchema = z.object({
×
10
  fields: recordSchema.shape.fields,
×
11
});
×
12

×
13
export type ShareViewFormSubmitRo = z.infer<typeof shareViewFormSubmitRoSchema>;
×
14

×
15
export const ShareViewFormSubmitRouter: RouteConfig = registerRoute({
×
16
  method: 'post',
×
17
  path: SHARE_VIEW_FORM_SUBMIT,
×
18
  description: 'share form view submit new record',
×
19
  request: {
×
20
    params: z.object({
×
21
      shareId: z.string(),
×
22
    }),
×
23
    body: {
×
24
      content: {
×
25
        'application/json': {
×
26
          schema: shareViewFormSubmitRoSchema,
×
27
        },
×
28
      },
×
29
    },
×
30
  },
×
31
  responses: {
×
32
    201: {
×
33
      description: 'Successfully submit',
×
34
      content: {
×
35
        'application/json': {
×
36
          schema: recordSchema,
×
37
        },
×
38
      },
×
39
    },
×
40
  },
×
41
  tags: ['share'],
×
42
});
×
43

×
44
export const shareViewFormSubmit = (params: {
×
45
  shareId: string;
×
46
  fields: Record<string, unknown>;
×
47
}) => {
×
48
  const { shareId, fields } = params;
×
49
  return axios.post<IRecord>(urlBuilder(SHARE_VIEW_FORM_SUBMIT, { shareId }), {
×
50
    fields,
×
51
  });
×
52
};
×
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