Implement function to find expiring owners

This commit is contained in:
Rene Vergara 2023-01-23 16:56:46 -06:00
parent 0cec845339
commit 4530c95895
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
6 changed files with 34 additions and 10 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2022 Vergara Technologies LLC Copyright (c) 2023 Vergara Technologies LLC
======================================================= =======================================================
Bootstrap Open Source Licence ("BOSL") v. 1.0 Bootstrap Open Source Licence ("BOSL") v. 1.0

View File

@ -112,7 +112,6 @@ executables:
- warp-tls - warp-tls
- warp - warp
tests: tests:
zgo-backend-test: zgo-backend-test:
main: Spec.hs main: Spec.hs

View File

@ -292,3 +292,9 @@ findOwner zaddy = findOne (select ["address" =: zaddy] "owners")
findOwnerById :: T.Text -> Action IO (Maybe Document) findOwnerById :: T.Text -> Action IO (Maybe Document)
findOwnerById i = findOwnerById i =
findOne (select ["_id" =: (read (T.unpack i) :: ObjectId)] "owners") findOne (select ["_id" =: (read (T.unpack i) :: ObjectId)] "owners")
-- | Function to find Owners about to expire
findExpiringOwners :: UTCTime -> Action IO [Document]
findExpiringOwners now =
rest =<<
find (select ["expiration" =: ["$lte" =: addUTCTime 1728000 now]] "owners")

View File

@ -17,7 +17,7 @@
# #
# resolver: ./custom-snapshot.yaml # resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml # resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-19.33 resolver: lts-20.8
#url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/4.yaml #url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/4.yaml
# User packages to be built. # User packages to be built.

View File

@ -24,7 +24,7 @@ packages:
hackage: blake3-0.2@sha256:d1146b9a51ccfbb0532780778b6d016a614e3d44c05d8c1923dde9a8be869045,2448 hackage: blake3-0.2@sha256:d1146b9a51ccfbb0532780778b6d016a614e3d44c05d8c1923dde9a8be869045,2448
snapshots: snapshots:
- completed: - completed:
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4 sha256: bfafe5735ccb74527d754b1f9999ded72d7c3a6c3a88529449661431ccfbd6cc
size: 619204 size: 649327
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/8.yaml
original: lts-19.33 original: lts-20.8

View File

@ -5,9 +5,9 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
name: zgo-backend name: zgo-backend
version: 1.1.1 version: 1.2.0
synopsis: Haskell Back-end for the ZGo point-of-sale application synopsis: Haskell Back-end for the ZGo point-of-sale application
description: Please see the README on GitLab at <https://gitlab.com/pitmutt/zgo-backend#readme> description: Please see the README at <https://git.vergara.tech/Vergara_Tech//zgo-backend#readme>
category: Web category: Web
author: Rene Vergara author: Rene Vergara
maintainer: rene@vergara.network maintainer: rene@vergara.network
@ -22,7 +22,7 @@ extra-source-files:
source-repository head source-repository head
type: git type: git
location: https://gitlab.com/pitmutt/zgo-backend location: https://git.vergara.tech/Vergara_Tech/zgo-backend
library library
exposed-modules: exposed-modules:
@ -78,6 +78,7 @@ library
executable zgo-backend-exe executable zgo-backend-exe
main-is: Server.hs main-is: Server.hs
other-modules: other-modules:
Notify
TokenRefresh TokenRefresh
Paths_zgo_backend Paths_zgo_backend
hs-source-dirs: hs-source-dirs:
@ -101,9 +102,27 @@ executable zgo-backend-exe
, zgo-backend , zgo-backend
default-language: Haskell2010 default-language: Haskell2010
executable zgo-notifier
main-is: Notify.hs
other-modules:
Server
TokenRefresh
Paths_zgo_backend
hs-source-dirs:
app
ghc-options: -main-is Notify -threaded -rtsopts -with-rtsopts=-N -Wall
build-depends:
base >=4.7 && <5
, mongoDB
, time
, warp
, zgo-backend
default-language: Haskell2010
executable zgo-token-refresh executable zgo-token-refresh
main-is: TokenRefresh.hs main-is: TokenRefresh.hs
other-modules: other-modules:
Notify
Server Server
Paths_zgo_backend Paths_zgo_backend
hs-source-dirs: hs-source-dirs: