Skip to content

Commit

Permalink
backend/fix: Geo Restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
khuzema786 authored and NikithShetty committed Nov 5, 2024
1 parent 6f2869a commit 388a5e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/mobility-core/src/Kernel/Types/Geofencing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 388a5e2

Please sign in to comment.