File

lib/common/file/file.constants.ts

Description

Abstract class representing the file management service.

Index

Methods

Methods

Abstract createOrUpdateFile
createOrUpdateFile(file: Buffer, extension: string, isPublic: boolean, code?: string, existedEntityId?: number, name?: string)
Parameters :
Name Type Optional
file Buffer No
extension string No
isPublic boolean No
code string Yes
existedEntityId number Yes
name string Yes
Abstract findByCode
findByCode(code: string)
Parameters :
Name Type Optional
code string No
Abstract findFileById
findFileById(id: number)
Parameters :
Name Type Optional
id number No
Abstract findPrivateById
findPrivateById(id: number)
Parameters :
Name Type Optional
id number No
Abstract findPublicById
findPublicById(id: number)
Parameters :
Name Type Optional
id number No
Abstract getFilePath
getFilePath(file: File)
Parameters :
Name Type Optional
file File No
Returns : Promise<string>
Abstract remove
remove(id: number)
Parameters :
Name Type Optional
id number No
import { FileEntity } from "./entity/file.entity";
import { FileMetadataEntity } from "./entity/file-metadata.entity";
import { File } from "./file.types";

/**
 * Abstract class representing the file management service.
 */
export abstract class FileManager {
  abstract createOrUpdateFile(
    file: Buffer,
    extension: string,
    isPublic: boolean,
    code?: string,
    existedEntityId?: number,
    name?: string,
  ): Promise<FileEntity>;

  abstract findByCode(code: string): Promise<FileEntity>;

  abstract findFileById(id: number): Promise<FileEntity>;

  abstract findPublicById(id: number): Promise<FileEntity>;

  abstract findPrivateById(id: number): Promise<FileEntity>;

  abstract getFilePath(file: File): Promise<string>;

  abstract remove(id: number): Promise<FileEntity>;
}

/**
 * Abstract class representing the file metadata service.
 */
export abstract class FileMd {
  abstract createFileMetadataEntity(
    buf: Buffer,
    filePath?: string,
  ): Promise<FileMetadataEntity>;
}

results matching ""

    No results matching ""