feat: Add local file provider and wire everything up in the file module (#7134)

This commit is contained in:
Stevche Radevski
2024-04-24 10:59:58 +02:00
committed by GitHub
parent fe68b5c0f2
commit 614d659a59
35 changed files with 684 additions and 49 deletions
+12
View File
@@ -11,3 +11,15 @@ export interface FileDTO {
*/
url: string
}
/**
* @interface
*
* Filters to apply on a currency.
*/
export interface FilterableFileProps {
/**
* The file ID to filter by.
*/
id?: string
}
+2 -2
View File
@@ -13,7 +13,7 @@ export interface CreateFileDTO {
mimeType: string
/**
* The file content
* The file content as a binary-encoded string
*/
content: Blob
content: string
}
+2 -2
View File
@@ -63,9 +63,9 @@ export type ProviderUploadFileDTO = {
mimeType: string
/**
* The file content
* The file content as a binary-encoded string
*/
content: Blob
content: string
}
/**
+35 -1
View File
@@ -1,5 +1,5 @@
import { IModuleService } from "../modules-sdk"
import { FileDTO } from "./common"
import { FileDTO, FilterableFileProps } from "./common"
import { FindConfig } from "../common"
import { Context } from "../shared-context"
import { CreateFileDTO } from "./mutations"
@@ -82,4 +82,38 @@ export interface IFileModuleService extends IModuleService {
config?: FindConfig<FileDTO>,
sharedContext?: Context
): Promise<FileDTO>
/**
* This method is used to retrieve a file by ID, similarly to `retrieve`. Enumeration of files is not supported, but the list method is in order to support remote queries
*
* @param {FilterableFileProps} filters - The filters to apply on the retrieved files.
* @param {FindConfig<FileDTO>} config -
* The configurations determining how the files are retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a file.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<FileDTO[]>} The list of files. In this particular case, it will either be at most one file.
*
*/
list(
filters?: FilterableFileProps,
config?: FindConfig<FileDTO>,
sharedContext?: Context
): Promise<FileDTO[]>
/**
* This method is used to retrieve a file by ID, similarly to `retrieve`. Enumeration of files is not supported, but the listAndCount method is in order to support remote queries
*
* @param {FilterableFileProps} filters - The filters to apply on the retrieved files.
* @param {FindConfig<FileDTO>} config -
* The configurations determining how the files are retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a file.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[FileDTO[], number]>} The list of files and their count. In this particular case, it will either be at most one file.
*
*/
listAndCount(
filters?: FilterableFileProps,
config?: FindConfig<FileDTO>,
sharedContext?: Context
): Promise<[FileDTO[], number]>
}