diff --git a/CHANGELOG.md b/CHANGELOG.md index 199c223..5fe8488 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,16 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## Added +### Added - New type to handle UI translation objects - New endpoints for API to get/set translation - Tests for translation endpoints -## Changed +### Changed - Remove old code for PIN generation - Xero reference field to include the amount of ZEC received +- Separate periodic tasks from API server ## [1.2.5] - 2023-02-01 diff --git a/app/Tasks.hs b/app/Tasks.hs new file mode 100644 index 0000000..402c561 --- /dev/null +++ b/app/Tasks.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Tasks where + +import Config +import Database.MongoDB +import ZGoBackend + +main :: IO () +main = do + putStrLn "ZGo Recurring Tasks" + putStrLn "Reading config..." + loadedConfig <- loadZGoConfig "zgo.cfg" + pipe <- connect $ host (c_dbHost loadedConfig) + j <- + access + pipe + master + (c_dbName loadedConfig) + (auth (c_dbUser loadedConfig) (c_dbPassword loadedConfig)) + if j + then do + putStrLn "Connected to MongoDB!" + checkZcashPrices pipe (c_dbName loadedConfig) + scanZcash loadedConfig pipe + scanPayments loadedConfig pipe + checkPayments pipe (c_dbName loadedConfig) + expireOwners pipe (c_dbName loadedConfig) + updateLogins pipe loadedConfig + close pipe + else fail "MongoDB connection failed!" diff --git a/package.yaml b/package.yaml index 77e2dc7..bc2b54a 100644 --- a/package.yaml +++ b/package.yaml @@ -1,10 +1,10 @@ name: zgo-backend -version: 1.2.6 +version: 1.3.0 git: "https://git.vergara.tech/Vergara_Tech/zgo-backend" license: BOSL author: "Rene Vergara" maintainer: "rene@vergara.network" -copyright: "Copyright (c) 2022 Vergara Technologies LLC" +copyright: "Copyright (c) 2023 Vergara Technologies LLC" extra-source-files: - README.md @@ -113,6 +113,23 @@ executables: - configurator - warp-tls - warp + zgo-tasks: + main: Tasks.hs + source-dirs: app + ghc-options: + - -main-is Tasks + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -Wall + dependencies: + - base + - mongoDB + - zgo-backend + - scotty + - warp-tls + - warp + - time tests: zgo-backend-test: diff --git a/zgo-backend.cabal b/zgo-backend.cabal index 24e686c..c937442 100644 --- a/zgo-backend.cabal +++ b/zgo-backend.cabal @@ -81,6 +81,7 @@ library executable zgo-backend-exe main-is: Server.hs other-modules: + Tasks TokenRefresh Paths_zgo_backend hs-source-dirs: @@ -104,10 +105,30 @@ executable zgo-backend-exe , zgo-backend default-language: Haskell2010 +executable zgo-tasks + main-is: Tasks.hs + other-modules: + Server + TokenRefresh + Paths_zgo_backend + hs-source-dirs: + app + ghc-options: -main-is Tasks -threaded -rtsopts -with-rtsopts=-N -Wall + build-depends: + base + , mongoDB + , scotty + , time + , warp + , warp-tls + , zgo-backend + default-language: Haskell2010 + executable zgo-token-refresh main-is: TokenRefresh.hs other-modules: Server + Tasks Paths_zgo_backend hs-source-dirs: app