@uecsio/pages-api 2.1.0 → 2.2.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/README.md +27 -271
- package/dist/consts/index.d.ts +2 -0
- package/dist/consts/index.d.ts.map +1 -0
- package/dist/consts/index.js +5 -0
- package/dist/consts/index.js.map +1 -0
- package/dist/dto/create-page.dto.d.ts +2 -2
- package/dist/dto/create-page.dto.d.ts.map +1 -1
- package/dist/dto/create-page.dto.js +6 -13
- package/dist/dto/create-page.dto.js.map +1 -1
- package/dist/dto/update-page.dto.d.ts +5 -10
- package/dist/dto/update-page.dto.d.ts.map +1 -1
- package/dist/dto/update-page.dto.js +7 -90
- package/dist/dto/update-page.dto.js.map +1 -1
- package/dist/entities/page.entity.js +2 -2
- package/dist/entities/page.entity.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/migrations/1704067200000-CreatePagesTable.js +19 -19
- package/dist/migrations/1704067200000-CreatePagesTable.js.map +1 -1
- package/dist/migrations/migration.config.d.ts +1 -2
- package/dist/migrations/migration.config.d.ts.map +1 -1
- package/dist/migrations/migration.config.js +2 -4
- package/dist/migrations/migration.config.js.map +1 -1
- package/dist/pages.module.d.ts.map +1 -1
- package/dist/pages.module.js +2 -8
- package/dist/pages.module.js.map +1 -1
- package/package.json +9 -12
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.d.ts +0 -6
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.d.ts.map +0 -1
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.js +0 -18
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.js.map +0 -1
- package/dist/services/page-url.service.d.ts +0 -10
- package/dist/services/page-url.service.d.ts.map +0 -1
- package/dist/services/page-url.service.js +0 -38
- package/dist/services/page-url.service.js.map +0 -1
- package/dist/services/pages.service.d.ts +0 -7
- package/dist/services/pages.service.d.ts.map +0 -1
- package/dist/services/pages.service.js +0 -32
- package/dist/services/pages.service.js.map +0 -1
- package/dist/subscribers/page-url.subscriber.d.ts +0 -12
- package/dist/subscribers/page-url.subscriber.d.ts.map +0 -1
- package/dist/subscribers/page-url.subscriber.js +0 -44
- package/dist/subscribers/page-url.subscriber.js.map +0 -1
- package/dist/tests/pages.test.config.d.ts +0 -29
- package/dist/tests/pages.test.config.d.ts.map +0 -1
- package/dist/tests/pages.test.config.js +0 -83
- package/dist/tests/pages.test.config.js.map +0 -1
- package/dist/validators/is-unique-url.constraint.d.ts +0 -10
- package/dist/validators/is-unique-url.constraint.d.ts.map +0 -1
- package/dist/validators/is-unique-url.constraint.js +0 -51
- package/dist/validators/is-unique-url.constraint.js.map +0 -1
- package/dist/validators/is-unique-url.validator.d.ts +0 -3
- package/dist/validators/is-unique-url.validator.d.ts.map +0 -1
- package/dist/validators/is-unique-url.validator.js +0 -18
- package/dist/validators/is-unique-url.validator.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
# @uecsio/pages-api
|
|
2
2
|
|
|
3
|
-
A reusable NestJS Pages module for content management
|
|
4
|
-
|
|
5
|
-
## ⚠️ Breaking Changes in v2.0.0
|
|
6
|
-
|
|
7
|
-
### Migrated to @dataui/crud
|
|
8
|
-
|
|
9
|
-
Version 2.0.0 migrates from `@nestjs-library/crud` to `@dataui/crud`.
|
|
10
|
-
|
|
11
|
-
**What Changed:**
|
|
12
|
-
- CRUD library: `@nestjs-library/crud` → `@dataui/crud` + `@dataui/crud-typeorm`
|
|
13
|
-
- Enhanced query features (better filtering, sorting, pagination)
|
|
14
|
-
- Improved Swagger documentation
|
|
15
|
-
- Tests reorganized: `specs/` → `tests/` with `unit/` and `integration/` separation
|
|
16
|
-
|
|
17
|
-
**What Stayed the Same:**
|
|
18
|
-
- All entity fields (rich schema preserved)
|
|
19
|
-
- Auto-URL generation from titles
|
|
20
|
-
- Async validators
|
|
21
|
-
- All API endpoints and functionality
|
|
22
|
-
- Database schema (no migrations needed for upgrade)
|
|
23
|
-
|
|
24
|
-
**Installation:**
|
|
25
|
-
```bash
|
|
26
|
-
npm install @uecsio/pages-api@^2.0.0
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Usage:**
|
|
30
|
-
No code changes needed in consuming applications. The public API remains identical.
|
|
31
|
-
|
|
32
|
-
---
|
|
3
|
+
A reusable NestJS Pages module for content management, built on top of [@uecsio/nestjs-crud-module](https://www.npmjs.com/package/@uecsio/nestjs-crud-module).
|
|
33
4
|
|
|
34
5
|
## 🚀 Features
|
|
35
6
|
|
|
@@ -37,8 +8,7 @@ No code changes needed in consuming applications. The public API remains identic
|
|
|
37
8
|
- **TypeORM Integration**: Built-in database support
|
|
38
9
|
- **Validation**: Class-validator integration for DTOs
|
|
39
10
|
- **Swagger Documentation**: Auto-generated API documentation
|
|
40
|
-
- **
|
|
41
|
-
- **TypeScript Support**: Full type safety
|
|
11
|
+
- **Automatic Discovery**: seamless integration with `@uecsio` ecosystem
|
|
42
12
|
|
|
43
13
|
## 📦 Installation
|
|
44
14
|
|
|
@@ -48,15 +18,17 @@ npm install @uecsio/pages-api
|
|
|
48
18
|
|
|
49
19
|
## 🔧 Dependencies
|
|
50
20
|
|
|
51
|
-
This package requires the following peer dependencies
|
|
21
|
+
This package requires the following peer dependencies:
|
|
52
22
|
|
|
53
23
|
```bash
|
|
54
|
-
npm install @nestjs/common @nestjs/typeorm typeorm class-validator class-transformer @
|
|
24
|
+
npm install @nestjs/common @nestjs/typeorm typeorm class-validator class-transformer @uecsio/nestjs-crud-module
|
|
55
25
|
```
|
|
56
26
|
|
|
57
27
|
## 📖 Usage
|
|
58
28
|
|
|
59
|
-
###
|
|
29
|
+
### Import the Module
|
|
30
|
+
|
|
31
|
+
Simply import `PagesModule` into your root `AppModule`. The module is self-configuring.
|
|
60
32
|
|
|
61
33
|
```typescript
|
|
62
34
|
import { Module } from '@nestjs/common';
|
|
@@ -66,14 +38,8 @@ import { PagesModule } from '@uecsio/pages-api';
|
|
|
66
38
|
@Module({
|
|
67
39
|
imports: [
|
|
68
40
|
TypeOrmModule.forRoot({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
port: 5432,
|
|
72
|
-
username: 'postgres',
|
|
73
|
-
password: 'password',
|
|
74
|
-
database: 'your_database',
|
|
75
|
-
entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
|
76
|
-
synchronize: true, // Only in development
|
|
41
|
+
// ... your database config
|
|
42
|
+
autoLoadEntities: true,
|
|
77
43
|
}),
|
|
78
44
|
PagesModule,
|
|
79
45
|
],
|
|
@@ -81,200 +47,32 @@ import { PagesModule } from '@uecsio/pages-api';
|
|
|
81
47
|
export class AppModule {}
|
|
82
48
|
```
|
|
83
49
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
import { Injectable } from '@nestjs/common';
|
|
88
|
-
import { PagesService, CreatePageDto, Page } from '@uecsio/pages-api';
|
|
50
|
+
## 🔌 API Endpoints
|
|
89
51
|
|
|
90
|
-
|
|
91
|
-
export class YourService {
|
|
92
|
-
constructor(private readonly pagesService: PagesService) {}
|
|
52
|
+
The module automatically exposes the following REST endpoints under `/pages`:
|
|
93
53
|
|
|
94
|
-
|
|
95
|
-
return this.pagesService.create(data);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async getAllPages(): Promise<Page[]> {
|
|
99
|
-
return this.pagesService.findAll();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async getPageById(id: number): Promise<Page> {
|
|
103
|
-
return this.pagesService.findOne(id);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 3. Use the Controller
|
|
109
|
-
|
|
110
|
-
The package automatically provides a REST API with the following endpoints:
|
|
111
|
-
|
|
112
|
-
- `POST /pages` - Create a new page
|
|
113
|
-
- `GET /pages` - Get all pages
|
|
54
|
+
- `GET /pages` - List pages (supports pagination, filtering, sorting)
|
|
114
55
|
- `GET /pages/:id` - Get a specific page
|
|
115
|
-
- `
|
|
56
|
+
- `POST /pages` - Create a new page
|
|
57
|
+
- `PATCH /pages/:id` - Update a page
|
|
116
58
|
- `DELETE /pages/:id` - Delete a page
|
|
117
59
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
The package includes database migrations that are automatically discovered by the consuming application. The migrations will be executed externally via your TypeORM settings.
|
|
121
|
-
|
|
122
|
-
#### Automatic Discovery (Recommended)
|
|
123
|
-
|
|
124
|
-
The consuming application automatically discovers all `@uecsio` packages and their migrations:
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
// No manual configuration needed - migrations are auto-discovered!
|
|
128
|
-
@Module({
|
|
129
|
-
imports: [
|
|
130
|
-
TypeOrmModule.forRoot({
|
|
131
|
-
type: 'postgres',
|
|
132
|
-
host: 'localhost',
|
|
133
|
-
port: 5432,
|
|
134
|
-
username: 'postgres',
|
|
135
|
-
password: 'password',
|
|
136
|
-
database: 'your_database',
|
|
137
|
-
// Migrations and entities are automatically discovered from @uecsio packages
|
|
138
|
-
synchronize: false, // Always false for production
|
|
139
|
-
}),
|
|
140
|
-
PagesModule,
|
|
141
|
-
],
|
|
142
|
-
})
|
|
143
|
-
export class AppModule {}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
#### Manual Integration (Alternative)
|
|
147
|
-
|
|
148
|
-
If you prefer manual control, you can still integrate manually:
|
|
149
|
-
|
|
150
|
-
```typescript
|
|
151
|
-
import { PagesMigrationConfig } from '@uecsio/pages-api';
|
|
152
|
-
|
|
153
|
-
@Module({
|
|
154
|
-
imports: [
|
|
155
|
-
TypeOrmModule.forRoot({
|
|
156
|
-
type: 'postgres',
|
|
157
|
-
host: 'localhost',
|
|
158
|
-
port: 5432,
|
|
159
|
-
username: 'postgres',
|
|
160
|
-
password: 'password',
|
|
161
|
-
database: 'your_database',
|
|
162
|
-
entities: [...PagesMigrationConfig.entities],
|
|
163
|
-
migrations: [...PagesMigrationConfig.migrations],
|
|
164
|
-
migrationsTableName: 'migrations', // Standard migration table
|
|
165
|
-
synchronize: false, // Always false for production
|
|
166
|
-
}),
|
|
167
|
-
PagesModule,
|
|
168
|
-
],
|
|
169
|
-
})
|
|
170
|
-
export class AppModule {}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**Note:** This module uses the standard `migrations` table name, so it will work seamlessly with other modules that also use the same migration table.
|
|
174
|
-
|
|
175
|
-
#### Available migrations
|
|
176
|
-
|
|
177
|
-
The package provides the following migration:
|
|
178
|
-
- `CreatePagesTable1700000000000` - Creates the pages table with all required columns and indexes
|
|
179
|
-
|
|
180
|
-
#### Migration execution
|
|
181
|
-
|
|
182
|
-
Migrations will be executed automatically by TypeORM when you run:
|
|
183
|
-
```bash
|
|
184
|
-
# Generate new migrations
|
|
185
|
-
npm run typeorm migration:generate
|
|
186
|
-
|
|
187
|
-
# Run pending migrations
|
|
188
|
-
npm run typeorm migration:run
|
|
189
|
-
|
|
190
|
-
# Revert last migration
|
|
191
|
-
npm run typeorm migration:revert
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### 5. Customize the Page Entity
|
|
195
|
-
|
|
196
|
-
You can extend the Page entity for your specific needs:
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
import { Entity } from 'typeorm';
|
|
200
|
-
import { Page } from '@uecsio/pages-api';
|
|
201
|
-
|
|
202
|
-
@Entity()
|
|
203
|
-
export class CustomPage extends Page {
|
|
204
|
-
// Add your custom fields here
|
|
205
|
-
@Column()
|
|
206
|
-
customField: string;
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## 🏗️ Architecture
|
|
211
|
-
|
|
212
|
-
```
|
|
213
|
-
src/
|
|
214
|
-
├── entities/
|
|
215
|
-
│ └── page.entity.ts # Page database entity
|
|
216
|
-
├── dto/
|
|
217
|
-
│ ├── create-page.dto.ts # Create page DTO
|
|
218
|
-
│ └── update-page.dto.ts # Update page DTO
|
|
219
|
-
├── services/
|
|
220
|
-
│ └── pages.service.ts # Business logic service
|
|
221
|
-
├── controllers/
|
|
222
|
-
│ └── pages.controller.ts # REST API controller
|
|
223
|
-
├── pages.module.ts # NestJS module
|
|
224
|
-
└── index.ts # Package exports
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## 🔍 API Documentation
|
|
228
|
-
|
|
229
|
-
Once the module is imported, you can access the Swagger documentation at:
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
http://localhost:3000/api
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## 🧪 Testing
|
|
60
|
+
## 🗄️ Database Migrations
|
|
236
61
|
|
|
237
|
-
|
|
238
|
-
# Run tests
|
|
239
|
-
npm test
|
|
240
|
-
|
|
241
|
-
# Run tests with coverage
|
|
242
|
-
npm run test:cov
|
|
243
|
-
|
|
244
|
-
# Run tests in watch mode
|
|
245
|
-
npm run test:watch
|
|
246
|
-
```
|
|
62
|
+
The package includes database migrations that can be automatically discovered.
|
|
247
63
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
### Environment Variables
|
|
251
|
-
|
|
252
|
-
The module uses the following environment variables (with defaults):
|
|
253
|
-
|
|
254
|
-
```env
|
|
255
|
-
DB_HOST=localhost
|
|
256
|
-
DB_PORT=5432
|
|
257
|
-
DB_USERNAME=postgres
|
|
258
|
-
DB_PASSWORD=password
|
|
259
|
-
DB_NAME=your_database
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Custom Database Configuration
|
|
263
|
-
|
|
264
|
-
You can override the database configuration:
|
|
64
|
+
### Automatic Discovery
|
|
265
65
|
|
|
266
66
|
```typescript
|
|
267
|
-
import { Module } from '@nestjs/common';
|
|
268
|
-
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
269
67
|
import { PagesModule } from '@uecsio/pages-api';
|
|
68
|
+
// ... imports
|
|
270
69
|
|
|
271
70
|
@Module({
|
|
272
71
|
imports: [
|
|
273
72
|
TypeOrmModule.forRoot({
|
|
274
|
-
//
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
// ... other options
|
|
73
|
+
// ... config
|
|
74
|
+
// Entities and migrations are automatically loaded if you use auto-discovery
|
|
75
|
+
// or you can import them from PagesModule metadata if needed
|
|
278
76
|
}),
|
|
279
77
|
PagesModule,
|
|
280
78
|
],
|
|
@@ -282,59 +80,17 @@ import { PagesModule } from '@uecsio/pages-api';
|
|
|
282
80
|
export class AppModule {}
|
|
283
81
|
```
|
|
284
82
|
|
|
285
|
-
|
|
83
|
+
### Manual Configuration
|
|
286
84
|
|
|
287
|
-
|
|
85
|
+
If you need to manually configure migrations:
|
|
288
86
|
|
|
289
87
|
```typescript
|
|
290
|
-
import {
|
|
291
|
-
import { PagesService } from '@uecsio/pages-api';
|
|
292
|
-
|
|
293
|
-
@Injectable()
|
|
294
|
-
export class CustomPagesService extends PagesService {
|
|
295
|
-
async findByStatus(status: number) {
|
|
296
|
-
return this.repository.find({ where: { status } });
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Custom Controller Methods
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
import { Controller } from '@nestjs/common';
|
|
305
|
-
import { PagesController } from '@uecsio/pages-api';
|
|
88
|
+
import { PagesMigrationConfig } from '@uecsio/pages-api';
|
|
306
89
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
// Add your custom endpoints here
|
|
310
|
-
}
|
|
90
|
+
// Use PagesMigrationConfig.entities and PagesMigrationConfig.migrations
|
|
91
|
+
// in your TypeORM configuration.
|
|
311
92
|
```
|
|
312
93
|
|
|
313
|
-
##
|
|
314
|
-
|
|
315
|
-
1. Fork the repository
|
|
316
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
317
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
318
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
319
|
-
5. Open a Pull Request
|
|
320
|
-
|
|
321
|
-
## 📄 License
|
|
94
|
+
## 📝 License
|
|
322
95
|
|
|
323
96
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
324
|
-
|
|
325
|
-
## 🆘 Support
|
|
326
|
-
|
|
327
|
-
If you encounter any problems or have questions, please:
|
|
328
|
-
|
|
329
|
-
1. Check the [documentation](https://github.com/uecsio/pages-api#readme)
|
|
330
|
-
2. Search [existing issues](https://github.com/uecsio/pages-api/issues)
|
|
331
|
-
3. Create a [new issue](https://github.com/uecsio/pages-api/issues/new)
|
|
332
|
-
|
|
333
|
-
## 🔄 Changelog
|
|
334
|
-
|
|
335
|
-
### v1.0.0
|
|
336
|
-
- Initial release
|
|
337
|
-
- Full CRUD operations
|
|
338
|
-
- TypeORM integration
|
|
339
|
-
- Swagger documentation
|
|
340
|
-
- Validation support
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consts/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consts/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-page.dto.d.ts","sourceRoot":"","sources":["../../src/dto/create-page.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-page.dto.d.ts","sourceRoot":"","sources":["../../src/dto/create-page.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,aAAa;IAOxB,KAAK,EAAE,MAAM,CAAC;IASd,GAAG,EAAE,MAAM,CAAC;IAOZ,OAAO,EAAE,MAAM,CAAC;IAShB,SAAS,CAAC,EAAE,MAAM,CAAC;IASnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAQtB,eAAe,CAAC,EAAE,MAAM,CAAC;IASzB,MAAM,EAAE,MAAM,CAAC;IAQf,YAAY,CAAC,EAAE,IAAI,CAAC;IAQpB,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB"}
|
|
@@ -11,10 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CreatePageDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
|
-
const class_transformer_1 = require("class-transformer");
|
|
15
14
|
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
-
const utils_api_1 = require("@uecsio/utils-api");
|
|
17
|
-
const page_entity_1 = require("../entities/page.entity");
|
|
18
15
|
class CreatePageDto {
|
|
19
16
|
}
|
|
20
17
|
exports.CreatePageDto = CreatePageDto;
|
|
@@ -29,13 +26,12 @@ __decorate([
|
|
|
29
26
|
], CreatePageDto.prototype, "title", void 0);
|
|
30
27
|
__decorate([
|
|
31
28
|
(0, swagger_1.ApiProperty)({
|
|
32
|
-
description: 'The URL
|
|
33
|
-
example: '/welcome',
|
|
29
|
+
description: 'The URL of the page',
|
|
30
|
+
example: 'https://example.com/welcome',
|
|
34
31
|
maxLength: 255,
|
|
35
32
|
}),
|
|
36
33
|
(0, class_validator_1.IsString)(),
|
|
37
|
-
(0,
|
|
38
|
-
(0, utils_api_1.IsUniqueValue)(page_entity_1.Page, 'url'),
|
|
34
|
+
(0, class_validator_1.IsUrl)(),
|
|
39
35
|
__metadata("design:type", String)
|
|
40
36
|
], CreatePageDto.prototype, "url", void 0);
|
|
41
37
|
__decorate([
|
|
@@ -82,10 +78,7 @@ __decorate([
|
|
|
82
78
|
minimum: 0,
|
|
83
79
|
maximum: 2,
|
|
84
80
|
}),
|
|
85
|
-
(0,
|
|
86
|
-
(0, class_validator_1.IsInt)(),
|
|
87
|
-
(0, class_validator_1.Min)(0),
|
|
88
|
-
(0, class_validator_1.Max)(2),
|
|
81
|
+
(0, class_validator_1.IsNumber)(),
|
|
89
82
|
__metadata("design:type", Number)
|
|
90
83
|
], CreatePageDto.prototype, "status", void 0);
|
|
91
84
|
__decorate([
|
|
@@ -95,7 +88,7 @@ __decorate([
|
|
|
95
88
|
}),
|
|
96
89
|
(0, class_validator_1.IsOptional)(),
|
|
97
90
|
(0, class_validator_1.IsDateString)(),
|
|
98
|
-
__metadata("design:type",
|
|
91
|
+
__metadata("design:type", Date)
|
|
99
92
|
], CreatePageDto.prototype, "activateFrom", void 0);
|
|
100
93
|
__decorate([
|
|
101
94
|
(0, swagger_1.ApiPropertyOptional)({
|
|
@@ -104,6 +97,6 @@ __decorate([
|
|
|
104
97
|
}),
|
|
105
98
|
(0, class_validator_1.IsOptional)(),
|
|
106
99
|
(0, class_validator_1.IsDateString)(),
|
|
107
|
-
__metadata("design:type",
|
|
100
|
+
__metadata("design:type", Date)
|
|
108
101
|
], CreatePageDto.prototype, "activateTo", void 0);
|
|
109
102
|
//# sourceMappingURL=create-page.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-page.dto.js","sourceRoot":"","sources":["../../src/dto/create-page.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsF;AACtF,
|
|
1
|
+
{"version":3,"file":"create-page.dto.js","sourceRoot":"","sources":["../../src/dto/create-page.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsF;AACtF,6CAAmE;AAEnE,MAAa,aAAa;CA2EzB;AA3ED,sCA2EC;AApEC;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,wBAAwB;QACjC,SAAS,EAAE,GAAG;KACf,CAAC;IACD,IAAA,0BAAQ,GAAE;;4CACG;AASd;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,qBAAqB;QAClC,OAAO,EAAE,6BAA6B;QACtC,SAAS,EAAE,GAAG;KACf,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,uBAAK,GAAE;;0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|
5
|
-
metaTitle?: string;
|
|
6
|
-
metaKeywords?: string;
|
|
7
|
-
metaDescription?: string;
|
|
8
|
-
status?: number;
|
|
9
|
-
activateFrom?: string;
|
|
10
|
-
activateTo?: string;
|
|
1
|
+
import { CreatePageDto } from './create-page.dto';
|
|
2
|
+
declare const UpdatePageDto_base: import("@nestjs/mapped-types").MappedType<Partial<CreatePageDto>>;
|
|
3
|
+
export declare class UpdatePageDto extends UpdatePageDto_base {
|
|
4
|
+
id?: number;
|
|
11
5
|
}
|
|
6
|
+
export {};
|
|
12
7
|
//# sourceMappingURL=update-page.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-page.dto.d.ts","sourceRoot":"","sources":["../../src/dto/update-page.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-page.dto.d.ts","sourceRoot":"","sources":["../../src/dto/update-page.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;AAElD,qBAAa,aAAc,SAAQ,kBAA0B;IAQ3D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -10,104 +10,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.UpdatePageDto = void 0;
|
|
13
|
+
const mapped_types_1 = require("@nestjs/mapped-types");
|
|
13
14
|
const class_validator_1 = require("class-validator");
|
|
14
|
-
const class_transformer_1 = require("class-transformer");
|
|
15
15
|
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
class UpdatePageDto {
|
|
16
|
+
const create_page_dto_1 = require("./create-page.dto");
|
|
17
|
+
class UpdatePageDto extends (0, mapped_types_1.PartialType)(create_page_dto_1.CreatePageDto) {
|
|
19
18
|
}
|
|
20
19
|
exports.UpdatePageDto = UpdatePageDto;
|
|
21
20
|
__decorate([
|
|
22
21
|
(0, swagger_1.ApiPropertyOptional)({
|
|
23
|
-
description: 'The
|
|
24
|
-
example: 'Welcome to Our Website',
|
|
25
|
-
maxLength: 255,
|
|
26
|
-
}),
|
|
27
|
-
(0, class_validator_1.IsOptional)(),
|
|
28
|
-
(0, class_validator_1.IsString)(),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], UpdatePageDto.prototype, "title", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
33
|
-
description: 'The URL path of the page (without protocol and domain)',
|
|
34
|
-
example: '/welcome',
|
|
35
|
-
maxLength: 255,
|
|
36
|
-
}),
|
|
37
|
-
(0, class_validator_1.IsOptional)(),
|
|
38
|
-
(0, class_validator_1.IsString)(),
|
|
39
|
-
(0, utils_api_1.IsUrlPath)(),
|
|
40
|
-
(0, utils_api_1.IsUniqueValue)(page_entity_1.Page, 'url'),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], UpdatePageDto.prototype, "url", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
45
|
-
description: 'The main content of the page',
|
|
46
|
-
example: 'Welcome to our amazing website! We provide the best services...',
|
|
47
|
-
}),
|
|
48
|
-
(0, class_validator_1.IsOptional)(),
|
|
49
|
-
(0, class_validator_1.IsString)(),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], UpdatePageDto.prototype, "content", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
54
|
-
description: 'SEO meta title for the page',
|
|
55
|
-
example: 'Welcome Page - Best Services',
|
|
56
|
-
maxLength: 255,
|
|
57
|
-
}),
|
|
58
|
-
(0, class_validator_1.IsOptional)(),
|
|
59
|
-
(0, class_validator_1.IsString)(),
|
|
60
|
-
__metadata("design:type", String)
|
|
61
|
-
], UpdatePageDto.prototype, "metaTitle", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
64
|
-
description: 'SEO meta keywords for the page',
|
|
65
|
-
example: 'welcome, services, website',
|
|
66
|
-
maxLength: 255,
|
|
67
|
-
}),
|
|
68
|
-
(0, class_validator_1.IsOptional)(),
|
|
69
|
-
(0, class_validator_1.IsString)(),
|
|
70
|
-
__metadata("design:type", String)
|
|
71
|
-
], UpdatePageDto.prototype, "metaKeywords", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
74
|
-
description: 'SEO meta description for the page',
|
|
75
|
-
example: 'Welcome to our website where you can find the best services...',
|
|
76
|
-
}),
|
|
77
|
-
(0, class_validator_1.IsOptional)(),
|
|
78
|
-
(0, class_validator_1.IsString)(),
|
|
79
|
-
__metadata("design:type", String)
|
|
80
|
-
], UpdatePageDto.prototype, "metaDescription", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
83
|
-
description: 'Page status (1: active, 0: inactive, 2: draft)',
|
|
22
|
+
description: 'The unique identifier of the page',
|
|
84
23
|
example: 1,
|
|
85
|
-
|
|
86
|
-
maximum: 2,
|
|
24
|
+
readOnly: true,
|
|
87
25
|
}),
|
|
88
26
|
(0, class_validator_1.IsOptional)(),
|
|
89
|
-
(0,
|
|
90
|
-
(0, class_validator_1.IsInt)(),
|
|
91
|
-
(0, class_validator_1.Min)(0),
|
|
92
|
-
(0, class_validator_1.Max)(2),
|
|
27
|
+
(0, class_validator_1.IsNumber)(),
|
|
93
28
|
__metadata("design:type", Number)
|
|
94
|
-
], UpdatePageDto.prototype, "
|
|
95
|
-
__decorate([
|
|
96
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
97
|
-
description: 'Date when the page becomes active',
|
|
98
|
-
example: '2024-01-01T00:00:00.000Z',
|
|
99
|
-
}),
|
|
100
|
-
(0, class_validator_1.IsOptional)(),
|
|
101
|
-
(0, class_validator_1.IsDateString)(),
|
|
102
|
-
__metadata("design:type", String)
|
|
103
|
-
], UpdatePageDto.prototype, "activateFrom", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
106
|
-
description: 'Date when the page becomes inactive',
|
|
107
|
-
example: '2024-12-31T23:59:59.999Z',
|
|
108
|
-
}),
|
|
109
|
-
(0, class_validator_1.IsOptional)(),
|
|
110
|
-
(0, class_validator_1.IsDateString)(),
|
|
111
|
-
__metadata("design:type", String)
|
|
112
|
-
], UpdatePageDto.prototype, "activateTo", void 0);
|
|
29
|
+
], UpdatePageDto.prototype, "id", void 0);
|
|
113
30
|
//# sourceMappingURL=update-page.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-page.dto.js","sourceRoot":"","sources":["../../src/dto/update-page.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"update-page.dto.js","sourceRoot":"","sources":["../../src/dto/update-page.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAmD;AACnD,qDAAuD;AACvD,6CAAsD;AACtD,uDAAkD;AAElD,MAAa,aAAc,SAAQ,IAAA,0BAAW,EAAC,+BAAa,CAAC;CAS5D;AATD,sCASC;AADC;IAPC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yCACC"}
|
|
@@ -39,7 +39,7 @@ __decorate([
|
|
|
39
39
|
example: 'https://example.com/welcome',
|
|
40
40
|
maxLength: 255,
|
|
41
41
|
}),
|
|
42
|
-
(0, typeorm_1.Column)({ length: 255
|
|
42
|
+
(0, typeorm_1.Column)({ length: 255 }),
|
|
43
43
|
__metadata("design:type", String)
|
|
44
44
|
], Page.prototype, "url", void 0);
|
|
45
45
|
__decorate([
|
|
@@ -121,6 +121,6 @@ __decorate([
|
|
|
121
121
|
__metadata("design:type", Date)
|
|
122
122
|
], Page.prototype, "updatedAt", void 0);
|
|
123
123
|
exports.Page = Page = __decorate([
|
|
124
|
-
(0, typeorm_1.Entity)(
|
|
124
|
+
(0, typeorm_1.Entity)()
|
|
125
125
|
], Page);
|
|
126
126
|
//# sourceMappingURL=page.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.entity.js","sourceRoot":"","sources":["../../src/entities/page.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAqG;AACrG,6CAAmE;AAG5D,IAAM,IAAI,GAAV,MAAM,IAAI;CA6FhB,CAAA;AA7FY,oBAAI;AAOf;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,gCAAsB,GAAE;;gCACd;AAQX;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,wBAAwB;QACjC,SAAS,EAAE,GAAG;KACf,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mCACV;AAQd;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,qBAAqB;QAClC,OAAO,EAAE,6BAA6B;QACtC,SAAS,EAAE,GAAG;KACf,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"page.entity.js","sourceRoot":"","sources":["../../src/entities/page.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAqG;AACrG,6CAAmE;AAG5D,IAAM,IAAI,GAAV,MAAM,IAAI;CA6FhB,CAAA;AA7FY,oBAAI;AAOf;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,I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AAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;KACX,CAAC;IACD,IAAA,gBAAM,GAAE;;oCACM;AAOf;IALC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,0BAA0B;KACpC,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACb,IAAI;0CAAC;AAOnB;IALC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,qCAAqC;QAClD,OAAO,EAAE,0BAA0B;KACpC,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACf,IAAI;wCAAC;AAQjB;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,0BAAgB,GAAE;8BACR,IAAI;uCAAC;AAQhB;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,qCAAqC;QAClD,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,0BAAgB,GAAE;8BACR,IAAI;uCAAC;eA5FL,IAAI;IADhB,IAAA,gBAAM,GAAE;GACI,IAAI,CA6FhB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export * from './pages.module';
|
|
2
|
-
export * from './services/pages.service';
|
|
3
2
|
export * from './dto/create-page.dto';
|
|
4
3
|
export * from './dto/update-page.dto';
|
|
5
4
|
export * from './entities/page.entity';
|
|
6
|
-
export * from './
|
|
5
|
+
export * from './consts';
|
|
7
6
|
export * from './migrations/migration.config';
|
|
8
7
|
export { Page } from './entities/page.entity';
|
|
9
8
|
export { CreatePageDto } from './dto/create-page.dto';
|
|
10
9
|
export { UpdatePageDto } from './dto/update-page.dto';
|
|
11
|
-
export { PagesService } from './services/pages.service';
|
|
12
10
|
export { PagesModule } from './pages.module';
|
|
13
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AAGzB,cAAc,+BAA+B,CAAC;AAG9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|