|
1 | 1 | import { Type, Static } from "@sinclair/typebox"; |
2 | 2 | import { Role } from "./Role"; |
3 | 3 |
|
4 | | -export const UserInput = Type.Object({ |
5 | | - id: Type.Optional(Type.Number()), |
6 | | - createdAt: Type.Optional(Type.String()), |
7 | | - email: Type.String(), |
8 | | - weight: Type.Optional(Type.Number()), |
9 | | - is18: Type.Optional(Type.Boolean()), |
10 | | - name: Type.Optional(Type.String()), |
11 | | - successorId: Type.Optional(Type.Number()), |
12 | | - role: Type.Optional(Role), |
13 | | - posts: Type.Array( |
14 | | - Type.Object({ |
15 | | - id: Type.Optional(Type.Number()), |
16 | | - userId: Type.Optional(Type.Number()), |
17 | | - }) |
18 | | - ), |
19 | | - keywords: Type.Array(Type.String()), |
20 | | - biography: Type.String(), |
21 | | - decimal: Type.Number(), |
22 | | - biginteger: Type.Integer(), |
23 | | -}); |
| 4 | +export const UserInput = Type.Object( |
| 5 | + { |
| 6 | + id: Type.Optional(Type.Number()), |
| 7 | + createdAt: Type.Optional(Type.String()), |
| 8 | + email: Type.String(), |
| 9 | + weight: Type.Optional(Type.Number()), |
| 10 | + is18: Type.Optional(Type.Boolean()), |
| 11 | + name: Type.Optional(Type.String()), |
| 12 | + successorId: Type.Optional(Type.Number()), |
| 13 | + role: Type.Optional(Role), |
| 14 | + posts: Type.Array( |
| 15 | + Type.Object({ |
| 16 | + id: Type.Optional(Type.Number()), |
| 17 | + userId: Type.Optional(Type.Number()), |
| 18 | + }) |
| 19 | + ), |
| 20 | + keywords: Type.Array(Type.String({ minLength: 3 }), { maxItems: 10 }), |
| 21 | + biography: Type.String({ description: "field description" }), |
| 22 | + decimal: Type.Number({ description: "used description" }), |
| 23 | + biginteger: Type.Integer({ description: "multiline\ndescription" }), |
| 24 | + unsigned: Type.Integer({ minimum: 0 }), |
| 25 | + }, |
| 26 | + { description: "model description" } |
| 27 | +); |
24 | 28 |
|
25 | 29 | export type UserInputType = Static<typeof UserInput>; |
0 commit comments