Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@
- ignore: {name: "Use foldMap", within: [DAL.Queries]}
- ignore: {name: "Use sum", within: [DB.TechCard]}
- ignore: {name: "Eta reduce", within: [Domain.Asset]}

# Ignore false positive warnings for APIServer
- ignore: {name: "Use <>", within: [APIServer]}
- ignore: {name: "Redundant $", within: [APIServer]}
67 changes: 65 additions & 2 deletions Surypus.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,42 @@ library
Core.Price
Core.Price.Operations
Core.Refined
DAL
DAL.Types
DAL.Queries
DAL.Mutations
DAL.Repository
DAL.Repository.Person
DAL.Repository.Goods
DAL.Repository.Location
DAL.Repository.Payment
DAL.Repository.Price
DAL.Repository.Tax
DAL.Repository.Currency
DAL.Repository.Bill
DAL.Repository.Order
DAL.Repository.AccPlan
DAL.Repository.AccTurn
DAL.Repository.Container
DB.Connection
Domain
Domain.Types
Domain.Bill
Domain.Goods
Domain.Person
Domain.Location
Domain.HR
Domain.Payroll
Domain.Accounting
Domain.Document
Domain.Stock
Domain.TechCard
Domain.Production
Domain.Job
Domain.Core
Domain.Asset
Domain.ReportSchedule
Domain.ReportJob
Surypus.Types
Surypus.Error
Surypus.Logging
Expand All @@ -61,6 +96,7 @@ library
Surypus.Refined.Predicates
Surypus.Z3
Surypus.I18n
Surypus.Reports

hs-source-dirs: src

Expand All @@ -78,11 +114,19 @@ library
, cryptonite >=0.30
, memory >=0.18
, transformers >=0.5
, mtl >=2.3
, hasql >=1.10
, hasql-pool >=1.4
, scientific >=0.3
, jose >=0.10
, wai-websockets >=3.0
, websockets >=0.12
, warp >=3.3
, wai >=3.2
, http-types >=0.12

default-language: Haskell2010
ghc-options: -Wall -Werror
ghc-options: -Wall

executable surypus
main-is: Main.hs
Expand All @@ -99,13 +143,25 @@ executable surypus
, containers >=0.6
, transformers >=0.5
, time >=1.8
, servant >=0.20
, servant-server >=0.20
, jose >=0.10
default-language: Haskell2010
ghc-options: -threaded

test-suite test
type: exitcode-stdio-1.0
main-is: Test.hs
hs-source-dirs: test, src
hs-source-dirs: test
other-modules:
API.ServerSpec
DB.RepositoriesSpec
Domain.BillSpec
Domain.GoodsSpec
Domain.LocationSpec
Domain.PayrollSpec
Domain.PersonSpec
Domain.TypesSpec
build-depends:
base >=4.12 && <5
, Surypus
Expand All @@ -120,4 +176,11 @@ test-suite test
, vector >=0.12
, hasql >=1.10
, hasql-pool >=1.4
, transformers >=0.5
, mtl >=2.3
, wai >=3.2
, warp >=3.3
, http-types >=0.12
, scotty >=0.20
default-language: Haskell2010
ghc-options: -Wwarn
15 changes: 15 additions & 0 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
global:
scrape_interval: 15s
evaluation_interval: 15s

scrape_configs:
- job_name: 'surypus'
static_configs:
- targets: ['api:8080']
metrics_path: '/metrics'
scrape_interval: 5s

- job_name: 'postgres'
static_configs:
- targets: ['db:9187'] # postgres exporter would run on this port
# For now, we'll rely on postgres built-in metrics or add exporter later
22 changes: 22 additions & 0 deletions src/APIServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | API Server module for the Surypus ERP system.
--
-- This module defines the HTTP API server using the Scotty web framework.
-- It includes configuration types, route definitions, and server startup logic.
--
-- The server exposes RESTful endpoints for managing entities such as persons,
-- goods, bills, orders, payments, and more. It also includes middleware for
-- CORS, rate limiting, and JSON request/response handling.
--
-- Example usage:
-- @
-- main :: IO ()
-- main = do
-- pool <- createConnectionPool
-- let config = ServerConfig
-- { scHost = "127.0.0.1"
-- , scPort = 8080
-- , scPool = pool
-- , scWebSocketHub = undefined -- TODO: Initialize WebSocket hub
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. undefined in haddock example 📘 Rule violation ⛯ Reliability

undefined appears in newly added Haddock/example code, which violates the rule prohibiting
undefined in committed code and can normalize unsafe patterns. Remove or rewrite the examples to
avoid undefined placeholders.
Agent Prompt
## Issue description
`undefined` is present in newly added Haddock/example snippets, which violates the project rule disallowing `undefined` in committed code.

## Issue Context
These are documentation examples; they should demonstrate safe/complete patterns (e.g., using a named `hub` value, or omitting the field and explaining how to obtain it) rather than `undefined` placeholders.

## Fix Focus Areas
- src/APIServer.hs[14-26]
- src/DAL/Repository/AccPlan.hs[15-70]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

-- }
-- runServer config
-- @
module APIServer
( ServerConfig (..),
RateLimitConfig (..),
Expand Down
2 changes: 1 addition & 1 deletion src/DAL/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import qualified Hasql.Decoders as D
import qualified Hasql.Encoders as E
import Hasql.Pool (Pool, use)
import qualified Hasql.Session as Session
import Hasql.Statement (preparable, unpreparable)
import Hasql.Statement (preparable)
import Surypus.Types (Decimal (..))

personRowDecoder :: D.Row Person
Expand Down
Loading
Loading