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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-drive",
3
- "version": "1.0.0-alpha.59",
3
+ "version": "1.0.0-alpha.60",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "module": "./src/index.ts",
@@ -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.findFirst({
319
+ const result = await (tx ?? this.db).document.findUnique({
325
320
  where: {
326
- id: id,
327
- driveId: driveId
321
+ id_driveId: {
322
+ driveId,
323
+ id
324
+ }
328
325
  },
329
326
  include: {
330
327
  operations: {