interfasys / mediametadata

A cloud application which provides CRUD access to the metadata stored in images
GNU Affero General Public License v3.0
5 stars 1 forks source link

Added an API for a logged in user to retrieve metadata from database #40

Closed imjalpreet closed 8 years ago

imjalpreet commented 8 years ago

@oparoz I have added the API for a logged in user.

Can you check if its correct?

imjalpreet commented 8 years ago

@oparoz Changes Done.

oparoz commented 8 years ago

You need to add the unit test to make sure things are working as expected.

In the next PR, you'll need to enable the API suite in Codeception to make sure the app is working as expected. Everything you need is in the Gallery app. You will need a shorter version of this to manage users and files: https://github.com/interfasys/galleryplus/blob/master/tests/_support/Helper/DataSetup.php

oparoz commented 8 years ago

Any string

imjalpreet commented 8 years ago

@oparoz I will again have to use setMapperResult, right?

If yes, then I have tried it but I am getting the following error:


1) MetadataControllerTest: Get metadata
 Test  tests/unit/Controller/MetadataControllerTest.php:testGetMetadata
Array (...) does not match expected type "NULL".
#1  /var/www/GSoC/apps/mediametadata/tests/unit/Controller/MetadataControllerTest.php:80
#2  OCA\MediaMetadata\Controller\MetadataControllerTest->testGetMetadata
oparoz commented 8 years ago

I will again have to use setMapperResult, right?

Not this time. You simply need to mock the service. It's much easier since it returns an array.

imjalpreet commented 8 years ago

@oparoz Done.

imjalpreet commented 8 years ago

@oparoz Done.

oparoz commented 8 years ago

CI didn't kick in. Could you please force push the last commit again?

oparoz commented 8 years ago

I'm merging this as-is because we're pressed for time and you need to enable the API suite, but try to think about what your service should do in case of error.

You could get:

All these will probably crash your app and we need to make it return an error message instead.

imjalpreet commented 8 years ago

@oparoz Yeah, I understand. I will try to think of all these errors and maybe make a list, so that I can add them afterwards.

oparoz commented 8 years ago

Thank you