-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat: Lookup requests for BB API #293
Conversation
For the relationships lookup endpoint:
The response:
From that info, I can reconstitute the relationship: If I queried the Author relationships, I would find:
"Author" - "6d5c4a15-3d08-41bc-9bbf-c5fd2dbebf52" - "wrote" - "Work" - "ba446064-90a5-447b-abe5-139be547da2e" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relationships are looking goo so far !
Minor changes below.
I also wonder if
"relationshipType": {
"name": "Author",
"id": 8
}
would be better expressed as
"relationshipTypeName": "Author",
"relationshipTypeId": 8
What do you think?
Hello @MonkeyDo, Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything is working nicely!
Hello @MonkeyDo , error:
` |
That usually means you need to first insert another element that the relationship schema depends on. So in create-entity, where you insert a relationship, you need to make sure the bbids refer to existing entity. So in createRelationshipSet you'll want to first call the methods to create entities (createWork, createAuthor, etc) depending on the relationship source and target types you want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see the documentation shaping up!
Can't wait to see the swagger integration and the documentation and examples of the API endpoints!
@MonkeyDo thanks for detailed review. I will refactor all ASAP. |
@akhilesh For documenting the API routes, I suggest using a combination of jsdoc, swagger (OpenAPI specification) and expressJS. This article explains how to set it up: http://www.acuriousanimal.com/2018/10/20/express-swagger-doc.html You'll also want to read more about the swagger-jsdoc package for the syntax to use (a little bit different from regular jsdoc) : https://github.com/Surnet/swagger-jsdoc/blob/master/docs/GETTING-STARTED.md |
Hello @MonkeyDo , |
Hello @MonkeyDo, |
This was a very easy fix that only took me two minutes. I wish you were a bit more independant and try to resolve the issues you encounter yourself. In this case, you would have found an answer to your problem in the first section of the swagger-jsdoc "getting started" guide: [EDIT]: sorry, I just saw the other docs on swaggerhub, disregard this comment |
Thanks, @MonkeyDo for resolving the issue. |
Hello @MonkeyDo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few corrections, but not much. Overall this is good work, clean and clear.
You can go ahead and document the other endpoints in the same way.
So that a user can use a relationship's targetEntityType directly without having to modify it (Work -> work, EditionGroup -> edition-group)
Hi @MonkeyDo, |
Yes, I'm afraid you did a merge instead of a rebase, or if you did a rebase, you pulled/pushed instead of force-pushing. You have to remember the process (it took me a long time to get comfortable with it…):
What happened, I believe is that at step 4/5 you did If you're using GitHub Desktop instead of the terminal, make sure you're using the latest version. They recently added a "Force push" button (instead of the usual pull&push) when you finish a rebase. |
@akhilesh26 I was able to clean up the commit history, after a bit of thinking and trying things. I always welcome an occasion to learn more and test my git skills. Here's what I did:
Rewriting history on a branch that is public is usually a no-no. However, in this case since it is only the two of us working here, I can tell you that I have done a history rewrite, and you may have to delete your local branch and check it out again. |
It defaults to the root of where the server is running
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a final review, I believe this is ready to merge ! 💥 🎉
Well done @akhilesh26 ! |
BB API
Run this initial setup for BB API.
Install dependencies using
npm install
To check the endpoint, run the project without docker with
npm run start-api
.Endpoints implemented:
http://localhost:9098/<entity>/<bbid>
http://localhost:9098/<entity>/<bbid>/aliases
http://localhost:9098/<entity>/<bbid>/identifiers
To run the tests of api use
npm test ./test/src/api