reapit / foundations

Foundations platform mono repo
57 stars 21 forks source link

Is it possible to query properties based on property owner id? #9602

Closed ss-dimasm closed 1 year ago

ss-dimasm commented 1 year ago

Summary Hi, Is there any way to retrieve paginated properties based on property owner's (could be landlord or vendor) id? does the masterId query param handle this?

Thanks

AshDeeming commented 1 year ago

Hi @ss-dimasm The LandlordID is a current parameter for Get Properties & vendorID can be obtained via the propertyID.

As the Contact level is where the associated records are stored, could this be the parameter you are looking to query by?

ss-dimasm commented 1 year ago

Thanks @AshDeeming

for upcoming requirements we want to query the properties based on landlord and vendor contact details, looks like is fine for landlord perspective but not for vendor. Imagine we would have 2 search fields, first it should be the vendor/landlord name and the second for choosing the marketingMode of property. Regarding to not supported vendor case (assuming if we already select the "sales" on the marketingMode field), our planned flow is to query the paginated vendor service first based on the passed name search term, and then we will hit the paginated properties by passing the retrieved vendor Ids from vendor service. So in this case we couldn't retrieve the properties that related with the vendor Ids that we have pass previously since there aren't vendorId param in the properties service. Am I right for this scenario?

plittlewood-rpt commented 1 year ago

Hi @ss-dimasm I think what you are wanting to do is doable already but I may have misunderstood your requirements.

If you are wanting to find properties that are owned by a specific contact, I'd recommend calling GET /contacts/{id}?embed=relationships as this will give you the contact with all the landlord and vendor relationships. From here you can then:

The other way you could achieve what I think you are wanting is to call the landlords endpoint doing a name search, then use the ids in the resultset to call GET /properties?landlordId=XXX123456 (which I think is what you're saying you are doing now), and for sales, call the vendor endpoint doing a name search, then call GET /properties?id=XXX123456 which as the vendorId and propertyId are actually pointing to the same resource on sales side, gives you what you are wanting.

Let me know if this is unclear, I hope I've understood your requirements correctly. Thanks

github-actions[bot] commented 1 year ago

We have recently requested additional information relating to the issue you have raised. Please can you take the time to review this ticket and where applicable, provide the information requested. For more information on our processes, please click here

ss-dimasm commented 1 year ago

Hi @plittlewood-rpt it works and very clear now and it's more efficient than before, thank you for the insight. Previously I don't know if we could retrieve the sales properties based on passed vendor id with id param on there. Once again thanks 👍

plittlewood-rpt commented 1 year ago

No problem! Glad to help

github-actions[bot] commented 1 year ago

It looks like you have commented on a closed issue. If your comment relates to a bug or feature request, please open a new issue, and include this issue number/url for reference. For more information on our processes, please click here