0

I would like to create a query which returns all the Requests (asset) in which the Container's (asset) owner's id is equal to the parameter.

Model file (owner of a container is a Company participant, identified by id):

namespace org.acme.shipping.assets
import org.acme.shipping.participants.*

asset Container identified by number {
  o String number
  o ContainerType type
  o String content
  o ContainerStatus status default = "FREE"
  --> Company owner
}

enum ContainerType {
  o DRY
  o REEFER
}

enum ContainerStatus {
  o LOCKED
  o FREE
}

asset Request identified by id {
  o String id
  --> Container container
}

Query file

query getRequestsByCompany {
  description: "Get requests by company"
  statement:
      SELECT org.acme.shipping.assets.Request
          WHERE (container.owner.id == _$company_id)
}

However, the current query does not seem to work. Is this achievable with a query?

Lars
  • 437
  • 1
  • 5
  • 11

2 Answers2

2

I did a lot of research also to do it using query file, but couldnt find a way, so I think that its not possible at moment.

The alternative way is to use loopback filters:

Something like:

{"where":{"shipmentId":1000}, "include":"resolve"}
Marckaraujo
  • 7,422
  • 11
  • 59
  • 97
0

you can go one level in like search by number . I am working on it if get the exact solution .

query getRequestsByCompany {
  description: "Get requests by company"
  statement:
      SELECT org.acme.shipping.assets.Request
          WHERE (container == _$container)
      }