@@ -25,7 +25,7 @@ import { Users } from 'database';
25
25
})
26
26
export class AppModule {}
27
27
```
28
- After this, you have prepare crude with ready to use end point :
28
+ After this, you have to prepare CRUDs with ready-to- use endpoints :
29
29
30
30
31
31
- GET /users
@@ -53,7 +53,7 @@ export interface ModuleOptions {
53
53
};
54
54
}
55
55
```
56
- You can extend default controller:
56
+ You can extend the default controller:
57
57
``` typescript
58
58
import { Get , Param , Inject , BadRequestException } from ' @nestjs/common' ;
59
59
@@ -90,14 +90,14 @@ export class ExtendUserController extends JsonBaseController<Users> {
90
90
}
91
91
```
92
92
93
- You can overwrite default config for current controller using options in decorator ** JsonAPi** .
94
- The same you can mention api method needing for you, using ** allowMethod**
93
+ You can overwrite the default config for the current controller using options in the decorator ** JsonAPi** .
94
+ Also you can specify an API method necessary for you, using ** allowMethod**
95
95
96
96
## Swagger UI
97
97
98
98
For using swagger, you should only add [ @nestjs/swagger ] ( https://docs.nestjs.com/openapi/introduction )
99
99
100
- ## Available end point method
100
+ ## Available endpoint method
101
101
Using ** Users** entity and relation ** Roles** entity as example
102
102
103
103
include
@@ -107,28 +107,28 @@ include
107
107
GET /users
108
108
Available query params:
109
109
110
- - ** include** - you can extend result with relation (aka join)
110
+ - ** include** - you can extend result with relations (aka join)
111
111
```
112
112
GET /users?include=roles
113
113
```
114
114
result of request will have role relation for each ** Users** item
115
115
116
- - ** fields** - you can specify needing filed of result query
116
+ - ** fields** - you can specify required fields of result query
117
117
118
118
- ```
119
119
GET /users?fields[target]=login,lastName&fileds[roles]=name,key
120
120
```
121
121
The "target" is ** Users** entity
122
122
The "roles" is ** Roles** entity
123
123
So, result of request will be have only fields * login* and * lastName* for ** Users** entity and fields * name* and * key* for ** Roles** entity
124
- - ** sort** - you can sort result of request
124
+ - ** sort** - you can sort result of the request
125
125
126
126
- ```
127
127
GET /users?sort=target.name,-roles.key
128
128
```
129
129
The "target" is ** Users** entity
130
130
The "roles" is ** Roles** entity
131
- So, result of request will be sort filed * name* of ** Users** by * ASC* and filed * key* of ** Roles** entity by ** DESC** .
131
+ So, result of the request will be sorted by field * name* of ** Users** by * ASC* and field * key* of ** Roles** entity by ** DESC** .
132
132
- ** page** - pagination for you request
133
133
134
134
- ```
@@ -139,11 +139,11 @@ Available query params:
139
139
- ```
140
140
GET /users?filter[name][eq]=1&filter[roles.name][ne]=test&filter[roles.status][eq]=true
141
141
```
142
- The "name" is filed of ** Users** entity
143
- The "roles.name" is * name* filed of ** Roles** entity
142
+ The "name" is a field of ** Users** entity
143
+ The "roles.name" is * name* field of ** Roles** entity
144
144
The "eq", "ne" is * [ Filter operand] ( #filter-operand ) *
145
145
146
- So, this query will be transform like sql:
146
+ So, this query will be transformed like sql:
147
147
``` sql
148
148
WHERE users .name = 1 AND roles .name <> ' test' AND roles .status = true
149
149
```
0 commit comments