Commit 0da439f2 authored by Omar Luna Hernández's avatar Omar Luna Hernández
Browse files

Se cambio el dato que regresa la funcion de getPDFByPoints que antes era un...

Se cambio el dato que regresa la funcion de getPDFByPoints que antes era un string de base64 y ahora es un blob
parent e54e637c
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
import axios from "axios";
import { Buffer } from "buffer";
import { PoiDatasourceInf } from "../poi_datasource";
import { PointOfInterest } from "./entities/poi";
import { APIUrl } from "../../../core/constants/api_url";
@@ -91,9 +90,9 @@ export class POIDatasourceProd implements PoiDatasourceInf {
   * Generates a PDF for the specified points of interest.
   * @param idPlace - The ID of the place.
   * @param pointsId - An array of point IDs to include in the PDF.
   * @returns A promise that resolves to a base64-encoded string of the PDF.
   * @returns A promise that resolves to a Blob containing the PDF data.
   */
  async getPDFByPoints(idPlace: number, pointsId: number[]): Promise<string> {
  async getPDFByPoints(idPlace: number, pointsId: number[]): Promise<Blob> {
    const { data } = await axios.get(
      APIUrl + API_ROUTE_PLACE + `/${idPlace}` + API_ROUTE_POINT + "/generate",
      {
@@ -103,6 +102,6 @@ export class POIDatasourceProd implements PoiDatasourceInf {
        responseType: "arraybuffer",
      }
    );
    return Buffer.from(data, "binary").toString("base64");
    return new Blob([data], { type: "application/pdf" });
  }
}
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ export interface PoiDatasourceInf {
   * Retrieves a PDF document containing information about specified POIs.
   * @param idPlace - The ID of the place.
   * @param pointsId - An array of POI IDs.
   * @returns A promise that resolves to a string representing the PDF document.
   * @returns A promise that resolves to a Blob containing the PDF data.
   */
  getPDFByPoints(idPlace: number, pointsId: number[]): Promise<string>;
  getPDFByPoints(idPlace: number, pointsId: number[]): Promise<Blob>;
}
+2 −2
Original line number Diff line number Diff line
@@ -39,9 +39,9 @@ export class POIRepositoryProd implements PoiRepositoryInf {
   * Retrieves a PDF document for the given points of interest.
   * @param idPlace - The ID of the place.
   * @param pointsId - An array of point IDs.
   * @returns A promise that resolves to a string representing the PDF document.
   * @returns A promise that resolves to a Blob containing the PDF data.
   */
  async getPDFByPoints(idPlace: number, pointsId: number[]): Promise<string> {
  async getPDFByPoints(idPlace: number, pointsId: number[]): Promise<Blob> {
    return this.datasouce.getPDFByPoints(idPlace, pointsId);
  }
}
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ export interface PoiRepositoryInf {
   * Retrieves a PDF containing information about specified POIs.
   * @param idPlace - The ID of the place.
   * @param pointsId - An array of POI IDs.
   * @returns A promise that resolves to a string representing the PDF.
   * @returns A promise that resolves to a Blob containing the PDF data.
   */
  getPDFByPoints(idPlace: number, pointsId: number[]): Promise<string>;
  getPDFByPoints(idPlace: number, pointsId: number[]): Promise<Blob>;
}