SAP-archive / cloud-foundry-cap-azure-cities

Reference application built according to the SAP Cloud Application Programming Model. It uses an SAP HANA database for structured data, an Azure storage account for unstructured data, and SAP Fiori Elements for the user interface.
Apache License 2.0
18 stars 32 forks source link

Implement media handling in CAP #4

Closed gregorwolf closed 3 years ago

gregorwolf commented 5 years ago

Hi @IObert

currently you're handling the upload to the Azure file storage via a custom handler outside the CAP service. Perhaps you can follow the example of @pdominique and implement the handling of the attachments directly in CAP as he did for AWS S3 in the project: cap-media-node.

Thanks you in advance in the name of the CAP Community.

CU Gregor

IObert commented 5 years ago

Hi Gregor,

thanks for opening this issue. I was thinking the same when I saw his blog post yesterday :)

I agree that the current implementation is not optimal as it still stores the link to the image. I only tested Pierre's approach briefly, but I think there are a couple of downsides to it.

Maybe there's a way to combine both approaches. I'll try to have a closer look after TechEd BLR

pdominique commented 5 years ago

Hi Marius,

My example app is clearly not complete and batch might not work. It's just a way to get started. The image however is definitely not stored in the db but in s3, the only thing stored in the db is the ID.

Regarding the approach to get the file from s3, there are different approaches and the one I used might not be the best one depending on your requirements. Storing the URL might be a valid option depending on your security model for instance.

Cheers, Pierre

IObert commented 5 years ago

Hi Pierre,

please don't get me wrong, I didn't want to criticize your project/post. I think what you've done is great. Thanks for the clarification that the image is not stored in HANA. I always thought that the on-update hook is simply called before the object gets stored as is (I learned sth new now :) ).

For this scenario, I think it would be ideal if there were a way a "add" the image field to the OData service only (maybe there already is away and I don't know it yet). E.g. that it isn't part of the table definition at all. But that's sth I'll investigate when coming back from TechEd.

Regards, Marius

pdominique commented 5 years ago

Hi Pierre,

please don't get me wrong, I didn't want to criticize your project/post. I think what you've done is great. Thanks for the clarification that the image is not stored in HANA. I always thought that the on-update hook is simply called before the object gets stored as is (I learned sth new now :) ).

For this scenario, I think it would be ideal if there were a way a "add" the image field to the OData service only (maybe there already is away and I don't know it yet). E.g. that it isn't part of the table definition at all. But that's sth I'll investigate when coming back from TechEd.

Regards, Marius

Kein Problem.

Defining content as a virtual element doesn't seem to be an issue and this way there's no empty column in the db:

entity Pictures {
  key ID : UUID;
  @Core.MediaType: mediaType
  virtual content : LargeBinary;
  @Core.IsMediaType: true
  mediaType : String;
}

Cheers, Pierre

IObert commented 3 years ago

We're about to archive this project soon, which is why I'll close this issue as well.