CenterForDigitalHumanities / TPEN-services

Services required by TPEN interfaces in order to interact with data
1 stars 0 forks source link

WIP on issue 95-create-new-project-layers-in-databases #104

Closed Sandeep-1-Kumar closed 3 months ago

Sandeep-1-Kumar commented 4 months ago

Extract the necessary information from the request payload, including the label, creator, and items (annotation pages). Use the AnnotationCollectionFactory function to create the annotation collection based on the extracted information. Iterate over the items in the payload and use the AnnotationPageFactory function to create the annotation pages associated with the annotation collection. Save the newly created annotation collection and pages to the "tiny" database. Update the project's layers array with the ID of the newly created annotation collection.

Sandeep-1-Kumar commented 4 months ago

The postman scrn shot. image

Succesfully adding the annotation collection to project layers in local MongoDB image

Sandeep-1-Kumar commented 4 months ago

Please add /addLayer endpoint the URL In the issue it is mentioned to route URL : http://localhost:3009/project/abcdefg111222333/addLayer

thehabes commented 4 months ago

@Sandeep-1-Kumar The ability to retrieve a project by id is within your scope. There must exist a project that you access to make this change. A successful result of /addLayer means when I GET the project (by id) that you added the layer to, I see that layer. I cannot complete the end to end demo unless I am able to GET a project by its id.

thehabes commented 4 months ago

@Sandeep-1-Kumar Another way to say it is that you are missing this step

image

The object in mongo does not have layers

image

The object you create does not point back to the object id, which is 'abcdefg111222333' and not 'hex' image

thehabes commented 4 months ago

Ahh I see it tricked you because that project did not have the "layers" property to begin with. I made another one and did the test again, and that one got your layer. { "_id": "66269be6b9a635de8efb4bef", "@type": "Project", "name": "Test Project -- Updated", "layers": [ "https://store.rerum.io/v1/id/bzy0DprpgneWObJy" ] } However, that URI is not what I expect. The function had created a layer with the id "https://devstore.rerum.io/v1/id/6626b0ade8afc731e3b58db3" which is what should be there.

Sandeep-1-Kumar commented 4 months ago

GET is updated and working : http://localhost:3009/project/abcdefg111222333 image

Sandeep-1-Kumar commented 4 months ago

All my test cases are passing because i have this project in my local Mongo DB : "abcdefg111222333"

Sandeep-1-Kumar commented 4 months ago

I had fixed this @thehabes and waiting on your review, Thank you.

thehabes commented 3 months ago

You do have some tests! They just aren't quite right because they are passing for non-functional code, and you are missing the exists test. Make sure you meet the minimum functional requirements and test them before taking this out of Draft.

cubap commented 3 months ago

Tests pass and the app does start up. However, I've run into unexpected behavior. This call succeeds with a 201 and says it create this collection https://devstore.rerum.io/v1/id/3OOsk4LJGsCE4B9V

This is bizarre. That is not even a hexstring.