notum-cz / strapi-plugin-location

This plugin allows users to create location inputs and store latitude and longitude values as geometry types in a PostGIS database. It also provides functionality to filter items based on their location.
MIT License
24 stars 13 forks source link

Location not working if data came from populated (need a help) #82

Closed Caviaros123 closed 10 months ago

Caviaros123 commented 11 months ago

Bug report

Describe the bug

A clear and concise description of what the bug is.

Steps to reproduce the behavior

Nothing happened when requesting on : http://localhost:1337/api/parkings?populate[address][fields][0]=coords&$location[address][coords]=23,14,3

{
   "data": [{
         ...,
       {
            "id": 3,
            ...,
            "address": {
                "id": 13,
                "coords": {
                    "lat": 48.947545,
                    "lng": 2.1423899
                }
            }
        },
  }]
}

Expected behavior

I configured everything correctly, it took me a while to migrate my MySQL database to Postgres using the PostGis Docker image but I have no proof that this mechanism works, I always get a 200 response whatever the coordinates I use. enter I don't have the impression that the data is correct but the data from relation address not working

Screenshots

If applicable, add screenshots to help explain your problem.

Code snippets

If applicable, add code samples to help explain your problem.

System

Additional context

plugin-version: "@notum-cz/strapi-plugin-location": "^1.1.4", Add any other context about the problem here.

omikulcik commented 11 months ago

Hi @Caviaros123, I have tried to reproduce your issue and confirmed it is a bug. Filtering in relations does not work. Does it make sense for you to use a component? Components are supported.

Just to be clear. Are you trying to filter parkings based on one-to-one relation of address or can the parking have many addresses and you are trying to filter the relations? I assume the first is right but just checking.

I messed with the code a bit and tried to find a quick solution but haven't found one. It will take a longer time. Will get back to it. Until then, I will add an information to readme that filtering by relation is not supported.

Caviaros123 commented 11 months ago

Hello my solution was to create a Hook by adding the coords field directly to the parking table without using components and to fill it with the values ​​of another field which uses APi Google places to give me the address and geocode position and have this coordinates field filled in

omikulcik commented 11 months ago

So your problem is solved, right? Just asking to know whether I can close this issue and make it and make a feature request issue to support relations.

omikulcik commented 10 months ago

Closing for inactivity and making a feature request out of this.