diff --git a/packages/medusa/src/services/file.ts b/packages/medusa/src/services/file.ts new file mode 100644 index 0000000000..cc4121b218 --- /dev/null +++ b/packages/medusa/src/services/file.ts @@ -0,0 +1,50 @@ +import { MedusaError } from "medusa-core-utils" +import { EntityManager } from "typeorm" +import { + AbstractFileService, + FileServiceGetUploadStreamResult, + FileServiceUploadResult, + GetUploadedFileType, + UploadStreamDescriptorType, +} from "../interfaces" + +class DefaultFileService extends AbstractFileService { + upload(fileData: Express.Multer.File): Promise { + throw new MedusaError( + MedusaError.Types.UNEXPECTED_STATE, + "Please add a file service plugin in order to manipulate files in Medusa" + ) + } + delete(fileData: Record): void { + throw new MedusaError( + MedusaError.Types.UNEXPECTED_STATE, + "Please add a file service plugin in order to manipulate files in Medusa" + ) + } + getUploadStreamDescriptor( + fileData: UploadStreamDescriptorType + ): Promise { + throw new MedusaError( + MedusaError.Types.UNEXPECTED_STATE, + "Please add a file service plugin in order to manipulate files in Medusa" + ) + } + getDownloadStream( + fileData: GetUploadedFileType + ): Promise { + throw new MedusaError( + MedusaError.Types.UNEXPECTED_STATE, + "Please add a file service plugin in order to manipulate files in Medusa" + ) + } + getPresignedDownloadUrl(fileData: GetUploadedFileType): Promise { + throw new MedusaError( + MedusaError.Types.UNEXPECTED_STATE, + "Please add a file service plugin in order to manipulate files in Medusa" + ) + } + protected manager_: EntityManager + protected transactionManager_: EntityManager | undefined +} + +export default DefaultFileService