Skip to content

Commit

Permalink
backend/enh/add-city-Pudukkottai-to-main
Browse files Browse the repository at this point in the history
  • Loading branch information
vsaimanohar authored and khuzema786 committed Dec 3, 2024
1 parent 9cc2912 commit bc9bcf2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/mobility-core/src/Kernel/Types/Beckn/City.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ data City
| Cuttack
| Puri
| Warangal
| Pudukkottai
| AnyCity
deriving (Eq, Generic, Show, Read, ToSchema, Ord, ToParamSchema)
deriving (PrettyShow) via Showable City
Expand Down Expand Up @@ -210,6 +211,8 @@ instance FromJSON City where
parseJSON (String "Puri") = pure Puri
parseJSON (String "std:0870") = pure Warangal
parseJSON (String "Warangal") = pure Warangal
parseJSON (String "std:04322") = pure Pudukkottai
parseJSON (String "Pudukkottai") = pure Pudukkottai
parseJSON (String _) = pure AnyCity
parseJSON e = typeMismatch "String" e

Expand Down Expand Up @@ -271,6 +274,7 @@ instance ToJSON City where
toJSON Cuttack = String "std:0671"
toJSON Puri = String "std:06752"
toJSON Warangal = String "std:0870"
toJSON Pudukkottai = String "std:04322"
toJSON AnyCity = String "*"

instance FromHttpApiData City where
Expand Down Expand Up @@ -393,6 +397,8 @@ instance FromHttpApiData City where
parseLowerCaseCity "puri" = Right Puri
parseLowerCaseCity "std:0870" = Right Warangal
parseLowerCaseCity "warangal" = Right Warangal
parseLowerCaseCity "std:04322" = Right Pudukkottai
parseLowerCaseCity "pudukkottai" = Right Pudukkottai
parseLowerCaseCity "*" = Right AnyCity
parseLowerCaseCity city = Left . T.pack $ ("ParseFail: Unable to parse city: " <> city)

Expand Down Expand Up @@ -454,4 +460,5 @@ instance ToHttpApiData City where
toUrlPiece Cuttack = "std:0671"
toUrlPiece Puri = "std:06752"
toUrlPiece Warangal = "std:0870"
toUrlPiece Pudukkottai = "std:04322"
toUrlPiece AnyCity = "*"

0 comments on commit bc9bcf2

Please sign in to comment.