import { connect } from "mongoose";
import FileServer from "../../Models/Files/Files";
import { UploadFileResponse, UploadPostFileParams } from "src/Models/Files/Files.Interface";

export class FilesService {
    public async uploadPostFile(data: UploadPostFileParams): Promise<UploadFileResponse> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return await FileServer.uploadPostFile(data);
    }

    public async downloadFile(objectName: string): Promise<Buffer> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return await FileServer.downloadFile(objectName);
    }
}
