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

teableio / teable / 8538004962

03 Apr 2024 11:36AM UTC coverage: 18.233% (-3.3%) from 21.535%
8538004962

Pull #528

github

web-flow
Merge c1a248a6f into 45ee7ebb3
Pull Request #528: feat: Kanban view

575 of 1136 branches covered (50.62%)

29 of 2908 new or added lines in 83 files covered. (1.0%)

5 existing lines in 5 files now uncovered.

6439 of 35315 relevant lines covered (18.23%)

3.94 hits per line

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

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

×
10
export const updateRecordRoSchema = z
×
11
  .object({
×
12
    fieldKeyType: fieldKeyTypeRoSchema,
×
13
    typecast: typecastSchema,
×
14
    record: z.object({
×
15
      fields: recordSchema.shape.fields,
×
16
    }),
×
NEW
17
    order: recordInsertOrderRoSchema.optional(),
×
18
  })
×
19
  .openapi({
×
20
    description: 'Update record by id',
×
21
  });
×
22

×
23
export type IUpdateRecordRo = z.infer<typeof updateRecordRoSchema>;
×
24

×
25
export const updateRecordsRoSchema = z
×
26
  .object({
×
27
    fieldKeyType: fieldKeyTypeRoSchema,
×
28
    typecast: typecastSchema,
×
29
    records: z.array(
×
30
      z.object({
×
31
        id: z.string(),
×
32
        fields: recordSchema.shape.fields,
×
33
      })
×
34
    ),
×
NEW
35
    order: recordInsertOrderRoSchema.optional(),
×
36
  })
×
37
  .openapi({
×
38
    description: 'Multiple Update records',
×
39
  });
×
40

×
41
export type IUpdateRecordsRo = z.infer<typeof updateRecordsRoSchema>;
×
42

×
43
export const UPDATE_RECORD = '/table/{tableId}/record/{recordId}';
×
44

×
45
export const UpdateRecordRoute: RouteConfig = registerRoute({
×
46
  method: 'patch',
×
47
  path: UPDATE_RECORD,
×
48
  description: 'Update a record',
×
49
  request: {
×
50
    params: z.object({
×
51
      tableId: z.string(),
×
52
      recordId: z.string(),
×
53
    }),
×
54
    body: {
×
55
      content: {
×
56
        'application/json': {
×
57
          schema: updateRecordRoSchema,
×
58
        },
×
59
      },
×
60
    },
×
61
  },
×
62
  responses: {
×
63
    200: {
×
64
      description: 'Returns record data after update.',
×
65
      content: {
×
66
        'application/json': {
×
67
          schema: recordSchema,
×
68
        },
×
69
      },
×
70
    },
×
71
  },
×
72
  tags: ['record'],
×
73
});
×
74

×
75
export const updateRecord = async (
×
76
  tableId: string,
×
77
  recordId: string,
×
78
  recordRo: IUpdateRecordRo
×
79
) => {
×
80
  return axios.patch<IRecord>(
×
81
    urlBuilder(UPDATE_RECORD, {
×
82
      tableId,
×
83
      recordId,
×
84
    }),
×
85
    recordRo
×
86
  );
×
87
};
×
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