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

-- MetadataRepository.getCountries
SELECT DISTINCT
  ON ("exif"."country") "exif"."country" AS "country"
FROM
  "exif" "exif"
  LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
  AND ("asset"."deletedAt" IS NULL)
WHERE
  "asset"."ownerId" IN ($1)

-- MetadataRepository.getStates
SELECT DISTINCT
  ON ("exif"."state") "exif"."state" AS "state"
FROM
  "exif" "exif"
  LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
  AND ("asset"."deletedAt" IS NULL)
WHERE
  "asset"."ownerId" IN ($1)
  AND "exif"."country" = $2

-- MetadataRepository.getCities
SELECT DISTINCT
  ON ("exif"."city") "exif"."city" AS "city"
FROM
  "exif" "exif"
  LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
  AND ("asset"."deletedAt" IS NULL)
WHERE
  "asset"."ownerId" IN ($1)
  AND "exif"."country" = $2
  AND "exif"."state" = $3

-- MetadataRepository.getCameraMakes
SELECT DISTINCT
  ON ("exif"."make") "exif"."make" AS "make"
FROM
  "exif" "exif"
  LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
  AND ("asset"."deletedAt" IS NULL)
WHERE
  "asset"."ownerId" IN ($1)
  AND "exif"."model" = $2

-- MetadataRepository.getCameraModels
SELECT DISTINCT
  ON ("exif"."model") "exif"."model" AS "model"
FROM
  "exif" "exif"
  LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
  AND ("asset"."deletedAt" IS NULL)
WHERE
  "asset"."ownerId" IN ($1)
  AND "exif"."make" = $2
