@experts_hub/shared 1.0.23 → 1.0.24
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
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @los_generic/shared
|
|
2
2
|
|
|
3
|
-
A public shared library containing DTOs, interfaces, utilities, and other common code for
|
|
3
|
+
A public shared library containing DTOs, interfaces, utilities, and other common code for experts hub applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @experts_hub/shared
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Features
|
|
@@ -22,50 +22,6 @@ npm install @los_generic/shared
|
|
|
22
22
|
- Pagination utilities
|
|
23
23
|
- More utilities can be added as needed
|
|
24
24
|
|
|
25
|
-
## Usage Examples
|
|
26
|
-
|
|
27
|
-
### Using DTOs
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import { CreateCountryDto, UpdateCountryDto } from '@los_generic/shared';
|
|
31
|
-
|
|
32
|
-
@Post()
|
|
33
|
-
async createCountry(@Body() createCountryDto: CreateCountryDto) {
|
|
34
|
-
// DTO will automatically validate the input
|
|
35
|
-
return this.countryService.create(createCountryDto);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@Put(':id')
|
|
39
|
-
async updateCountry(
|
|
40
|
-
@Param('id') id: string,
|
|
41
|
-
@Body() updateCountryDto: UpdateCountryDto
|
|
42
|
-
) {
|
|
43
|
-
return this.countryService.update(id, updateCountryDto);
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Using Pagination
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
import {
|
|
51
|
-
PaginationParams,
|
|
52
|
-
createPaginatedResponse,
|
|
53
|
-
getPaginationParams
|
|
54
|
-
} from '@los_generic/shared';
|
|
55
|
-
|
|
56
|
-
@Get()
|
|
57
|
-
async findAll(@Query() query: PaginationParams) {
|
|
58
|
-
const params = getPaginationParams(query);
|
|
59
|
-
const [items, total] = await this.repository.findAndCount({
|
|
60
|
-
skip: (params.page - 1) * params.limit,
|
|
61
|
-
take: params.limit,
|
|
62
|
-
order: { [params.sortBy]: params.sortOrder }
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return createPaginatedResponse(items, total, params);
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
25
|
## Development
|
|
70
26
|
|
|
71
27
|
1. Install dependencies:
|
|
@@ -85,7 +41,7 @@ npm run watch
|
|
|
85
41
|
|
|
86
42
|
## Publishing
|
|
87
43
|
|
|
88
|
-
This package is published as a public package under the @
|
|
44
|
+
This package is published as a public package under the @experts_hub organization.
|
|
89
45
|
|
|
90
46
|
```bash
|
|
91
47
|
# For bug fixes (0.0.x)
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './pattern/pattern';
|
package/dist/modules/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './authentication';
|