Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A abocar
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • cct
  • abocar
  • Wiki
  • Queries

Last edited by Andrea Pavlovic Jul 26, 2021
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Queries

  • Query #1 List Company Members?

Query #1 List Company Members?

  • username: test_admin@ironapi.com
  • password: test_admin

https://garage.abocar.at/data/assignment/core_customer/query

   {
    "attrs": {
        "order_by": {
            "-desc": "me.id"
        },
        "prefetch": [
            "assigned_client",
            {
                "binding_instance_of_customer": "owning_client"
            }
        ]
    },
    "conds": {
        "binding_instance_of_customer.id": "154"
    },
    "page": 1,
    "page_size": 10
}

I assume, you're trying to list all clients of a company?

"binding_instance_of_customer" is the company itself, so you don't need to fetch that unless you want the company details. "owning_client" should be empty though, as a company does not have a login.

So, "assigned_client" is all you need.

Assuming a company with core.customer.id=5. First, fetch the core.customer.ids of the associated clients:

#/data/assignment/core_customer/query
{
  "conds": {
        "binding_instance_of_customer": 5,
        "assigned_client" : {"!=":5}
    },
  "attrs" : {
    "prefetch" : ["assigned_client"]
  }
}

Should you need any data of those clients from core.customer, you will have to use a seperate query with the ids returned in the previous one:

#/data/core/customer/query
{
  "conds": {
    "me.id" : {"-in": [142]},
    "me.is_client" : true
  }
}
Clone repository
  • Customers
  • Home
  • Queries
  • Test_Setup
  • Vehicles
  • v2