@addev-be/ui 0.21.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,83 +1,47 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
2
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.deleteUserResponseDtoCodec = exports.deleteUserRequestDtoCodec = exports.saveUserResponseDtoCodec = exports.saveUserRequestDtoCodec = exports.getAllUsersResponseDtoCodec = exports.getAllUsersRequestDtoCodec = exports.getUserResponseDtoCodec = exports.getUserRequestDtoCodec = exports.userDtoCodec = void 0;
38
- var t = __importStar(require("io-ts"));
3
+ exports.deleteUserResponseDtoSchema = exports.deleteUserRequestDtoSchema = exports.saveUserResponseDtoSchema = exports.saveUserRequestDtoSchema = exports.getAllUsersResponseDtoSchema = exports.getAllUsersRequestDtoSchema = exports.getUserResponseDtoSchema = exports.getUserRequestDtoSchema = exports.userDtoSchema = void 0;
4
+ var zod_1 = require("zod");
39
5
  var base_1 = require("./base");
40
6
  var userProfiles_1 = require("./userProfiles");
41
- exports.userDtoCodec = t.intersection([
42
- t.type(__assign(__assign({}, base_1.baseModelDtoCodec.props), { username: t.string, permissions: t.array(t.string), isAdmin: t.boolean, profile: t.union([userProfiles_1.userProfileDtoCodec, t.null]) })),
43
- t.partial({
44
- name: t.string,
45
- email: t.string,
46
- lastLogin: t.union([t.string, t.null]),
47
- }),
48
- ], 'UserDTO');
7
+ exports.userDtoSchema = base_1.baseModelDtoSchema.extend({
8
+ username: zod_1.z.string(),
9
+ permissions: zod_1.z.array(zod_1.z.string()),
10
+ isAdmin: zod_1.z.boolean(),
11
+ profile: userProfiles_1.userProfileDtoSchema.nullable(),
12
+ name: zod_1.z.string().optional(),
13
+ email: zod_1.z.string().optional(),
14
+ lastLogin: zod_1.z.string().nullable().optional(),
15
+ });
49
16
  /*****/
50
- exports.getUserRequestDtoCodec = t.type({
51
- id: t.string,
52
- }, 'GetUserRequestDTO');
53
- exports.getUserResponseDtoCodec = t.type({
54
- status: t.number,
55
- data: exports.userDtoCodec,
56
- }, 'GetUserResponseDTO');
17
+ exports.getUserRequestDtoSchema = zod_1.z.object({
18
+ id: zod_1.z.string(),
19
+ });
20
+ exports.getUserResponseDtoSchema = zod_1.z.object({
21
+ status: zod_1.z.number(),
22
+ data: exports.userDtoSchema,
23
+ });
57
24
  /*****/
58
- exports.getAllUsersRequestDtoCodec = t.type({}, 'GetAllUsersRequestDTO');
59
- exports.getAllUsersResponseDtoCodec = t.type({
60
- status: t.number,
61
- data: t.array(exports.userDtoCodec),
62
- }, 'GetAllUsersResponseDTO');
25
+ exports.getAllUsersRequestDtoSchema = zod_1.z.object({});
26
+ exports.getAllUsersResponseDtoSchema = zod_1.z.object({
27
+ status: zod_1.z.number(),
28
+ data: zod_1.z.array(exports.userDtoSchema),
29
+ });
63
30
  /*****/
64
- exports.saveUserRequestDtoCodec = t.type({
65
- data: t.intersection([
66
- exports.userDtoCodec,
67
- t.partial({
68
- password: t.string,
69
- }),
70
- ]),
71
- password: t.string,
72
- }, 'SaveUserRequestDTO');
73
- exports.saveUserResponseDtoCodec = t.type({
74
- status: t.number,
75
- data: exports.userDtoCodec,
76
- }, 'SaveUserResponseDTO');
31
+ exports.saveUserRequestDtoSchema = zod_1.z.object({
32
+ data: exports.userDtoSchema.extend({
33
+ password: zod_1.z.string().optional(),
34
+ }),
35
+ password: zod_1.z.string(),
36
+ });
37
+ exports.saveUserResponseDtoSchema = zod_1.z.object({
38
+ status: zod_1.z.number(),
39
+ data: exports.userDtoSchema,
40
+ });
77
41
  /*****/
