Skip to content
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

Merged
merged 1 commit into from Jun 24, 2019

Conversation

b-admike
Copy link
Contributor

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

  • connect to <link_to_referenced_issue>

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

Copy link
Contributor

@jannyHou jannyHou left a 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

types/persisted-model.d.ts Outdated Show resolved Hide resolved
beginTransaction(
options?: Options,
callback?: Callback<Transaction>,
): PromiseOrVoid<Transaction>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we export Transaction?

Copy link
Contributor Author

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.

/**
* 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,
Copy link
Contributor

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?

* @returns {Promise|undefined} Returns a callback promise.
*/
beginTransaction(
options?: Options,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string | Options

@b-admike b-admike force-pushed the update/ds-declaration-file branch 2 times, most recently from 9633e2f to 21a9d7f Compare June 24, 2019 21:14
@b-admike
Copy link
Contributor Author

@b-admike Good documentation 👍
I left a comment about the callback function's type. Otherwise LGTM

Actually I took the documentation from https://github.com/strongloop/loopback-datasource-juggler/blob/master/lib/transaction.js#L27-L73 😁

@b-admike b-admike merged commit 5539ef7 into master Jun 24, 2019
@delete-merged-branch delete-merged-branch bot deleted the update/ds-declaration-file branch June 24, 2019 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants