diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-26 13:35:29 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-26 13:35:29 -0500 |
| commit | c3745528bc770e263529459392bdcf56687fa1c7 (patch) | |
| tree | 3dec43d9b0bb4a7dd02e5d297288aa2845a0e2ba /Omni/Task/Core.hs | |
| parent | 9ac32389934012a7d33339ea81ae6a6c7c34b2c0 (diff) | |
Jr: Sequential task IDs
All tests pass. The implementation is complete:
**Summary of changes:** 1. Removed sqids dependency from
`Omni/Task/Core.hs`, `Omni/Task.hs`, an 2. Changed `generateId` in
`Omni/Task/Core.hs` to produce simple sequent 3. Removed the now-unused
`sqidsOptions` configuration and `Web.Sqids` i
Task-Id: t-1o2g8gu9y2z
Diffstat (limited to 'Omni/Task/Core.hs')
| -rw-r--r-- | Omni/Task/Core.hs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index bf52c2c..a68f37b 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -3,7 +3,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE NoImplicitPrelude #-} --- : dep sqids -- : dep http-api-data module Omni.Task.Core where @@ -24,7 +23,6 @@ import System.Directory (createDirectoryIfMissing, doesFileExist) import System.Environment (lookupEnv) import System.IO.Unsafe (unsafePerformIO) import Web.HttpApiData (FromHttpApiData (..)) -import qualified Web.Sqids as Sqids -- Core data types data Task = Task @@ -290,23 +288,11 @@ initTaskDb = do \ reason TEXT NOT NULL \ \)" --- Sqids configuration: lowercase alphabet only, minimum length 8 -sqidsOptions :: Sqids.SqidsOptions -sqidsOptions = - Sqids.defaultSqidsOptions - { Sqids.alphabet = "abcdefghijklmnopqrstuvwxyz0123456789", - Sqids.minLength = 8, - Sqids.blocklist = [] - } - --- Generate a short ID using sqids with sequential counter +-- Generate a sequential task ID (t-1, t-2, t-3, ...) generateId :: IO Text generateId = do counter <- getNextCounter - let encoded = case Sqids.runSqids sqidsOptions (Sqids.encode [counter]) of - Left _ -> "00000000" - Right sqid -> sqid - pure <| "t-" <> encoded + pure <| "t-" <> T.pack (show counter) -- Get the next counter value (atomically increments) getNextCounter :: IO Int |