78
- exports.deleteUserRequestDtoCodec = t.type({
79
- id: t.string,
80
- }, 'DeleteUserRequestDTO');
81
- exports.deleteUserResponseDtoCodec = t.type({
82
- status: t.number,
83
- }, 'DeleteUserResponseDTO');
42
+ exports.deleteUserRequestDtoSchema = zod_1.z.object({
43
+ id: zod_1.z.string(),
44
+ });
45
+ exports.deleteUserResponseDtoSchema = zod_1.z.object({
46
+ status: zod_1.z.number(),
47
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addev-be/ui",
3
- "version": "0.21.8",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "watch": "tsc -b --watch",
@@ -20,7 +20,7 @@
20
20
  "update-version": "../../node/update-version.mjs"
21
21
  },
22
22
  "devDependencies": {
23
- "@addev-be/framework-utils": "^0.21.8",
23
+ "@addev-be/framework-utils": "^1.0.0",
24
24
  "@types/lodash": "^4",
25
25
  "@types/react": "^18.3.3",
26
26
  "@types/react-dom": "^18.3.0",
@@ -39,14 +39,13 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@uidotdev/usehooks": "^2.4.1",
42
- "fp-ts": "^2.16.9",
43
42
  "hash.js": "^1.1.7",
44
- "io-ts": "^2.2.21",
45
43
  "lodash": "^4.17.21",
46
44
  "moment": "^2.30.1",
47
45
  "react-number-format": "^5.4.4",
48
46
  "react-router-dom": "^7.0.2",
49
47
  "rxjs": "^7.8.1",
50
- "uuid": "^10.0.0"
48
+ "uuid": "^10.0.0",
49
+ "zod": "^4.1.5"
51
50
  }
52
51
  }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
 
3
- import * as t from 'io-ts';
3
+ import { z } from 'zod';
4
4
 
