@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.
- package/dist/components/data/DataGrid/hooks/useDataGridSettings.d.ts +8 -12
- package/dist/components/data/DataGrid/types.d.ts +16 -16
- package/dist/components/data/DataGrid/types.js +8 -31
- package/dist/services/requests/auth.d.ts +9 -11
- package/dist/services/requests/generic.d.ts +150 -15
- package/dist/services/requests/generic.js +7 -7
- package/dist/services/requests/tracking.d.ts +4 -8
- package/dist/services/requests/userProfiles.d.ts +5 -5
- package/dist/services/requests/users.d.ts +11 -16
- package/dist/services/types/auth.d.ts +80 -82
- package/dist/services/types/auth.js +41 -64
- package/dist/services/types/base.d.ts +5 -5
- package/dist/services/types/base.js +4 -27
- package/dist/services/types/generic.d.ts +39 -40
- package/dist/services/types/generic.js +38 -65
- package/dist/services/types/tracking.d.ts +24 -24
- package/dist/services/types/tracking.js +13 -44
- package/dist/services/types/userProfiles.d.ts +60 -60
- package/dist/services/types/userProfiles.js +31 -61
- package/dist/services/types/users.d.ts +108 -114
- package/dist/services/types/users.js +39 -75
- package/package.json +4 -5
- package/src/components/data/DataGrid/types.ts +15 -20
- package/src/services/requests/generic.ts +20 -20
- package/src/services/types/auth.ts +73 -106
- package/src/services/types/base.ts +4 -4
- package/src/services/types/generic.ts +58 -72
- package/src/services/types/tracking.ts +21 -31
- package/src/services/types/userProfiles.ts +54 -82
- package/src/services/types/users.ts +57 -89
|
@@ -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.
|
|
38
|
-
var
|
|
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.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.
|
|
51
|
-
id:
|
|
52
|
-
}
|
|
53
|
-
exports.
|
|
54
|
-
status:
|
|
55
|
-
data: exports.
|
|
56
|
-
}
|
|
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.
|
|
59
|
-
exports.
|
|
60
|
-
status:
|
|
61
|
-
data:
|
|
62
|
-
}
|
|
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.
|
|
65
|
-
data:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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.
|
|
79
|
-
id:
|
|
80
|
-
}
|
|
81
|
-
exports.
|
|
82
|
-
status:
|
|
83
|
-
}
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
|
237
|
-
|
|
238
|
-
|
|
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 =
|
|
248
|
-
export type DataGridSettings =
|
|
249
|
-
export type DataGridSettingsByName =
|
|
250
|
-
typeof
|
|
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
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
getGenericGetAllResponseDtoSchema,
|
|
12
|
+
getGenericGetResponseDtoSchema,
|
|
13
|
+
getGenericSaveRequestDtoSchema,
|
|
14
|
+
getGenericSaveResponseDtoSchema,
|
|
15
15
|
} from '../types/generic';
|
|
16
16
|
|
|
17
17
|
import { useLoadingRequestHandler } from '../hooks';
|
|
18
|
-
import {
|
|
18
|
+
import { userDtoSchema } from '../types/users';
|
|
19
19
|
|
|
20
|
-
export const useGenericGetRequestHandler = <
|
|
20
|
+
export const useGenericGetRequestHandler = <T extends z.ZodType>(
|
|
21
21
|
name: string,
|
|
22
|
-
|
|
22
|
+
schema: T
|
|
23
23
|
) => {
|
|
24
|
-
const
|
|
24
|
+
const responseSchema = getGenericGetResponseDtoSchema(schema);
|
|
25
25
|
return useLoadingRequestHandler<
|
|
26
26
|
GenericGetRequestDTO,
|
|
27
|
-
|
|
27
|
+
z.infer<typeof responseSchema>
|
|
28
28
|
>(name);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export const useGenericGetAllRequestHandler = <
|
|
31
|
+
export const useGenericGetAllRequestHandler = <T extends z.ZodType>(
|
|
32
32
|
name: string,
|
|
33
|
-
|
|
33
|
+
schema: T
|
|
34
34
|
) => {
|
|
35
|
-
const
|
|
35
|
+
const responseSchema = getGenericGetAllResponseDtoSchema(schema);
|
|
36
36
|
return useLoadingRequestHandler<
|
|
37
37
|
GenericGetAllRequestDTO,
|
|
38
|
-
|
|
38
|
+
z.infer<typeof responseSchema>
|
|
39
39
|
>(name);
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export const useGenericSaveRequestHandler = <
|
|
42
|
+
export const useGenericSaveRequestHandler = <T extends z.ZodType>(
|
|
43
43
|
name: string,
|
|
44
|
-
|
|
44
|
+
schema: T
|
|
45
45
|
) => {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const requestSchema = getGenericSaveRequestDtoSchema(schema);
|
|
47
|
+
const responseSchema = getGenericSaveResponseDtoSchema(schema);
|
|
48
48
|
return useLoadingRequestHandler<
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
z.infer<typeof requestSchema>,
|
|
50
|
+
z.infer<typeof responseSchema>
|
|
51
51
|
>(name);
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -1,131 +1,98 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
21
|
+
export const logoutRequestDtoSchema = z.object({});
|
|
28
22
|
|
|
29
|
-
export const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
'LogoutResponseDTO'
|
|
34
|
-
);
|
|
23
|
+
export const logoutResponseDtoSchema = z.object({
|
|
24
|
+
status: z.number(),
|
|
25
|
+
});
|
|
35
26
|
|
|
36
|
-
export type LogoutRequestDTO =
|
|
37
|
-
export type LogoutResponseDTO =
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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 =
|
|
60
|
-
typeof
|
|
44
|
+
export type AuthenticateResponseDTO = z.infer<
|
|
45
|
+
typeof authenticateResponseDtoSchema
|
|
61
46
|
>;
|
|
62
47
|
|
|
63
48
|
/*****/
|
|
64
49
|
|
|
65
|
-
export const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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 =
|
|
83
|
-
typeof
|
|
61
|
+
export type SendRecoveryKeyResponseDTO = z.infer<
|
|
62
|
+
typeof sendRecoveryKeyResponseDtoSchema
|
|
84
63
|
>;
|
|
85
64
|
|
|
86
65
|
/*****/
|
|
87
66
|
|
|
88
|
-
export const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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 =
|
|
106
|
-
typeof
|
|
78
|
+
export type CheckRecoveryKeyResponseDTO = z.infer<
|
|
79
|
+
typeof checkRecoveryKeyResponseDtoSchema
|
|
107
80
|
>;
|
|
108
81
|
|
|
109
82
|
/*****/
|
|
110
83
|
|
|
111
|
-
export const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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 =
|
|
130
|
-
typeof
|
|
96
|
+
export type ResetPasswordResponseDTO = z.infer<
|
|
97
|
+
typeof resetPasswordResponseDtoSchema
|
|
131
98
|
>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
id:
|
|
3
|
+
export const baseModelDtoSchema = z.object({
|
|
4
|
+
id: z.string().nullable(),
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
export type BaseModelDTO =
|
|
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
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 =
|
|
15
|
+
export type GenericGetRequestDTO = z.infer<typeof genericGetRequestDtoSchema>;
|
|
17
16
|
|
|
18
17
|
/*****/
|
|
19
18
|
|
|
20
|
-
export const
|
|
21
|
-
{},
|
|
22
|
-
'GenericGetAllRequestDTO'
|
|
23
|
-
);
|
|
19
|
+
export const genericGetAllRequestDtoSchema = z.object({});
|
|
24
20
|
|
|
25
|
-
export const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 =
|
|
32
|
-
typeof
|
|
29
|
+
export type GenericGetAllRequestDTO = z.infer<
|
|
30
|
+
typeof genericGetAllRequestDtoSchema
|
|
33
31
|
>;
|
|
34
32
|
|
|
35
33
|
/*****/
|
|
36
34
|
|
|
37
|
-
export const
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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 =
|
|
72
|
-
typeof
|
|
63
|
+
export type GenericArchiveResponseDTO = z.infer<
|
|
64
|
+
typeof genericArchiveResponseDtoSchema
|
|
73
65
|
>;
|
|
74
66
|
|
|
75
67
|
/*****/
|
|
76
68
|
|
|
77
|
-
export const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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 =
|
|
95
|
-
typeof
|
|
80
|
+
export type GenericDeleteResponseDTO = z.infer<
|
|
81
|
+
typeof genericDeleteResponseDtoSchema
|
|
96
82
|
>;
|