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
chore: add beginTransaction API to declaration file #1752
Conversation
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.
@b-admike Good documentation 👍
I left a comment about the callback function's type. Otherwise LGTM
beginTransaction( | ||
options?: Options, | ||
callback?: Callback<Transaction>, | ||
): PromiseOrVoid<Transaction>; |
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.
Do we export Transaction
?
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.
Yes from transaction-mixin
and I believe we export it from juggler module too.
types/persisted-model.d.ts
Outdated
/** | ||
* Reload object from persistence. Requires `id` member of `object` to be able to call `find`. | ||
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required. | ||
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html). | ||
* @param {Object} instance Model instance. | ||
*/ | ||
reload( | ||
options?: Options, | ||
options?: string | Options, |
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.
Isn't string | Options
for beginTransaction
instead?
types/persisted-model.d.ts
Outdated
* @returns {Promise|undefined} Returns a callback promise. | ||
*/ | ||
beginTransaction( | ||
options?: Options, |
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.
string | Options
9633e2f
to
21a9d7f
Compare
21a9d7f
to
313925a
Compare
Actually I took the documentation from https://github.com/strongloop/loopback-datasource-juggler/blob/master/lib/transaction.js#L27-L73 😁 |
Description
Connect to loopbackio/loopback-next#2614. We need to add
beginTransaction()
to the persisted model declaration file in order to utilize it with LB4 repositories.Related issues
Checklist
guide