@zola_do/core 0.1.13 → 0.1.17
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/README.md +6 -1
- package/dist/types/crud-option.type.d.ts +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,11 @@ const options: EntityCrudOptions = {
|
|
|
74
74
|
viewPermission: 'product:view',
|
|
75
75
|
updatePermission: 'product:update',
|
|
76
76
|
deletePermission: 'product:delete',
|
|
77
|
+
mapCreateContext: ({ req }) => ({
|
|
78
|
+
organizationId: req?.auth?.organizationId,
|
|
79
|
+
organizationName: req?.auth?.organizationName,
|
|
80
|
+
createdBy: req?.auth?.userId,
|
|
81
|
+
}),
|
|
77
82
|
};
|
|
78
83
|
```
|
|
79
84
|
|
|
@@ -94,7 +99,7 @@ app.useGlobalFilters(new GlobalExceptionFilter());
|
|
|
94
99
|
- **API Data:** `ApiPaginatedResponse`, `DataResponseFormat`
|
|
95
100
|
- **Exceptions:** `GlobalExceptionFilter`, `RpcExceptionFilter`
|
|
96
101
|
- **Enums:** `AccountStatusEnum`, `PaymentStatusEnum`, `VendorStatusEnum`, and more
|
|
97
|
-
- **Types:** `EntityCrudOptions`, `TCrudOption`, `NotificationType`, and more
|
|
102
|
+
- **Types:** `EntityCrudOptions`, `ExtraCrudOptions`, `CrudCreateContextHook`, `CrudContextPayload`, `TCrudOption`, `NotificationType`, and more
|
|
98
103
|
|
|
99
104
|
## Related Packages
|
|
100
105
|
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export type CrudContextPayload = Record<string, any>;
|
|
2
|
+
export type CrudCreateContextHook = (params: {
|
|
3
|
+
itemData: CrudContextPayload;
|
|
4
|
+
req?: any;
|
|
5
|
+
}) => void | Partial<CrudContextPayload> | Promise<void | Partial<CrudContextPayload>>;
|
|
6
|
+
export type CrudUpdateContextHook = (params: {
|
|
7
|
+
itemData: CrudContextPayload;
|
|
8
|
+
req?: any;
|
|
9
|
+
}) => void | Partial<CrudContextPayload> | Promise<void | Partial<CrudContextPayload>>;
|
|
1
10
|
export type EntityCrudOptions = {
|
|
2
11
|
createDto?: {
|
|
3
12
|
new (): NonNullable<unknown>;
|
|
@@ -11,6 +20,8 @@ export type EntityCrudOptions = {
|
|
|
11
20
|
deletePermission?: string;
|
|
12
21
|
restorePermission?: string;
|
|
13
22
|
viewArchivedPermission?: string;
|
|
23
|
+
mapCreateContext?: CrudCreateContextHook;
|
|
24
|
+
mapUpdateContext?: CrudUpdateContextHook;
|
|
14
25
|
};
|
|
15
26
|
export type ExtraCrudOptions = {
|
|
16
27
|
entityIdName: string;
|
|
@@ -26,6 +37,8 @@ export type ExtraCrudOptions = {
|
|
|
26
37
|
deletePermission?: string;
|
|
27
38
|
restorePermission?: string;
|
|
28
39
|
viewArchivedPermission?: string;
|
|
40
|
+
mapCreateContext?: CrudCreateContextHook;
|
|
41
|
+
mapUpdateContext?: CrudUpdateContextHook;
|
|
29
42
|
};
|
|
30
43
|
export interface RelationCrudOptions {
|
|
31
44
|
firstEntityIdName: string;
|