summaryrefslogtreecommitdiff
path: root/Omni/Task
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Task')
-rw-r--r--Omni/Task/Core.hs18
-rw-r--r--Omni/Task/RaceTest.hs4
2 files changed, 10 insertions, 12 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs
index 6d69834..18f80e2 100644
--- a/Omni/Task/Core.hs
+++ b/Omni/Task/Core.hs
@@ -35,7 +35,7 @@ data Task = Task
taskStatus :: Status,
taskPriority :: Priority, -- Priority level (0-4)
taskDependencies :: [Dependency], -- List of dependencies with types
- taskDescription :: Maybe Text, -- Optional detailed description
+ taskDescription :: Text, -- Required description
taskCreatedAt :: UTCTime,
taskUpdatedAt :: UTCTime
}
@@ -251,7 +251,7 @@ instance SQL.FromRow Task where
<*> SQL.field
<*> SQL.field
<*> SQL.field
- <*> SQL.field
+ <*> (fromMaybe "" </ SQL.field) -- Handle NULL description from legacy data
<*> SQL.field
<*> SQL.field
@@ -598,7 +598,7 @@ saveTask task =
task
-- Create a new task
-createTask :: Text -> TaskType -> Maybe Text -> Maybe Text -> Priority -> [Dependency] -> Maybe Text -> IO Task
+createTask :: Text -> TaskType -> Maybe Text -> Maybe Text -> Priority -> [Dependency] -> Text -> IO Task
createTask title taskType parent namespace priority deps description =
withTaskLock <| do
let parent' = fmap normalizeId parent
@@ -957,13 +957,11 @@ showTaskDetailed t = do
putText "Dependencies:"
traverse_ printDependency (taskDependencies t)
- case taskDescription t of
- Nothing -> pure ()
- Just desc -> do
- putText ""
- putText "Description:"
- let indented = T.unlines <| map (" " <>) (T.lines desc)
- putText indented
+ unless (T.null (taskDescription t)) <| do
+ putText ""
+ putText "Description:"
+ let indented = T.unlines <| map (" " <>) (T.lines (taskDescription t))
+ putText indented
putText ""
where
diff --git a/Omni/Task/RaceTest.hs b/Omni/Task/RaceTest.hs
index 007046f..78410a4 100644
--- a/Omni/Task/RaceTest.hs
+++ b/Omni/Task/RaceTest.hs
@@ -28,7 +28,7 @@ raceTest =
initTaskDb
-- Create a parent epic
- parent <- createTask "Parent Epic" Epic Nothing Nothing P2 [] Nothing
+ parent <- createTask "Parent Epic" Epic Nothing Nothing P2 [] "Parent Epic description"
let parentId = taskId parent
-- Create multiple children concurrently
@@ -39,7 +39,7 @@ raceTest =
-- Run concurrent creations
children <-
mapConcurrently
- (\i -> createTask ("Child " <> tshow i) WorkTask (Just parentId) Nothing P2 [] Nothing)
+ (\i -> createTask ("Child " <> tshow i) WorkTask (Just parentId) Nothing P2 [] ("Child " <> tshow i <> " description"))
indices
-- Check for duplicates in generated IDs