-- NOTE: This file is auto generated by ./sql-generator

-- MapRepository.getMapMarkers
select
  "id",
  "asset_exif"."latitude" as "lat",
  "asset_exif"."longitude" as "lon",
  "asset_exif"."city",
  "asset_exif"."state",
  "asset_exif"."country"
from
  "asset"
  inner join "asset_exif" on "asset"."id" = "asset_exif"."assetId"
  and "asset_exif"."latitude" is not null
  and "asset_exif"."longitude" is not null
where
  "asset"."visibility" = $1
  and "deletedAt" is null
  and (
    "ownerId" in ($2)
    or exists (
      select
      from
        "album_asset"
      where
        "asset"."id" = "album_asset"."assetsId"
        and "album_asset"."albumsId" in ($3)
    )
  )
order by
  "fileCreatedAt" desc
