Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend/refactor: BKN-2787. Apply changes from kernel. #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/mock-registry/src/Flow/Lookup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

module Flow.Lookup where

import App.Types (FlowHandler)
import App.Types (Flow, FlowHandler)
import Domain.Subscriber
import Kernel.Prelude
import Kernel.Storage.Esqueleto
Expand All @@ -29,10 +29,10 @@ lookup req = withFlowHandlerAPI $ do

create :: Subscriber -> FlowHandler AckResponse
create sub = withFlowHandlerAPI $ do
runTransaction $ Sub.create sub
runTransaction $ Sub.create @Flow sub
return Ack

delete :: Text -> Text -> FlowHandler AckResponse
delete uniqueKeyId subscriberId = withFlowHandlerAPI $ do
runTransaction $ Sub.deleteByKey (uniqueKeyId, subscriberId)
runTransaction $ Sub.deleteByKey @Flow (uniqueKeyId, subscriberId)
return Ack
14 changes: 8 additions & 6 deletions app/mock-registry/src/Storage/Queries/Subscriber.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@

the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Storage.Queries.Subscriber where

import App.Types
import Domain.Subscriber
import Kernel.Prelude
import Kernel.Storage.Esqueleto as Esq
import Kernel.Types.Common
import Storage.Tabular.Subscriber

findByAll :: (MonadThrow m, Log m, Transactionable m) => Maybe Text -> Maybe Text -> Maybe Domain -> Maybe SubscriberType -> m [Subscriber]
findByAll :: forall m. (MonadThrow m, Log m, Transactionable Flow m) => Maybe Text -> Maybe Text -> Maybe Domain -> Maybe SubscriberType -> m [Subscriber]
findByAll mbKeyId mbSubId mbDomain mbSubType =
Esq.findAll $ do
Esq.findAll @m @Flow $ do
parkingLocation <- from $ table @SubscriberT
where_ $
whenJust_ mbKeyId (\keyId -> parkingLocation ^. SubscriberUniqueKeyId ==. val keyId)
Expand All @@ -32,13 +34,13 @@ findByAll mbKeyId mbSubId mbDomain mbSubType =
&&. whenJust_ mbSubType (\subType -> parkingLocation ^. SubscriberSubscriberType ==. val subType)
return parkingLocation

create :: Subscriber -> SqlDB ()
create :: Subscriber -> SqlDB m ()
create = Esq.create

deleteByKey :: (Text, Text) -> SqlDB ()
deleteByKey :: (Text, Text) -> SqlDB m ()
deleteByKey = Esq.deleteByKey @SubscriberT

findAll :: (MonadThrow m, Log m, Transactionable m) => m [Subscriber]
findAll :: forall m. (MonadThrow m, Log m, Transactionable Flow m) => m [Subscriber]
findAll =
Esq.findAll $ do
Esq.findAll @m @Flow $ do
from $ table @SubscriberT
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ packages:
extra-deps:
# - ../shared-kernel/lib/mobility-core
- git: https://github.com/nammayatri/shared-kernel.git
commit: 296681fc0018daa19ce0f99d85bd87b6a61afc39
commit: f15ddf41baa5f23a35f3566f2edd16887d3a6467
subdirs:
- lib/mobility-core
- git: https://github.com/juspay/passetto
Expand Down
8 changes: 4 additions & 4 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ packages:
version: 0.1.0.0
git: https://github.com/nammayatri/shared-kernel.git
pantry-tree:
size: 16451
sha256: 513889e102b30b2da7f2d4dbbd52e7f4176777278e6345491d96892417ff2919
commit: 296681fc0018daa19ce0f99d85bd87b6a61afc39
size: 16452
sha256: 8fbb41553364bd5a65a3de04e18ca141ad58afbe33e89e8248d85e16b39123d1
commit: f15ddf41baa5f23a35f3566f2edd16887d3a6467
original:
subdir: lib/mobility-core
git: https://github.com/nammayatri/shared-kernel.git
commit: 296681fc0018daa19ce0f99d85bd87b6a61afc39
commit: f15ddf41baa5f23a35f3566f2edd16887d3a6467
- completed:
subdir: core
name: passetto-core
Expand Down