5
5
  import {
6
6
  CSSProperties,
@@ -226,28 +226,23 @@ export type DataGridContextProps<R> = DataGridProps<R> & {
226
226
 
227
227
  export type DataGridContext<R> = Context<DataGridContextProps<R>>;
228
228
 
229
- export const dataGridSettingCodec = t.partial(
230
- {
231
- width: t.number,
232
- order: t.number,
233
- },
234
- 'DataGridSetting'
229
+ export const dataGridSettingSchema = z.object({
230
+ width: z.number().optional(),
231
+ order: z.number().optional(),
232
+ });
233
+ export const dataGridSettingsSchema = z.record(
234
+ z.string(),
235
+ dataGridSettingSchema
235
236
  );
236
- export const dataGridSettingsCodec = t.record(
237
- t.string,
238
- dataGridSettingCodec,
239
- 'DataGridSettings'
240
- );
241
- export const dataGridSettingsByNameCodec = t.record(
242
- t.string,
243
- dataGridSettingsCodec,
244
- 'DataGridSettingsByName'
237
+ export const dataGridSettingsByNameSchema = z.record(
238
+ z.string(),
239
+ dataGridSettingsSchema
245
240
  );
246
241
 
247
- export type DataGridSetting = t.TypeOf<typeof dataGridSettingCodec>;
248
- export type DataGridSettings = t.TypeOf<typeof dataGridSettingsCodec>;
249
- export type DataGridSettingsByName = t.TypeOf<
250
- typeof dataGridSettingsByNameCodec
242
+ export type DataGridSetting = z.infer<typeof dataGridSettingSchema>;
243
+ export type DataGridSettings = z.infer<typeof dataGridSettingsSchema>;
244
+ export type DataGridSettingsByName = z.infer<
245
+ typeof dataGridSettingsByNameSchema
251
246
  >;
252
247
  export type DataGridSettingsTuple = [string, DataGridSetting];
253
248
  export type DataGridSettingsArray = DataGridSettingsTuple[];
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import * as t from 'io-ts';
2
+ import { z } from 'zod';
3
3
 
4
4
  import {
5
5
  GenericArchiveRequestDTO,
@@ -8,46 +8,46 @@ import {
8
8
  GenericDeleteResponseDTO,
9
9
  GenericGetAllRequestDTO,
10
10
  GenericGetRequestDTO,
11
- getGenericGetAllResponseDtoCodec,
12
- getGenericGetResponseDtoCodec,
13
- getGenericSaveRequestDtoCodec,
14
- getGenericSaveResponseDtoCodec,
11
+ getGenericGetAllResponseDtoSchema,
12
+ getGenericGetResponseDtoSchema,
13
+ getGenericSaveRequestDtoSchema,
14
+ getGenericSaveResponseDtoSchema,
15
15
  } from '../types/generic';
16
16
 
17
17
  import { useLoadingRequestHandler } from '../hooks';
18
- import { userDtoCodec } from '../types/users';
18
+ import { userDtoSchema } from '../types/users';
19
19
 
20
- export const useGenericGetRequestHandler = <C extends t.Mixed>(
20
+ export const useGenericGetRequestHandler = <T extends z.ZodType>(
21
21
  name: string,
22
- codec: C
22
+ schema: T
23
23
  ) => {
24
- const responseCodec = getGenericGetResponseDtoCodec(codec);
24
+ const responseSchema = getGenericGetResponseDtoSchema(schema);
25
25
  return useLoadingRequestHandler<
26
26
  GenericGetRequestDTO,
27
- t.TypeOf<typeof responseCodec>
27
+ z.infer<typeof responseSchema>
28
28
  >(name);
29
29
  };
30
30
 
31
- export const useGenericGetAllRequestHandler = <C extends t.Mixed>(
31
+ export const useGenericGetAllRequestHandler = <T extends z.ZodType>(
32
32
  name: string,
33
- codec: C
33
+ schema: T
34
34
  ) => {
35
- const responseCodec = getGenericGetAllResponseDtoCodec(codec);
35
+ const responseSchema = getGenericGetAllResponseDtoSchema(schema);
36
36
  return useLoadingRequestHandler<
37
37
  GenericGetAllRequestDTO,
38
- t.TypeOf<typeof responseCodec>
38
+ z.infer<typeof responseSchema>
39
39
  >(name);
40
40
  };
41
41
 
42
- export const useGenericSaveRequestHandler = <C extends t.Mixed>(
42
+ export const useGenericSaveRequestHandler = <T extends z.ZodType>(
43
43
  name: string,
44
- codec: C
44
+ schema: T
45
45
  ) => {
46
- const requestCodec = getGenericSaveRequestDtoCodec(codec);
47
- const responseCodec = getGenericSaveResponseDtoCodec(codec);
46
+ const requestSchema = getGenericSaveRequestDtoSchema(schema);
47
+ const responseSchema = getGenericSaveResponseDtoSchema(schema);
48
48
  return useLoadingRequestHandler<
49
- t.TypeOf<typeof requestCodec>,
50
- t.TypeOf<typeof responseCodec>
49
+ z.infer<typeof requestSchema>,
50
+ z.infer<typeof responseSchema>
51
51
  >(name);
52
52
  };
53
53
 
@@ -1,131 +1,98 @@
1
- import * as t from 'io-ts';
2
-
3
- import { userDtoCodec } from './users';
4
-
5
- export const loginRequestDtoCodec = t.type(
6
- {
7
- username: t.string,
8
- password: t.string,
9
- },
10
- 'LoginRequestDTO'
11
- );
12
-
13
- export const loginResponseDtoCodec = t.type(
14
- {
15
- status: t.number,
16
- token: t.string,
17
- user: t.union([userDtoCodec, t.null]),
18
- },
19
- 'LoginResponseDTO'
20
- );
21
-
22
- export type LoginRequestDTO = t.TypeOf<typeof loginRequestDtoCodec>;
23
- export type LoginResponseDTO = t.TypeOf<typeof loginResponseDtoCodec>;
1
+ import { z } from 'zod';
2
+
3
+ import { userDtoSchema } from './users';
4
+
5
+ export const loginRequestDtoSchema = z.object({
6
+ username: z.string(),
7
+ password: z.string(),
8
+ });
9
+
10
+ export const loginResponseDtoSchema = z.object({
11
+ status: z.number(),
12
+ token: z.string(),
13
+ user: userDtoSchema.nullable(),
14
+ });
15
+
16
+ export type LoginRequestDTO = z.infer<typeof loginRequestDtoSchema>;
17
+ export type LoginResponseDTO = z.infer<typeof loginResponseDtoSchema>;
24
18
 
25
19
  /*****/
26
20
 
27
- export const logoutRequestDtoCodec = t.type({}, 'LogoutRequestDTO');
21
+ export const logoutRequestDtoSchema = z.object({});
28
22
 
29
- export const logoutResponseDtoCodec = t.type(
30
- {
31
- status: t.number,
32
- },
33
- 'LogoutResponseDTO'
34
- );
23
+ export const logoutResponseDtoSchema = z.object({
24
+ status: z.number(),
25
+ });
35
26
 
36
- export type LogoutRequestDTO = t.TypeOf<typeof logoutRequestDtoCodec>;
37
- export type LogoutResponseDTO = t.TypeOf<typeof logoutResponseDtoCodec>;
27
+ export type LogoutRequestDTO = z.infer<typeof logoutRequestDtoSchema>;
28
+ export type LogoutResponseDTO = z.infer<typeof logoutResponseDtoSchema>;
38
29
 
39
30
  /*****/
40
31
 
41
- export const authenticateRequestDtoCodec = t.type(
42
- {
43
- token: t.string,
44
- },
45
- 'AuthenticateRequestDTO'
46
- );
47
-
48
- export const authenticateResponseDtoCodec = t.type(
49
- {
50
- status: t.number,
51
- user: t.union([userDtoCodec, t.null]),
52
- },
53
- 'AuthenticateResponseDTO'
54
- );
55
-
56
- export type AuthenticateRequestDTO = t.TypeOf<
57
- typeof authenticateRequestDtoCodec
32
+ export const authenticateRequestDtoSchema = z.object({
33
+ token: z.string(),
34
+ });
35
+
36
+ export const authenticateResponseDtoSchema = z.object({
37
+ status: z.number(),
38
+ user: userDtoSchema.nullable(),
39
+ });
40
+
41
+ export type AuthenticateRequestDTO = z.infer<
42
+ typeof authenticateRequestDtoSchema
58
43
  >;
59
- export type AuthenticateResponseDTO = t.TypeOf<
60
- typeof authenticateResponseDtoCodec
44
+ export type AuthenticateResponseDTO = z.infer<
45
+ typeof authenticateResponseDtoSchema
61
46
  >;
62
47
 
63
48
  /*****/
64
49
 
65
- export const sendRecoveryKeyRequestDtoCodec = t.type(
66
- {
67
- email: t.string,
68
- },
69
- 'SendRecoveryKeyRequestDTO'
70
- );
71
-
72
- export const sendRecoveryKeyResponseDtoCodec = t.type(
73
- {
74
- status: t.number,
75
- },
76
- 'SendRecoveryKeyResponseDTO'
77
- );
78
-
79
- export type SendRecoveryKeyRequestDTO = t.TypeOf<
80
- typeof sendRecoveryKeyRequestDtoCodec
50
+ export const sendRecoveryKeyRequestDtoSchema = z.object({
51
+ email: z.string(),
52
+ });
53
+
54
+ export const sendRecoveryKeyResponseDtoSchema = z.object({
55
+ status: z.number(),
56
+ });
57
+
58
+ export type SendRecoveryKeyRequestDTO = z.infer<
59
+ typeof sendRecoveryKeyRequestDtoSchema
81
60
  >;
82
- export type SendRecoveryKeyResponseDTO = t.TypeOf<
83
- typeof sendRecoveryKeyResponseDtoCodec
61
+ export type SendRecoveryKeyResponseDTO = z.infer<
62
+ typeof sendRecoveryKeyResponseDtoSchema
84
63
  >;
85
64
 
86
65
  /*****/
87
66
 
88
- export const checkRecoveryKeyRequestDtoCodec = t.type(
89
- {
90
- key: t.string,
91
- },
92
- 'CheckRecoveryKeyRequestDTO'
93
- );
94
-
95
- export const checkRecoveryKeyResponseDtoCodec = t.type(
96
- {
97
- status: t.number,
98
- },
99
- 'CheckRecoveryKeyResponseDTO'
100
- );
101
-
102
- export type CheckRecoveryKeyRequestDTO = t.TypeOf<
103
- typeof checkRecoveryKeyRequestDtoCodec
67
+ export const checkRecoveryKeyRequestDtoSchema = z.object({
68
+ key: z.string(),
69
+ });
70
+
71
+ export const checkRecoveryKeyResponseDtoSchema = z.object({
72
+ status: z.number(),
73
+ });
74
+
75
+ export type CheckRecoveryKeyRequestDTO = z.infer<
76
+ typeof checkRecoveryKeyRequestDtoSchema
104
77
  >;
105
- export type CheckRecoveryKeyResponseDTO = t.TypeOf<
106
- typeof checkRecoveryKeyResponseDtoCodec
78
+ export type CheckRecoveryKeyResponseDTO = z.infer<
79
+ typeof checkRecoveryKeyResponseDtoSchema
107
80
  >;
108
81
 
109
82
  /*****/
110
83
 
111
- export const resetPasswordRequestDtoCodec = t.type(
112
- {
113
- key: t.string,
114
- password: t.string,
115
- },
116
- 'ResetPasswordRequestDTO'
117
- );
118
-
119
- export const resetPasswordResponseDtoCodec = t.type(
120
- {
121
- status: t.number,
122
- },
123
- 'ResetPasswordResponseDTO'
124
- );
125
-
126
- export type ResetPasswordRequestDTO = t.TypeOf<
127
- typeof resetPasswordRequestDtoCodec
84
+ export const resetPasswordRequestDtoSchema = z.object({
85
+ key: z.string(),
86
+ password: z.string(),
87
+ });
88
+
89
+ export const resetPasswordResponseDtoSchema = z.object({
90
+ status: z.number(),
91
+ });
92
+
93
+ export type ResetPasswordRequestDTO = z.infer<
94
+ typeof resetPasswordRequestDtoSchema
128
95
  >;
129
- export type ResetPasswordResponseDTO = t.TypeOf<
130
- typeof resetPasswordResponseDtoCodec
96
+ export type ResetPasswordResponseDTO = z.infer<
97
+ typeof resetPasswordResponseDtoSchema
131
98
  >;
@@ -1,10 +1,10 @@
1
- import * as t from 'io-ts';
1
+ import { z } from 'zod';
2
2
 
3
- export const baseModelDtoCodec = t.type({
4
- id: t.union([t.string, t.null]),
3
+ export const baseModelDtoSchema = z.object({
4
+ id: z.string().nullable(),
5
5
  });
6
6
 
7
- export type BaseModelDTO = t.TypeOf<typeof baseModelDtoCodec>;
7
+ export type BaseModelDTO = z.infer<typeof baseModelDtoSchema>;
8
8
 
9
9
  export const UUID_REGEX =
10
10
  /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
@@ -1,96 +1,82 @@
1
- import * as t from 'io-ts';
2
-
3
- export const genericGetRequestDtoCodec = t.type(
4
- {
5
- id: t.string,
6
- },
7
- 'GenericGetRequestDTO'
8
- );
9
-
10
- export const getGenericGetResponseDtoCodec = <C extends t.Mixed>(codec: C) =>
11
- t.type({
12
- status: t.number,
13
- data: codec,
1
+ import { z } from 'zod';
2
+
3
+ export const genericGetRequestDtoSchema = z.object({
4
+ id: z.string(),
5
+ });
6
+
7
+ export const getGenericGetResponseDtoSchema = <T extends z.ZodType>(
8
+ schema: T
9
+ ) =>
10
+ z.object({
11
+ status: z.number(),
12
+ data: schema,
14
13
  });
15
14
 
16
- export type GenericGetRequestDTO = t.TypeOf<typeof genericGetRequestDtoCodec>;
15
+ export type GenericGetRequestDTO = z.infer<typeof genericGetRequestDtoSchema>;
17
16
 
18
17
  /*****/
19
18
 
20
- export const genericGetAllRequestDtoCodec = t.type(
21
- {},
22
- 'GenericGetAllRequestDTO'
23
- );
19
+ export const genericGetAllRequestDtoSchema = z.object({});
24
20
 
25
- export const getGenericGetAllResponseDtoCodec = <C extends t.Mixed>(codec: C) =>
26
- t.type({
27
- status: t.number,
28
- data: t.array(codec),
21
+ export const getGenericGetAllResponseDtoSchema = <T extends z.ZodType>(
22
+ schema: T
23
+ ) =>
24
+ z.object({
25
+ status: z.number(),
26
+ data: z.array(schema),
29
27
  });
30
28
 
31
- export type GenericGetAllRequestDTO = t.TypeOf<
32
- typeof genericGetAllRequestDtoCodec
29
+ export type GenericGetAllRequestDTO = z.infer<
30
+ typeof genericGetAllRequestDtoSchema
33
31
  >;
34
32
 
35
33
  /*****/
36
34
 
37
- export const getGenericSaveRequestDtoCodec = <C extends t.Mixed>(codec: C) =>
38
- t.type({
39
- data: codec,
35
+ export const getGenericSaveRequestDtoSchema = <T extends z.ZodType>(
36
+ schema: T
37
+ ) =>
38
+ z.object({
39
+ data: schema,
40
40
  });
41
41
 
42
- export const getGenericSaveResponseDtoCodec = <C extends t.Mixed>(codec: C) =>
43
- t.type({
44
- status: t.number,
45
- data: codec,
42
+ export const getGenericSaveResponseDtoSchema = <T extends z.ZodType>(
43
+ schema: T
44
+ ) =>
45
+ z.object({
46
+ status: z.number(),
47
+ data: schema,
46
48
  });
47
49
 
48
50
  /*****/
49
- export const genericArchiveRequestDtoCodec = t.intersection(
50
- [
51
- t.type({
52
- ids: t.array(t.string),
53
- }),
54
- t.partial({
55
- archived: t.boolean,
56
- }),
57
- ],
58
- 'GenericArchiveRequestDTO'
59
- );
60
-
61
- export const genericArchiveResponseDtoCodec = t.type(
62
- {
63
- status: t.array(t.number),
64
- },
65
- 'GenericArchiveResponseDTO'
66
- );
67
-
68
- export type GenericArchiveRequestDTO = t.TypeOf<
69
- typeof genericArchiveRequestDtoCodec
51
+ export const genericArchiveRequestDtoSchema = z.object({
52
+ ids: z.array(z.string()),
53
+ archived: z.boolean().optional(),
54
+ });
55
+
56
+ export const genericArchiveResponseDtoSchema = z.object({
57
+ status: z.array(z.number()),
58
+ });
59
+
60
+ export type GenericArchiveRequestDTO = z.infer<
61
+ typeof genericArchiveRequestDtoSchema
70
62
  >;
71
- export type GenericArchiveResponseDTO = t.TypeOf<
72
- typeof genericArchiveResponseDtoCodec
63
+ export type GenericArchiveResponseDTO = z.infer<
64
+ typeof genericArchiveResponseDtoSchema
73
65
  >;
74
66
 
75
67
  /*****/
76
68
 
77
- export const genericDeleteRequestDtoCodec = t.type(
78
- {
79
- ids: t.array(t.string),
80
- },
81
- 'GenericDeleteRequestDTO'
82
- );
83
-
84
- export const genericDeleteResponseDtoCodec = t.type(
85
- {
86
- status: t.array(t.number),
87
- },
88
- 'GenericDeleteResponseDTO'
89
- );
90
-
91
- export type GenericDeleteRequestDTO = t.TypeOf<
92
- typeof genericDeleteRequestDtoCodec
69
+ export const genericDeleteRequestDtoSchema = z.object({
70
+ ids: z.array(z.string()),
71
+ });
72
+
73
+ export const genericDeleteResponseDtoSchema = z.object({
74
+ status: z.array(z.number()),
75
+ });
76
+
77
+ export type GenericDeleteRequestDTO = z.infer<
78
+ typeof genericDeleteRequestDtoSchema
93
79
  >;
94
- export type GenericDeleteResponseDTO = t.TypeOf<
95
- typeof genericDeleteResponseDtoCodec
80
+ export type GenericDeleteResponseDTO = z.infer<
81
+ typeof genericDeleteResponseDtoSchema
96
82
  >;