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

teableio / teable / 8431881381

26 Mar 2024 06:40AM CUT coverage: 26.103% (-0.003%) from 26.106%
8431881381

Pull #499

github

web-flow
Merge fa084b5b9 into 98543ea09
Pull Request #499: fix: create access token expiration date format

2106 of 3372 branches covered (62.46%)

0 of 13 new or added lines in 2 files covered. (0.0%)

25600 of 98072 relevant lines covered (26.1%)

5.17 hits per line

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

0.0
/packages/openapi/src/access-token/create.ts
1
import { axios } from '../axios';
×
2
import { registerRoute } from '../utils';
×
3
import { z } from '../zod';
×
4

×
5
export const CREATE_ACCESS_TOKEN = '/access-token';
×
6

×
NEW
7
const isValidDateString = (dateString: string) => {
×
NEW
8
  const date = new Date(dateString);
×
NEW
9
  return !isNaN(date.getTime());
×
NEW
10
};
×
NEW
11

×
12
export const createAccessTokenRoSchema = z.object({
×
13
  name: z.string().min(1),
×
14
  description: z.string().optional(),
×
15
  scopes: z.array(z.string()).min(1),
×
16
  spaceIds: z.array(z.string()).min(1).nullable().optional(),
×
17
  baseIds: z.array(z.string()).min(1).nullable().optional(),
×
NEW
18
  expiredTime: z
×
NEW
19
    .string()
×
NEW
20
    .refine(isValidDateString, {
×
NEW
21
      message: 'expiredTime: Invalid Date ',
×
NEW
22
    })
×
NEW
23
    .openapi({ example: '2024-03-25' }),
×
24
});
×
25

×
26
export type CreateAccessTokenRo = z.infer<typeof createAccessTokenRoSchema>;
×
27

×
28
export const createAccessTokenVoSchema = z.object({
×
29
  id: z.string(),
×
30
  name: z.string().min(1),
×
31
  description: z.string().optional(),
×
32
  scopes: z.array(z.string()),
×
33
  spaceIds: z.array(z.string()).nullable().optional(),
×
34
  baseIds: z.array(z.string()).nullable().optional(),
×
35
  expiredTime: z.string(),
×
36
  token: z.string(),
×
37
  createdTime: z.string(),
×
38
  lastUsedTime: z.string(),
×
39
});
×
40

×
41
export type CreateAccessTokenVo = z.infer<typeof createAccessTokenVoSchema>;
×
42

×
43
export const createAccessRoute = registerRoute({
×
44
  method: 'post',
×
45
  path: CREATE_ACCESS_TOKEN,
×
46
  description: 'Create access token',
×
47
  request: {
×
48
    body: {
×
49
      content: {
×
50
        'application/json': {
×
51
          schema: createAccessTokenRoSchema,
×
52
        },
×
53
      },
×
54
    },
×
55
  },
×
56
  responses: {
×
57
    201: {
×
58
      description: 'Returns access token.',
×
59
      content: {
×
60
        'application/json': {
×
61
          schema: createAccessTokenVoSchema,
×
62
        },
×
63
      },
×
64
    },
×
65
  },
×
66
  tags: ['access-token'],
×
67
});
×
68

×
69
export const createAccessToken = async (body: CreateAccessTokenRo) => {
×
70
  return axios.post<CreateAccessTokenVo>(CREATE_ACCESS_TOKEN, body);
×
71
};
×
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