@alevnyacow/nzmt 0.3.0 → 0.3.1
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 +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,6 +128,41 @@ const { result } = mathService.basicOperation({
|
|
|
128
128
|
|
|
129
129
|
Desribes module metadata. Metadata is used as an argument in `methods`.
|
|
130
130
|
|
|
131
|
+
### DTOs
|
|
132
|
+
|
|
133
|
+
Extracts all request and response DTOs for every method by `Metadata`.
|
|
134
|
+
|
|
135
|
+
Example:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { Module } from '@alevnyacow/nzmt'
|
|
139
|
+
|
|
140
|
+
const testMetadata = {
|
|
141
|
+
name: 'TestService',
|
|
142
|
+
schemas: {
|
|
143
|
+
testMethod: {
|
|
144
|
+
payload: z.object({
|
|
145
|
+
stringField: z.string()
|
|
146
|
+
}),
|
|
147
|
+
response: z.object({
|
|
148
|
+
result: z.boolean()
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
} satisfies Module.Metadata
|
|
153
|
+
|
|
154
|
+
type TestServiceDTOs = Module.DTOs<typeof testMetadata>
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* TestServiceDTOs:
|
|
158
|
+
* {
|
|
159
|
+
* testMethodPayload: { stringField: string }
|
|
160
|
+
* testMethodResponse: { result: boolean }
|
|
161
|
+
* }
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
```
|
|
165
|
+
|
|
131
166
|
## <a id='controller'></a>Controller
|
|
132
167
|
|
|
133
168
|
## <a id='store'></a>Store
|