Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload image with recipe creating / update instead of selecting it from nextcloud data #727

Open
Teifun2 opened this issue May 24, 2021 · 8 comments
Assignees
Labels
Backend Issue or PR related to the backend code dependent enhancement New feature or request php Pull requests that update Php code

Comments

@Teifun2
Copy link
Collaborator

Teifun2 commented May 24, 2021

Is your feature request related to a problem? Please describe.
I develop one of the mobile apps. I see the use-case that some people would like to create a new recipe with an image they just took / they are gone take at the moment. In this instances it would be good if the image would not need to be uploaded to nextcloud already.

Describe the solution you'd like
It would be nice if it were possible to directly upload an image with the post request to create or edit a recipe. So that instead of providing the relative path to the image on nextcloud you provide the binary data of the image and it gets saved directly into the recipe folder / or if easier in some sort of cookbook upload folder.

Describe alternatives you've considered
I could implement a 2 step recipe creation that first uploads the image and then automatically ads the path in the create / edit request.


Depends on #1126

@Teifun2 Teifun2 added the enhancement New feature or request label May 24, 2021
@christianlupus
Copy link
Collaborator

How would you like the binary data to be sent in the same request as the main recipe data? base64 encoded?

I'd rather have a 2-step creation although we could first create the recipe without an image attached and then add a new API endpoint to add a (binary) image to an existing recipe. Would that work?

Before updating the API, I would suggest ironing out some wrinkles in the current API so that we can extend more easily. Would that work or is this more pressing?

@christianlupus
Copy link
Collaborator

I uploaded an updated version of the API specs for discussion (and later implementation). It can be found here.

For simpler communication and discussion, one can use this URL to tweak the API definition.

The update of the API might be due soon but this enhancement here is only a minor update and can be incorporated with the other updates.

Any opinions on it?

@Teifun2
Copy link
Collaborator Author

Teifun2 commented Oct 1, 2021

Ahh swagger looks nice :)

So what do you suggest? To already include the change?

@christianlupus
Copy link
Collaborator

My suggestion is as follows: we first decide on an API structure. Then we can work towards this based on the open API specs.

Once, we are ready with the API, we can implement it in the next version of the cookbook app. Regarding the refactoring of the API endpoints, I would think this can also be done later, so the 3rd party authors can start working on the new features. The renaming of the endpoints should be no problem later (with a period of deprecation and enough time to adopt to the changes).

So, the question would be off the new API endpoint will help you achieve your desired result to upload an image accordingly or not. If no, please be more specific, what needs to be changed. 😁

@redtux
Copy link

redtux commented Dec 12, 2021

Hi, I would like to ask what the status of this API change is. It would be great if we could upload images while creating a new recipe. Thanks both of you, and keep up the good work!

@christianlupus
Copy link
Collaborator

christianlupus commented Dec 14, 2021

I am just working to move the image management from the RecipeService class which is completely bloated into its own class. That should allow us to create the app endpoints quickly.

@christianlupus christianlupus added Backend Issue or PR related to the backend code php Pull requests that update Php code labels Jan 21, 2022
@christianlupus christianlupus self-assigned this Jul 4, 2022
@christianlupus christianlupus added this to the Release 0.9.14 milestone Jul 4, 2022
@github-actions
Copy link

This PR/issue depends on:

@Leptopoda
Copy link
Member

Having done a lot of work on the api side and it's implementation into the aforementioned app from @Teifun2 I don't think the proposed post request on the image endpoint would be enough.

Clients might have spotty connectivity and this might lead to the recipe creation going through while the image upload (a potentially heavier task) might fail (the same applies to the recipe update process). Therefore I suggest to also add an optional field to the recipe create endpoint (currently named /api/v1/recipes). This could be an optional second parameter that doesn't need to be implemented into the Recipe object.

Also any update to the mentioned transition? Any idea on when we can expect this?
I'd love to help but I'm not native in php :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Issue or PR related to the backend code dependent enhancement New feature or request php Pull requests that update Php code
Projects
None yet
Development

No branches or pull requests

4 participants