fradrive/backend/testdata/avs_json.hs
Sarah Vaupel 72f5a9fb37 build: move backend-related files into backend dir; implement and connect services via docker-compose
TODOs left: reimplement clean and help, sync static,well-known and assets between services
2025-03-23 04:52:49 +01:00

33 lines
1.8 KiB
Haskell

-- SPDX-FileCopyrightText: 2022 Steffen Jost <jost@tcs.ifi.lmu.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- usage:
-- > npm run build
-- > stack ghci -- testdata/avs_json.hs
import Prelude
import Data.String
import qualified Data.ByteString.Lazy as B
import Data.Aeson
import Utils.Avs
import Utils.PathPiece
status1 :: B.ByteString
status1 = fromString "[{\"PersonID\":10233,\"personCardStatus\":[{\"CardNo\":\"01234567\",\"VersionNo\":\"4\",\"CardColor\":\"Rot\",\"CardAreas\":\"LY\",\"Valid\":\"true\"},{\"CardNo\":\"00001111\",\"VersionNo\":\"4\",\"CardColor\":\"Rot\",\"CardAreas\":\"F\",\"Valid\":\"true\"}]},{\"PersonID\":10444,\"personCardStatus\":[{\"CardNo\":\"11111111\",\"VersionNo\":\"4\",\"CardColor\":\"Gelb\",\"CardAreas\":\"LF\",\"Valid\":\"false\"}]}]"
test1 :: Either String AvsResponseStatus
test1 = eitherDecode status1
person1 :: B.ByteString
person1 = fromString "[{\"PersonID\":518870,\"PersonNo\":508870,\"InternalPersonalNo\":\"00057138\",\"LastName\":\"Jost\",\"FirstName\":\"Steffen\",\"personCards\":[{\"Firm\":\"AVN-AR2\",\"City\":null,\"Street\":null,\"poStalcoDe\":\"64854\",\"CardNo\":\"00158446\",\"VersionNo\":\"4\",\"caRdcolor\":\"Violet\",\"CardAreas\":\"\",\"Valid\":\"true\",\"ValidTo\":\"2024-05-20\",\"IssueDate\":\"2019-09-02\"}]}]"
test2 :: Either String AvsResponsePerson
test2 = eitherDecode person1
person2 :: B.ByteString
person2 = fromString "[{\"PersonID\":4026895,\"PersonNo\":1200216,\"InternalPersonalNo\":\"00056057\",\"LastName\":\"Zatschker\",\"FirstName\":\"Laura\",\"personCards\":[{\"Firm\":\"AVN-SR1\",\"City\":null,\"Street\":null,\"PostalCode\":\"64853\",\"CardNo\":\"00048614\",\"VersionNo\":\"4\",\"CardColor\":\"Gelb\",\"CardAreas\":\"F\",\"Valid\":\"true\",\"ValidTo\":\"2024-01-15\",\"IssueDate\":\"2020-03-18\"}]}]"
test3 :: Either String AvsResponsePerson
test3 = eitherDecode person2