Fetching products with filenames
A creative approach will be needed to fetch the filenames.
@EventSubscriber()
export class ProductsSubscriber implements EntitySubscriberInterface<Product> {
constructor(private readonly dataSource: DataSource) {
dataSource.subscribers.push(this);
}
listenTo() {
return Product;
}
}private async getImagesFilenames(id: number) {
const { BASE, IMAGES } = FilePath.Products;
const path = join(BASE, id.toString(), IMAGES);
if (!(await pathExists(join(BASE_PATH, path)))) return;
return this.storageService.getDirFilenames(path);
}Last updated