-
Notifications
You must be signed in to change notification settings - Fork 14
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
add ddo crud #99
add ddo crud #99
Conversation
Hi @an7e Just my 2 cents
|
@an7e Can you pull from main and resolve the conflicts? Also, it would help a lot if you could list the main changes in the description of PR when opening it |
sure, i'll do it |
@paulo-ocean any methods return document object or throw TypesenseError, you can see this by looking at methods types, idk maybe your ide not highlighting types |
…tionality # Conflicts: # src/@types/OceanNode.ts # src/index.ts
Well, i know that, my point is that your functions could explicitly have the return type, without having to look at the return types on the functions using the IDE :-). Maybe a boolean on create, and on delete, etc... In any case not a big deal. |
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.
Not gonna insist more here, but i think you could maintain things simpler man :-) ..
If you choose to return null on error, i would say that is fine (personally i would prefer a boolean is some cases, but that is just me) .. but why have an extra check on the error type? and still eventually throw an error?
why not something simpler as:
async create(ddo: Record<string, any>) {
try {
return await
this.provider.collections(this.schemes[0].name).documents().create(ddo)
} catch (error) {
// Maybe LOG the error? Why do we have a logger if we we don't use it :-)
return null
}
}
Anyway, not a deal breaker, just some opinions
@paulo-ocean The idea is that all Typesense errors are handled or return null, but if the error is not Typesense error but a system error, then it throws an error to top to let you know that something has gone wrong. If it doesn't make sense, it's no problem, I'll change it. |
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.
LGTM
As a suggestion , maybe you should try add 1 or 2 lines of comments once in a while, it doesn't hurt :-)
and logs :-) 👍
…tionality # Conflicts: # package.json # tests/unit/database.spec.ts # tests/unit/typesense.test.ts
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.
lgtm, let's merge, we can always solve issues later if we need to
PR for #48
Changes proposed in this PR: