Enhance NestJS application with SWC builder configuration, add @nestjs/devtools-integration for development support, and refactor various components for improved readability. Update package dependencies and streamline import statements across multiple files.
This commit is contained in:
@@ -3,64 +3,12 @@ import { forwardRef, Inject, Injectable } from '@nestjs/common'
|
||||
import Delta, { Op } from 'quill-delta'
|
||||
import { MinioService } from '../Minio/minio.service'
|
||||
import { DocumentDelta } from './document.type'
|
||||
import { JSDOM } from 'jsdom'
|
||||
import { Logger } from '@nestjs/common'
|
||||
import { PrismaService } from 'src/Prisma/prisma.service'
|
||||
@Injectable()
|
||||
export class DocumentService {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||
private quill: any
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly minio: MinioService,
|
||||
public document: JSDOM,
|
||||
) {
|
||||
;(async () => {
|
||||
await this.loadQuill()
|
||||
})()
|
||||
}
|
||||
|
||||
private async loadQuill() {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
||||
const { window } = new JSDOM('<!doctype html><html><body></body></html>')
|
||||
const { navigator } = window
|
||||
const { Node } = window
|
||||
global.window = window
|
||||
global.document = window.document
|
||||
global.navigator = navigator
|
||||
global.Node = Node
|
||||
}
|
||||
|
||||
const { default: Quill } = await import('quill')
|
||||
this.quill = Quill
|
||||
}
|
||||
// TODO: maybe never do :)
|
||||
async handleOnChange(documentId: string, delta: DocumentDelta) {}
|
||||
|
||||
async handleOnSave(documentId: string) {}
|
||||
|
||||
async handleOnSync(documentId: string) {}
|
||||
|
||||
async requestSync(documentId: string, page?: number) {
|
||||
// using pubsub to broadcast to all clients
|
||||
// this.pubSub.publish(`document:sync:${documentId}`, {
|
||||
// documentId,
|
||||
// page,
|
||||
// })
|
||||
}
|
||||
|
||||
async clientRequestSave(documentId: string) {
|
||||
// using pubsub to broadcast to all clients
|
||||
// this.pubSub.publish(`document:save:${documentId}`, {
|
||||
// documentId,
|
||||
// })
|
||||
}
|
||||
|
||||
async serverRequestSave(documentId: string) {}
|
||||
|
||||
async generatePreviewImage(documentId: string) {}
|
||||
|
||||
async allPageToDelta(documentId: string) {}
|
||||
|
||||
async toDocx(documentId: string) {}
|
||||
) {}
|
||||
}
|
||||
|
||||
// epess/documents/<id>/<page>
|
||||
|
||||
Reference in New Issue
Block a user