document-drive 1.0.0-alpha.68 → 1.0.0-alpha.69
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/server/types.ts +4 -0
- package/src/storage/prisma.ts +13 -0
package/package.json
CHANGED
package/src/server/types.ts
CHANGED
|
@@ -161,6 +161,10 @@ export abstract class BaseDocumentDriveServer {
|
|
|
161
161
|
options?: GetDocumentOptions
|
|
162
162
|
): Promise<DocumentDriveDocument>;
|
|
163
163
|
|
|
164
|
+
abstract getDriveBySlug(
|
|
165
|
+
slug: string,
|
|
166
|
+
): Promise<DocumentDriveDocument>;
|
|
167
|
+
|
|
164
168
|
abstract getDocuments(drive: string): Promise<string[]>;
|
|
165
169
|
abstract getDocument(
|
|
166
170
|
drive: string,
|
package/src/storage/prisma.ts
CHANGED
|
@@ -329,6 +329,9 @@ export class PrismaStorage implements IDriveStorage {
|
|
|
329
329
|
|
|
330
330
|
async getDocuments(drive: string) {
|
|
331
331
|
const docs = await this.db.document.findMany({
|
|
332
|
+
select: {
|
|
333
|
+
id: true
|
|
334
|
+
},
|
|
332
335
|
where: {
|
|
333
336
|
AND: {
|
|
334
337
|
driveId: drive,
|
|
@@ -513,11 +516,21 @@ export class PrismaStorage implements IDriveStorage {
|
|
|
513
516
|
}
|
|
514
517
|
|
|
515
518
|
async deleteDrive(id: string) {
|
|
519
|
+
// delete drive documents and operations
|
|
516
520
|
await this.db.document.deleteMany({
|
|
517
521
|
where: {
|
|
518
522
|
driveId: id
|
|
519
523
|
}
|
|
520
524
|
});
|
|
525
|
+
|
|
526
|
+
// delete drive and associated slug
|
|
527
|
+
await this.db.drive.deleteMany({
|
|
528
|
+
where: {
|
|
529
|
+
id
|
|
530
|
+
}
|
|
531
|
+
})
|
|
532
|
+
|
|
533
|
+
// delete drive itself
|
|
521
534
|
await this.deleteDocument('drives', id);
|
|
522
535
|
}
|
|
523
536
|
|