Skip to content

Commit 85a0efe

Browse files
authored
Merge pull request #3 from Stasia-sv/patch-1
feat(nest-json-api) update readme
2 parents 154b3cc + 6b89a99 commit 85a0efe

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

libs/json-api-nestjs/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Users } from 'database';
2525
})
2626
export class AppModule {}
2727
```
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:
2929

3030

3131
- GET /users
@@ -53,7 +53,7 @@ export interface ModuleOptions {
5353
};
5454
}
5555
```
56-
You can extend default controller:
56+
You can extend the default controller:
5757
```typescript
5858
import { Get, Param, Inject, BadRequestException } from '@nestjs/common';
5959

@@ -90,14 +90,14 @@ export class ExtendUserController extends JsonBaseController<Users> {
9090
}
9191
```
9292

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**
9595

9696
## Swagger UI
9797

9898
For using swagger, you should only add [@nestjs/swagger](https://docs.nestjs.com/openapi/introduction)
9999

100-
## Available end point method
100+
## Available endpoint method
101101
Using **Users** entity and relation **Roles** entity as example
102102

103103
include
@@ -107,28 +107,28 @@ include
107107
GET /users
108108
Available query params:
109109

110-
- **include** - you can extend result with relation(aka join)
110+
- **include** - you can extend result with relations (aka join)
111111
```
112112
GET /users?include=roles
113113
```
114114
result of request will have role relation for each **Users** item
115115

116-
- **fields** - you can specify needing filed of result query
116+
- **fields** - you can specify required fields of result query
117117

118118
- ```
119119
GET /users?fields[target]=login,lastName&fileds[roles]=name,key
120120
```
121121
The "target" is **Users** entity
122122
The "roles" is **Roles** entity
123123
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
125125

126126
- ```
127127
GET /users?sort=target.name,-roles.key
128128
```
129129
The "target" is **Users** entity
130130
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**.
132132
- **page** - pagination for you request
133133

134134
- ```
@@ -139,11 +139,11 @@ Available query params:
139139
- ```
140140
GET /users?filter[name][eq]=1&filter[roles.name][ne]=test&filter[roles.status][eq]=true
141141
```
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
144144
The "eq", "ne" is *[Filter operand](#filter-operand)*
145145

146-
So, this query will be transform like sql:
146+
So, this query will be transformed like sql:
147147
```sql
148148
WHERE users.name = 1 AND roles.name <> 'test' AND roles.status = true
149149
```

0 commit comments

Comments
 (0)