@zola_do/core 0.1.19 → 0.1.21

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.
Files changed (2) hide show
  1. package/README.md +108 -108
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,108 +1,108 @@
1
- # @zola_do/core
2
-
3
- Core shared types, entities, decorators, exceptions, and utilities for NestJS applications.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- # Install individually
9
- npm install @zola_do/core
10
-
11
- # Or via meta package
12
- npm install @zola_do/nestjs-shared
13
- ```
14
-
15
- ## Usage
16
-
17
- ### Entities
18
-
19
- Extend `CommonEntity` for entities with audit fields (createdAt, updatedAt, deletedAt, etc.):
20
-
21
- ```typescript
22
- import { CommonEntity } from '@zola_do/core';
23
- import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
24
-
25
- @Entity('products')
26
- export class Product extends CommonEntity {
27
- @PrimaryGeneratedColumn('uuid')
28
- id: string;
29
-
30
- @Column()
31
- name: string;
32
- }
33
- ```
34
-
35
- ### Decorators
36
-
37
- Use `@IgnoreTenantInterceptor` to skip tenant filtering on specific routes:
38
-
39
- ```typescript
40
- import { IgnoreTenantInterceptor } from '@zola_do/core';
41
-
42
- @Controller('global-data')
43
- export class GlobalDataController {
44
- @Get()
45
- @IgnoreTenantInterceptor()
46
- findAll() {
47
- // Tenant filter will not be applied
48
- }
49
- }
50
- ```
51
-
52
- ### API Response Format
53
-
54
- Use `DataResponseFormat` for paginated responses:
55
-
56
- ```typescript
57
- import { DataResponseFormat } from '@zola_do/core';
58
-
59
- const response = new DataResponseFormat<Product>();
60
- response.items = products;
61
- response.total = totalCount;
62
- return response;
63
- ```
64
-
65
- ### CRUD Options
66
-
67
- Use `EntityCrudOptions` when configuring CRUD controllers:
68
-
69
- ```typescript
70
- import { EntityCrudOptions } from '@zola_do/core';
71
-
72
- const options: EntityCrudOptions = {
73
- createPermission: 'product:create',
74
- viewPermission: 'product:view',
75
- updatePermission: 'product:update',
76
- deletePermission: 'product:delete',
77
- mapCreateContext: ({ req }) => ({
78
- organizationId: req?.auth?.organizationId,
79
- organizationName: req?.auth?.organizationName,
80
- createdBy: req?.auth?.userId,
81
- }),
82
- };
83
- ```
84
-
85
- ### Exceptions
86
-
87
- Use global exception filters:
88
-
89
- ```typescript
90
- import { GlobalExceptionFilter } from '@zola_do/core';
91
-
92
- app.useGlobalFilters(new GlobalExceptionFilter());
93
- ```
94
-
95
- ## Exports
96
-
97
- - **Entities:** `CommonEntity`, `BaseEntity`, `Audit`, `ContactNumber`, `FileResponse`
98
- - **Decorators:** `@CrudOptions`, `@IgnoreTenantInterceptor`
99
- - **API Data:** `ApiPaginatedResponse`, `DataResponseFormat`
100
- - **Exceptions:** `GlobalExceptionFilter`, `RpcExceptionFilter`
101
- - **Enums:** `AccountStatusEnum`, `PaymentStatusEnum`, `VendorStatusEnum`, and more
102
- - **Types:** `EntityCrudOptions`, `ExtraCrudOptions`, `CrudCreateContextHook`, `CrudContextPayload`, `TCrudOption`, `NotificationType`, and more
103
-
104
- ## Related Packages
105
-
106
- - [@zola_do/collection-query](../collection-query) — Filter, sort, paginate for collections
107
- - [@zola_do/crud](../crud) — Generic CRUD controllers and services
108
- - [@zola_do/authorization](../authorization) — JWT auth and guards
1
+ # @zola_do/core
2
+
3
+ Core shared types, entities, decorators, exceptions, and utilities for NestJS applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Install individually
9
+ npm install @zola_do/core
10
+
11
+ # Or via meta package
12
+ npm install @zola_do/nestjs-shared
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Entities
18
+
19
+ Extend `CommonEntity` for entities with audit fields (createdAt, updatedAt, deletedAt, etc.):
20
+
21
+ ```typescript
22
+ import { CommonEntity } from '@zola_do/core';
23
+ import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
24
+
25
+ @Entity('products')
26
+ export class Product extends CommonEntity {
27
+ @PrimaryGeneratedColumn('uuid')
28
+ id: string;
29
+
30
+ @Column()
31
+ name: string;
32
+ }
33
+ ```
34
+
35
+ ### Decorators
36
+
37
+ Use `@IgnoreTenantInterceptor` to skip tenant filtering on specific routes:
38
+
39
+ ```typescript
40
+ import { IgnoreTenantInterceptor } from '@zola_do/core';
41
+
42
+ @Controller('global-data')
43
+ export class GlobalDataController {
44
+ @Get()
45
+ @IgnoreTenantInterceptor()
46
+ findAll() {
47
+ // Tenant filter will not be applied
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### API Response Format
53
+
54
+ Use `DataResponseFormat` for paginated responses:
55
+
56
+ ```typescript
57
+ import { DataResponseFormat } from '@zola_do/core';
58
+
59
+ const response = new DataResponseFormat<Product>();
60
+ response.items = products;
61
+ response.total = totalCount;
62
+ return response;
63
+ ```
64
+
65
+ ### CRUD Options
66
+
67
+ Use `EntityCrudOptions` when configuring CRUD controllers:
68
+
69
+ ```typescript
70
+ import { EntityCrudOptions } from '@zola_do/core';
71
+
72
+ const options: EntityCrudOptions = {
73
+ createPermission: 'product:create',
74
+ viewPermission: 'product:view',
75
+ updatePermission: 'product:update',
76
+ deletePermission: 'product:delete',
77
+ mapCreateContext: ({ req }) => ({
78
+ organizationId: req?.auth?.organizationId,
79
+ organizationName: req?.auth?.organizationName,
80
+ createdBy: req?.auth?.userId,
81
+ }),
82
+ };
83
+ ```
84
+
85
+ ### Exceptions
86
+
87
+ Use global exception filters:
88
+
89
+ ```typescript
90
+ import { GlobalExceptionFilter } from '@zola_do/core';
91
+
92
+ app.useGlobalFilters(new GlobalExceptionFilter());
93
+ ```
94
+
95
+ ## Exports
96
+
97
+ - **Entities:** `CommonEntity`, `BaseEntity`, `Audit`, `ContactNumber`, `FileResponse`
98
+ - **Decorators:** `@CrudOptions`, `@IgnoreTenantInterceptor`
99
+ - **API Data:** `ApiPaginatedResponse`, `DataResponseFormat`
100
+ - **Exceptions:** `GlobalExceptionFilter`, `RpcExceptionFilter`
101
+ - **Enums:** `AccountStatusEnum`, `PaymentStatusEnum`, `VendorStatusEnum`, and more
102
+ - **Types:** `EntityCrudOptions`, `ExtraCrudOptions`, `CrudCreateContextHook`, `CrudContextPayload`, `TCrudOption`, `NotificationType`, and more
103
+
104
+ ## Related Packages
105
+
106
+ - [@zola_do/collection-query](../collection-query) — Filter, sort, paginate for collections
107
+ - [@zola_do/crud](../crud) — Generic CRUD controllers and services
108
+ - [@zola_do/authorization](../authorization) — JWT auth and guards
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zola_do/core",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Core shared types, entities, decorators and utilities for NestJS",
5
5
  "author": "zolaDO",
6
6
  "license": "ISC",