From 10c4c0be4dc41c4ebfebf4f4963b91b04a381882 Mon Sep 17 00:00:00 2001 From: Bluub Date: Mon, 14 Feb 2022 13:43:35 +0100 Subject: [PATCH] fix: fix dockerfile build --- api/aeris.cabal | 13 +++++++++++ api/package.yaml | 4 ++++ api/src/Core/OIDC.hs | 19 +++++++++++++++ api/stack.yaml | 4 ++-- api/stack.yaml.lock | 21 +++++++++++------ api/test/Spec.hs | 40 ++++++++++++++++---------------- api/test/test_signup.tavern.yaml | 11 +++++++++ 7 files changed, 83 insertions(+), 29 deletions(-) create mode 100644 api/src/Core/OIDC.hs create mode 100644 api/test/test_signup.tavern.yaml diff --git a/api/aeris.cabal b/api/aeris.cabal index aff7143..f6893e2 100644 --- a/api/aeris.cabal +++ b/api/aeris.cabal @@ -30,6 +30,7 @@ library Api.Pipeline App Config + Core.OIDC Core.Pipeline Core.Reaction Core.User @@ -57,9 +58,12 @@ library , hasql-migration , hasql-pool , hasql-transaction + , http-conduit + , http-media , memory , mr-env , network + , opaleye >=0.9.0.0 && <0.9.2.0 , rel8 , servant , servant-auth @@ -68,6 +72,7 @@ library , text , time , transformers + , unordered-containers , utf8-string , wai , warp @@ -90,9 +95,12 @@ executable aeris-exe , hasql-migration , hasql-pool , hasql-transaction + , http-conduit + , http-media , memory , mr-env , network + , opaleye >=0.9.0.0 && <0.9.2.0 , rel8 , servant , servant-auth @@ -101,6 +109,7 @@ executable aeris-exe , text , time , transformers + , unordered-containers , utf8-string , wai , warp @@ -127,9 +136,12 @@ test-suite aeris-test , hspec , hspec-wai , hspec-wai-json + , http-conduit + , http-media , memory , mr-env , network + , opaleye >=0.9.0.0 && <0.9.2.0 , rel8 , servant , servant-auth @@ -138,6 +150,7 @@ test-suite aeris-test , text , time , transformers + , unordered-containers , utf8-string , wai , warp diff --git a/api/package.yaml b/api/package.yaml index fa21179..75e324b 100644 --- a/api/package.yaml +++ b/api/package.yaml @@ -20,6 +20,7 @@ description: Please see the README on GitHub at = 4.7 && < 5 +- opaleye >= 0.9.0.0 && < 0.9.2.0 - aeson - servant - servant-server @@ -40,6 +41,9 @@ dependencies: - memory - transformers - mr-env +- unordered-containers +- http-media +- http-conduit - utf8-string library: diff --git a/api/src/Core/OIDC.hs b/api/src/Core/OIDC.hs new file mode 100644 index 0000000..9a24071 --- /dev/null +++ b/api/src/Core/OIDC.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Core.OIDC where +import Data.ByteString.Lazy + +-- * OIDC + +data OIDCConf = + OIDCConf { redirectUri :: ByteString + , clientId :: ByteString + , clientPassword :: ByteString + } deriving (Show, Eq) + +oidcGoogleConf :: OIDCConf +oidcGoogleConf = OIDCConf + { redirectUri = "http://localhost:8080/auth/login/google" + , clientId = "914790981890-qjn5qjq5qjqjqjqjqjqjqjqjqjqjqjq.apps.googleusercontent.com" + , clientPassword = "914790981890-qjn5qjq5qjqjqjqjqjqjqjqjqjqjqjqjq" + } \ No newline at end of file diff --git a/api/stack.yaml b/api/stack.yaml index 4f1ff84..d341530 100644 --- a/api/stack.yaml +++ b/api/stack.yaml @@ -40,15 +40,15 @@ packages: # commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a # extra-deps: -- rel8-1.1.0.0@sha256:c31ad1bfbd7446ccbe39075d66dc89c8de3b3788c144247c9de269cfc55e1428,5023 - git: https://github.com/haskell-servant/servant.git commit: 22d5790e73f6b74401ac2cec32a627edc77a34d8 subdirs: - servant - servant-server +- rel8-1.3.0.0@sha256:f9f5f74b7a0d68f1dfc31ddf482d4ebfc6cac638dfe30bea07378cb384cbf52c,5114 - hasql-migration-0.3.0@sha256:6ca4cc6c89834bb79eb9f15b504774043b5b3994336bd86a9d79e59da6d54963,2799 - mr-env-0.1.0.4@sha256:56439c7df09a83b72b170f104723293643ad2635df03cdcd174a05d0d73e788d,1055 - +- opaleye-0.9.0.0@sha256:2e96ce59ea10f0b5f41cb4bccc67e0d18fef9dad6ebeef9cee33541564ac0be0,5837 # Override default flag values for local packages and extra-deps # flags: {} diff --git a/api/stack.yaml.lock b/api/stack.yaml.lock index 160cef8..68881c0 100644 --- a/api/stack.yaml.lock +++ b/api/stack.yaml.lock @@ -4,13 +4,6 @@ # https://docs.haskellstack.org/en/stable/lock_files packages: -- completed: - hackage: rel8-1.1.0.0@sha256:c31ad1bfbd7446ccbe39075d66dc89c8de3b3788c144247c9de269cfc55e1428,5023 - pantry-tree: - sha256: 11aca3bab6462b5997acb4a9969625e839d5369ff1c7cb687db86a729d5b4c00 - size: 9096 - original: - hackage: rel8-1.1.0.0@sha256:c31ad1bfbd7446ccbe39075d66dc89c8de3b3788c144247c9de269cfc55e1428,5023 - completed: git: https://github.com/haskell-servant/servant.git name: servant @@ -37,6 +30,13 @@ packages: git: https://github.com/haskell-servant/servant.git subdir: servant-server commit: 22d5790e73f6b74401ac2cec32a627edc77a34d8 +- completed: + hackage: rel8-1.3.0.0@sha256:f9f5f74b7a0d68f1dfc31ddf482d4ebfc6cac638dfe30bea07378cb384cbf52c,5114 + pantry-tree: + sha256: 2b151572fb50e63b4e47a2aaaf2a9431aa7719f8cf334babdf53134df77befeb + size: 9161 + original: + hackage: rel8-1.3.0.0@sha256:f9f5f74b7a0d68f1dfc31ddf482d4ebfc6cac638dfe30bea07378cb384cbf52c,5114 - completed: hackage: hasql-migration-0.3.0@sha256:6ca4cc6c89834bb79eb9f15b504774043b5b3994336bd86a9d79e59da6d54963,2799 pantry-tree: @@ -51,6 +51,13 @@ packages: size: 376 original: hackage: mr-env-0.1.0.4@sha256:56439c7df09a83b72b170f104723293643ad2635df03cdcd174a05d0d73e788d,1055 +- completed: + hackage: opaleye-0.9.0.0@sha256:2e96ce59ea10f0b5f41cb4bccc67e0d18fef9dad6ebeef9cee33541564ac0be0,5837 + pantry-tree: + sha256: 0cd508ef304e75b8a492b214a8865c9b305a7f38a034d8704f5b26b61a9e9fd8 + size: 5661 + original: + hackage: opaleye-0.9.0.0@sha256:2e96ce59ea10f0b5f41cb4bccc67e0d18fef9dad6ebeef9cee33541564ac0be0,5837 snapshots: - completed: sha256: f9970d6f25c63e3e4265aa8e9c69a047ba8919d1107e4996bdd7555b75aad0eb diff --git a/api/test/Spec.hs b/api/test/Spec.hs index 8aefe96..eb33885 100644 --- a/api/test/Spec.hs +++ b/api/test/Spec.hs @@ -1,20 +1,20 @@ -{-# LANGUAGE QuasiQuotes #-} -{-# LANGUAGE OverloadedStrings #-} -module Main (main) where - -import Lib (app) -import Test.Hspec -import Test.Hspec.Wai -import Test.Hspec.Wai.JSON - -main :: IO () -main = hspec spec - -spec :: Spec -spec = with (return app) $ do - describe "GET /users" $ do - it "responds with 200" $ do - get "/users" `shouldRespondWith` 200 - it "responds with [User]" $ do - let users = "[{\"userId\":1,\"userFirstName\":\"Isaac\",\"userLastName\":\"Newton\"},{\"userId\":2,\"userFirstName\":\"Albert\",\"userLastName\":\"Einstein\"}]" - get "/users" `shouldRespondWith` users +-{-# LANGUAGE QuasiQuotes #-} +-{-# LANGUAGE OverloadedStrings #-} +-module Main (main) where +- +-import Lib (app) +-import Test.Hspec +-import Test.Hspec.Wai +-import Test.Hspec.Wai.JSON +- +-main :: IO () +-main = hspec spec +- +-spec :: Spec +-spec = with (return app) $ do +- describe "GET /users" $ do +- it "responds with 200" $ do +- get "/users" `shouldRespondWith` 200 +- it "responds with [User]" $ do +- let users = "[{\"userId\":1,\"userFirstName\":\"Isaac\",\"userLastName\":\"Newton\"},{\"userId\":2,\"userFirstName\":\"Albert\",\"userLastName\":\"Einstein\"}]" +- get "/users" `shouldRespondWith` users diff --git a/api/test/test_signup.tavern.yaml b/api/test/test_signup.tavern.yaml new file mode 100644 index 0000000..3b69bb3 --- /dev/null +++ b/api/test/test_signup.tavern.yaml @@ -0,0 +1,11 @@ +--- +test_name: Signup a user +stages: + - name: Make sure we have the right ID + + request: + url: https://localhost:8080/auth/signup + method: POST + + response: + status_code: 200