@alevnyacow/nzmt 0.15.6 → 0.15.7
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 +3 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,9 +100,7 @@ export const userStoreMetadata = {
|
|
|
100
100
|
name: 'UserStore'
|
|
101
101
|
} satisfies Store.Metadata
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
export type UserStore = Store.Contract<typeof userStoreMetadata>
|
|
103
|
+
...scaffolded code
|
|
106
104
|
```
|
|
107
105
|
|
|
108
106
|
Contracts are pretty self-explainatory, but let's break this down anyway.
|
|
@@ -129,13 +127,7 @@ Second file is a `Prisma` implementation:
|
|
|
129
127
|
```ts
|
|
130
128
|
/** /server/stores/users/user.store.prisma */
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
import { DITokens } from '@/server/di'
|
|
134
|
-
import { injectable, inject } from 'inversify'
|
|
135
|
-
import { Store } from '@alevnyacow/nzmt'
|
|
136
|
-
import { type UserStore, userStoreMetadata } from './user.store'
|
|
137
|
-
|
|
138
|
-
type Types = Store.Types<UserStore>
|
|
130
|
+
...scaffolded code
|
|
139
131
|
|
|
140
132
|
const mappers = {
|
|
141
133
|
toFindOnePayload: (source: Types['findOnePayload']): Prisma.UserWhereUniqueInput => {
|
|
@@ -172,7 +164,7 @@ const mappers = {
|
|
|
172
164
|
|
|
173
165
|
@injectable()
|
|
174
166
|
export class UserPrismaStore implements UserStore {
|
|
175
|
-
..scaffolded
|
|
167
|
+
..scaffolded code
|
|
176
168
|
```
|
|
177
169
|
|
|
178
170
|
Pretty cool, right? All you need to do is implementing `mappers` and in the vast majority of cases it's enough to have working `Prisma` store. And even more - `RAM` implementation works out of the box! ✨
|