document-drive 1.0.0-alpha.59 → 1.0.0-alpha.60
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/package.json +1 -1
- package/src/storage/prisma.ts +5 -8
package/package.json
CHANGED
package/src/storage/prisma.ts
CHANGED
|
@@ -162,11 +162,6 @@ export class PrismaStorage implements IDriveStorage {
|
|
|
162
162
|
operations: Operation[],
|
|
163
163
|
header: DocumentHeader
|
|
164
164
|
): Promise<void> {
|
|
165
|
-
const document = await this.getDocument(drive, id, tx);
|
|
166
|
-
if (!document) {
|
|
167
|
-
throw new Error(`Document with id ${id} not found`);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
165
|
try {
|
|
171
166
|
await tx.operation.createMany({
|
|
172
167
|
data: operations.map(op => ({
|
|
@@ -321,10 +316,12 @@ export class PrismaStorage implements IDriveStorage {
|
|
|
321
316
|
}
|
|
322
317
|
|
|
323
318
|
async getDocument(driveId: string, id: string, tx?: Transaction) {
|
|
324
|
-
const result = await (tx ?? this.db).document.
|
|
319
|
+
const result = await (tx ?? this.db).document.findUnique({
|
|
325
320
|
where: {
|
|
326
|
-
|
|
327
|
-
|
|
321
|
+
id_driveId: {
|
|
322
|
+
driveId,
|
|
323
|
+
id
|
|
324
|
+
}
|
|
328
325
|
},
|
|
329
326
|
include: {
|
|
330
327
|
operations: {
|