Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Bulk api status #6

Merged
merged 11 commits into from
Mar 30, 2018
Merged

Conversation

anvasiliev
Copy link

@anvasiliev anvasiliev commented Mar 20, 2018

Current Pull Request will add Status API functionality for module AsynchronousOperations.
After creating Bulk operation, Magento creates new UUID for this operation. To be able to track status of each operation was developer API.

REST api call example:
GET /V1/bulk/status-detailed/:UUID

Response will look like this:

{
  "operations_list": [
    {
      "id": 0,
      "topic_name": "string",
      "status": 0,
      "result_serialized_data": "string",
      "result_message": "string",
      "error_code": 0
    }
  ],
  "operations_counter": {
    "operations_total": 0,
    "open": 0,
    "operations_successful": 0,
    "total_failed": 0,
    "failed_not_retriable": 0,
    "failed_retriable": 0,
    "rejected": 0
  },
  "extension_attributes": {},
  "bulk_id": "string",
  "description": "string",
  "start_time": "string",
  "user_id": 0,
  "operation_count": 0
}

REST api call example:
GET /V1/bulk/status-short/:UUID

Response will look like this.
Instead of get all operation entity data this resource give just operation status (e.g. without result_serialized_data, topic_name or extension_attributes):

{
  "operations_list": [
    {
      "id": 0,
      "status": 0,
      "result_message": "string",
      "error_code": 0
    }
  ],
  "operations_counter": {
    "operations_total": 0,
    "open": 0,
    "operations_successful": 0,
    "total_failed": 0,
    "failed_not_retriable": 0,
    "failed_retriable": 0,
    "rejected": 0
  },
  "extension_attributes": {},
  "bulk_id": "string",
  "description": "string",
  "start_time": "string",
  "user_id": 0,
  "operation_count": 0
}

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)


/**
* @api
* @since 100.3.0

Choose a reason for hiding this comment

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

No need to put @since annotation, it will be added automatically by release publication tools.

* @api
* @since 100.3.0
*/
interface BulkRepositoryInterface

Choose a reason for hiding this comment

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

Does not look like repository, which usually has CRUD operations. How about BlulkStatusInterface? Then methods could be named getStatus and getDetailedStatus.

* @api
* @since 100.3.0
*/
interface ShortInterface extends BulkSummaryInterface

Choose a reason for hiding this comment

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

Interfaces could be renamed to Api/Data/BulkStatusInterface and Api/Data/DetailedBulkStatusInterface

* @return \Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface|null
* @since 100.3.0
*/
public function getOperationsCounter();

Choose a reason for hiding this comment

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

Not clear why counter type is OperationDetailedInterface

use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;

/**
* Interface BulkStatusInterface

Choose a reason for hiding this comment

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

Please add proper description for all classes/interfaces, especially @api ones.

* @return int
* @since 100.3.0
*/
public function getOperationsTotal();

Choose a reason for hiding this comment

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

getTotalCount?

public function getOperationsTotal();

/**
* Open operations count

Choose a reason for hiding this comment

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

Please correct description

* @return int
* @since 100.3.0
*/
public function getOperationsSuccessful();

Choose a reason for hiding this comment

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

getSuccessfulCount?

* @return int
* @since 100.3.0
*/
public function getTotalFailed();

Choose a reason for hiding this comment

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

getFailedCount? And same pattern for the rest of the operations in the interface.

/**
* Upgrade the AsynchronousOperations module DB scheme
*/
class UpgradeSchema implements UpgradeSchemaInterface

Choose a reason for hiding this comment

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

New modules should have InstallSchema, not UpgradeSchema

@magento-engcom-team magento-engcom-team merged commit 5bff58b into magento:2.3-develop Mar 30, 2018
magento-engcom-team pushed a commit that referenced this pull request Jun 5, 2018
magento-engcom-team pushed a commit that referenced this pull request Jun 25, 2018
[Forwardport] Fixed syntax for before-after operators in less files.
magento-engcom-team pushed a commit that referenced this pull request Jul 18, 2018
magento-engcom-team pushed a commit that referenced this pull request Sep 13, 2018
[Forwardport] Translated validation error messages
magento-engcom-team pushed a commit that referenced this pull request Nov 29, 2018
2.3-develop branch upadate
magento-engcom-team pushed a commit that referenced this pull request Dec 21, 2018
magento-engcom-team pushed a commit that referenced this pull request Jan 4, 2019
magento-engcom-team pushed a commit that referenced this pull request Feb 10, 2019
Update 2.3-develop branch
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants