GET/PUT/POST/DELETE the Order which holds a collection of ordered items Entry point:

  • /api/stocks/orders/
    • GET/POST or create a new order (POSTing the detailed order object)
      • GET list all orders as seen below
      • POST create a new order by sending a single order and all ordered items. Both should not have any ID (they are ignored, except for the stock ID of course).
      {
        "results": [
          {
            "id": <generated_uuid>,
            "name": "Order Name",
            "created_by": <username>,
            (..)
            "odereditems": [
              {
                "id": <generated_uuid>,
                stock: {
                  "id": <uuid>,
                  "type": "CELLLINE",
                  "model": "SPECIMEN",
                  "name": "Stock Name"
                }
                stock_type: "SPECIMEN",
                quantity: 10,
                total_price: 20,
                (..)
              },
              (..)
            ]
          }
        ]
      }
      
  • /api/stocks/orders/<order_id>
    • GET/PUT/DELETE

      • GET single order
      • PUT to update a single order:
        • Any ordereditems not in the ordereditems list will be deleted.
        • Ordereditems without an ID will be newly created, with an ID they get updated.
      • DELETE a single order and its related ordereditems
      {
            "id": <generated_uuid>,
            "name": "Order Name",
            "created_by": <username>,
            (..)
            "odereditems": [
              {
                "id": <generated_uuid>,
                stock: {
                  "id": <uuid>,
                  "type": "CELLLINE",
                  "model": "SPECIMEN",
                  "name": "Stock Name"
                }
                stock_type: "SPECIMEN",
                quantity: 10,
                total_price: 20,
                (..)
              },
              (..)
            ]
          }
      
  • /api/stocks/orders/<order_id>/notify_stores
    • PUT
      • PUT send an email to the stores with an excel file containing all ordereditems as a list. The order will be marked as already being send to the stores.
» click to learn about Filtering, Ordering and more...

Accepted filters:

- id: ID (exact)
- created: Created (exact)
- modified: Modified (exact)
- name: Name starts with (istartswith)
- description: [invalid name] contains (icontains)
- query: Search filter on the name property (exact)
- owner: Owner Username (exact)
- owned_by: Filter on list of owned by group names [OR] (exact)
- public: Public (exact)
- deleted: Deleted (exact)
- deleted_by: Deleted by (exact)
- deleted_date: Deleted date (exact)
- created_by: Created by Username (exact)
- modified_by: Modified by Username (exact)
- stock: Filter by the stock id (exact)
- stock_id: Filter by the stock id (exact)
- notes: Notes content contains (icontains)

Advanced Filtering

You can also filter using a json object to process all search parameters. Currently this filter supports the syntax as produced/used by the http://summitroute.github.io/react-structured-filter/ search UI.

Example

?query_expression={"category":"name","operator":"contains","value":"Y00"},
       {"category":"amount","operator":">","value":"10"},
       {"category":"type__name","operator":"exact","value":"ANTIBODY"}
» more info about the query_expression param..

Preset mappings

- created_by: created_by__username
- modified_by: modified_by__username
- owner: owner__username
- owned_by: owned_by__name
- deleted: <function filter_deleted at 0x7f45063765f0>
- deleted_by: deleted_by__username
- notes: notes__content
- cv_category: cv_category__name
- field_meta: field_meta__name
- mandatory_owned_by: mandatory_owned_by__name
- user: user__username
- credential: credential__name
- workflowversion: workflowversion__name
- workflowrun: workflowrun__name
- dataset: dataset__name

Operators

- ==
- =
- >=
- >
- <=
- <
- contains
- icontains
- exact
- iexact
- startswith
- istartswith
- endswith
- iendswith

Permission filtering

Based on the current logged in user you can filter for objects that have a particular permission set:

- can_change: True/False, show objects that you can change
- can_delete: True/False, show objects that you can delete

# not applicable - will raise NotAcceptable:
- can_view: as this is always True, you can only view items you are allowed to see

Ordering

You can order on practically any field even spanning relations.

# reverse order on owner username
?ordering=-owner

# order on related field
?ordering=category__version
GET/PUT/POST/DELETE the Order which holds a collection of ordered items
Entry point:

* ``/api/stocks/orders/``
  - ``GET/POST``  or create a new order (POSTing the detailed order object)
    - GET list all orders as seen below
    - POST create a new order by sending a single order and all ordered items. Both should
      not have any ID (they are ignored, except for the stock ID of course).
    ```
    {
      "results": [
        {
          "id": <generated_uuid>,
          "name": "Order Name",
          "created_by": <username>,
          (..)
          "odereditems": [
            {
              "id": <generated_uuid>,
              stock: {
                "id": <uuid>,
                "type": "CELLLINE",
                "model": "SPECIMEN",
                "name": "Stock Name"
              }
              stock_type: "SPECIMEN",
              quantity: 10,
              total_price: 20,
              (..)
            },
            (..)
          ]
        }
      ]
    }
    ```
* ``/api/stocks/orders/<order_id>``
  - ``GET/PUT/DELETE``
    - GET single order
    - PUT to update a single order:
      - Any ordereditems not in the ordereditems list will be deleted.
      - Ordereditems without an ID will be newly created, with an ID they get updated.
    - DELETE a single order and its related ordereditems

    ```
    {
          "id": <generated_uuid>,
          "name": "Order Name",
          "created_by": <username>,
          (..)
          "odereditems": [
            {
              "id": <generated_uuid>,
              stock: {
                "id": <uuid>,
                "type": "CELLLINE",
                "model": "SPECIMEN",
                "name": "Stock Name"
              }
              stock_type: "SPECIMEN",
              quantity: 10,
              total_price: 20,
              (..)
            },
            (..)
          ]
        }
    ```
* ``/api/stocks/orders/<order_id>/notify_stores``
  - ``PUT``
    - PUT send an email to the stores with an excel file containing
      all ordereditems as a list.
      The order will be marked as already being send to the stores.

None

The default modelviewset used in this project


Add JSONPatch like functionality to bulk update items.


### Bulk Delete

This view also allows for one to bulk delete items. The url needs to be appended by ``/bulk_delete/`` and the ids
need to be given by multiple query_params:

```
{current_url}/bulk_delete/?id=<id_1>,id=<id_2>
```
GET /api/v2/stocks/orders/?format=api&ordering=-is_storeorder
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "previous": null,
    "next": null,
    "current": 1,
    "total": 0,
    "total_pages": 1,
    "results": []
}