@@ -823,22 +823,149 @@ setDueUtc conf connection datetime ids = do
823
823
pure $ vsep docs
824
824
825
825
826
+ getResultMsg :: Doc AnsiStyle -> Task -> Doc AnsiStyle
827
+ getResultMsg msg task =
828
+ let
829
+ TaskUlid idText = primaryKey task
830
+ prettyBody = dquotes (pretty $ Task. body task)
831
+ prettyId = dquotes (pretty idText)
832
+ in
833
+ msg <+> " of task" <+> prettyBody <+> " with id" <+> prettyId
834
+
835
+
836
+ uncloseTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
837
+ uncloseTasks conf connection ids = do
838
+ docs <- forM ids $ \ idSubstr -> do
839
+ execWithTask conf connection idSubstr $ \ task -> do
840
+ runBeamSqlite connection $ runUpdate $
841
+ update (_tldbTasks taskLiteDb)
842
+ (\ task_ -> mconcat
843
+ [ (Task. closed_utc task_) <-. (val_ Nothing )
844
+ , (Task. state task_) <-. (val_ Nothing )
845
+ ]
846
+ )
847
+ (\ task_ -> primaryKey task_ ==. val_ (primaryKey task))
848
+
849
+ pure $ getResultMsg " 💥 Removed close timestamp and state field" task
850
+
851
+ pure $ vsep docs
852
+
853
+
826
854
undueTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
827
855
undueTasks conf connection ids = do
828
856
docs <- forM ids $ \ idSubstr -> do
829
857
execWithTask conf connection idSubstr $ \ task -> do
830
- let
831
- taskUlid@ (TaskUlid idText) = primaryKey task
832
- prettyBody = dquotes (pretty $ Task. body task)
833
- prettyId = dquotes (pretty idText)
834
-
835
858
runBeamSqlite connection $ runUpdate $
836
859
update (_tldbTasks taskLiteDb)
837
860
(\ task_ -> mconcat [(Task. due_utc task_) <-. (val_ Nothing )])
838
- (\ task_ -> primaryKey task_ ==. val_ taskUlid )
861
+ (\ task_ -> primaryKey task_ ==. val_ (primaryKey task) )
839
862
840
- pure $ " 💥 Removed due UTC of task" <+> prettyBody
841
- <+> " with id" <+> prettyId
863
+ pure $ getResultMsg " 💥 Removed due timestamp" task
864
+
865
+ pure $ vsep docs
866
+
867
+
868
+ unwaitTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
869
+ unwaitTasks conf connection ids = do
870
+ docs <- forM ids $ \ idSubstr -> do
871
+ execWithTask conf connection idSubstr $ \ task -> do
872
+ runBeamSqlite connection $ runUpdate $
873
+ update (_tldbTasks taskLiteDb)
874
+ (\ task_ -> mconcat
875
+ [ (Task. waiting_utc task_) <-. (val_ Nothing )
876
+ , (Task. review_utc task_) <-. (val_ Nothing )
877
+ ]
878
+ )
879
+ (\ task_ -> primaryKey task_ ==. val_ (primaryKey task))
880
+
881
+ pure $ getResultMsg " 💥 Removed waiting and review timestamps" task
882
+
883
+ pure $ vsep docs
884
+
885
+
886
+ -- TODO:
887
+ -- unwakeTasks :: Config -> Connection -> [IdText] -> IO (Doc AnsiStyle)
888
+ -- unwakeTasks conf connection ids = do
889
+ -- docs <- forM ids $ \idSubstr -> do
890
+ -- execWithTask conf connection idSubstr $ \task -> do
891
+ -- runBeamSqlite connection $ runUpdate $
892
+ -- update (_tldbTasks taskLiteDb)
893
+ -- (\task_ -> mconcat [(Task.awake_utc task_) <-. (val_ Nothing)])
894
+ -- (\task_ -> primaryKey task_ ==. val_ (primaryKey task))
895
+
896
+ -- pure $ getResultMsg "💥 Removed awake timestamp" task
897
+
898
+ -- pure $ vsep docs
899
+
900
+
901
+ unrepeatTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
902
+ unrepeatTasks conf connection ids = do
903
+ docs <- forM ids $ \ idSubstr -> do
904
+ execWithTask conf connection idSubstr $ \ task -> do
905
+ runBeamSqlite connection $ runUpdate $
906
+ update (_tldbTasks taskLiteDb)
907
+ (\ task_ -> mconcat
908
+ [(Task. repetition_duration task_) <-. (val_ Nothing )])
909
+ (\ task_ -> primaryKey task_ ==. val_ (primaryKey task))
910
+
911
+ pure $ getResultMsg " 💥 Removed repetition duration value" task
912
+
913
+ pure $ vsep docs
914
+
915
+
916
+ untagTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
917
+ untagTasks conf connection ids = do
918
+ docs <- forM ids $ \ idSubstr -> do
919
+ execWithTask conf connection idSubstr $ \ task -> do
920
+ runBeamSqlite connection $ runDelete $ delete
921
+ (_tldbTaskToTag taskLiteDb)
922
+ (\ tag -> TaskToTag. task_ulid tag ==. val_ (primaryKey task))
923
+
924
+ pure $ getResultMsg " 💥 Removed all tags" task
925
+
926
+ pure $ vsep docs
927
+
928
+
929
+ unnoteTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
930
+ unnoteTasks conf connection ids = do
931
+ docs <- forM ids $ \ idSubstr -> do
932
+ execWithTask conf connection idSubstr $ \ task -> do
933
+ runBeamSqlite connection $ runDelete $ delete
934
+ (_tldbTaskToNote taskLiteDb)
935
+ (\ noteValue ->
936
+ TaskToNote. task_ulid noteValue ==. val_ (primaryKey task)
937
+ )
938
+
939
+ pure $ getResultMsg " 💥 Removed all notes" task
940
+
941
+ pure $ vsep docs
942
+
943
+
944
+ unprioTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
945
+ unprioTasks conf connection ids = do
946
+ docs <- forM ids $ \ idSubstr -> do
947
+ execWithTask conf connection idSubstr $ \ task -> do
948
+ runBeamSqlite connection $ runUpdate $
949
+ update (_tldbTasks taskLiteDb)
950
+ (\ task_ -> mconcat
951
+ [(Task. priority_adjustment task_) <-. (val_ Nothing )])
952
+ (\ task_ -> primaryKey task_ ==. val_ (primaryKey task))
953
+
954
+ pure $ getResultMsg " 💥 Removed priority adjustment" task
955
+
956
+ pure $ vsep docs
957
+
958
+
959
+ unmetaTasks :: Config -> Connection -> [IdText ] -> IO (Doc AnsiStyle )
960
+ unmetaTasks conf connection ids = do
961
+ docs <- forM ids $ \ idSubstr -> do
962
+ execWithTask conf connection idSubstr $ \ task -> do
963
+ runBeamSqlite connection $ runUpdate $
964
+ update (_tldbTasks taskLiteDb)
965
+ (\ task_ -> mconcat [(Task. metadata task_) <-. (val_ Nothing )])
966
+ (\ task_ -> primaryKey task_ ==. val_ (primaryKey task))
967
+
968
+ pure $ getResultMsg " 💥 Removed metadata" task
842
969
843
970
pure $ vsep docs
844
971
0 commit comments