nicot 1.0.9 → 1.0.10
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 +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,3 +95,33 @@ export class UserController {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
```
|
|
98
|
+
|
|
99
|
+
## Return message
|
|
100
|
+
|
|
101
|
+
Return data of all APIs are in the following format, with proper OpenAPI documentation:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
export interface ReturnMessage<T> {
|
|
105
|
+
statusCode: number;
|
|
106
|
+
message: string;
|
|
107
|
+
success: boolean;
|
|
108
|
+
data: T;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You may also create a Dto class like this by the following way:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
export class UserReturnMessage extends ReturnMessageDto(User) {}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
With result into the following class, also with proper OpenAPI documentation:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
export class UserReturnMessage {
|
|
122
|
+
statusCode: number;
|
|
123
|
+
message: string;
|
|
124
|
+
success: boolean;
|
|
125
|
+
data: User;
|
|
126
|
+
}
|
|
127
|
+
```
|
package/package.json
CHANGED