From 388a5e290ef179bf855d3633a69ca7ae44560fe2 Mon Sep 17 00:00:00 2001 From: khuzema786 Date: Sun, 3 Nov 2024 06:30:30 +0400 Subject: [PATCH] backend/fix: Geo Restriction --- lib/mobility-core/src/Kernel/Types/Geofencing.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/mobility-core/src/Kernel/Types/Geofencing.hs b/lib/mobility-core/src/Kernel/Types/Geofencing.hs index 99a51d535..17b8864ab 100644 --- a/lib/mobility-core/src/Kernel/Types/Geofencing.hs +++ b/lib/mobility-core/src/Kernel/Types/Geofencing.hs @@ -13,9 +13,11 @@ -} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE StandaloneDeriving #-} +{-# OPTIONS_GHC -Wno-orphans #-} module Kernel.Types.Geofencing where +import qualified Data.Text as T import qualified Data.Vector as V import qualified Database.Beam as B import Database.Beam.Backend @@ -44,9 +46,9 @@ fromFieldEnum' f mbValue = case mbValue of instance FromField GeoRestriction where fromField = fromFieldEnum' -instance HasSqlValueSyntax be String => HasSqlValueSyntax be GeoRestriction where - sqlValueSyntax Unrestricted = autoSqlValueSyntax Unrestricted - sqlValueSyntax (Regions regions) = autoSqlValueSyntax regions +instance HasSqlValueSyntax be Text => HasSqlValueSyntax be GeoRestriction where + sqlValueSyntax Unrestricted = sqlValueSyntax $ T.pack "Unrestricted" + sqlValueSyntax (Regions regions) = sqlValueSyntax $ "{" <> T.intercalate "," regions <> "}" instance BeamSqlBackend be => B.HasSqlEqualityCheck be GeoRestriction