This commit is contained in:
Christian Ulrich 2024-05-29 00:33:13 +02:00
parent c814c1a800
commit 49ba6d5976
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 9 additions and 10 deletions

View File

@ -166,22 +166,22 @@ listCards hostname username password boardId stackId =
in
runReq defaultHttpConfig $ do
response <- req GET url NoReqBody jsonResponse headers
let
stack :: Stack = responseBody response
let stack :: Stack = responseBody response
return $ fromMaybe [] stack.cards
createCard :: Text -> Text -> Text -> Word -> Word -> Text -> Text -> LocalTime -> Word -> IO ()
createCard hostname username password boardId stackId title description date weeklyRepeats = do
timezone <- getCurrentTimeZone
let headers = authHeaders username password
let url = baseUrl hostname /: "boards" /: T.pack (show boardId) /: "stacks" /: T.pack (show stackId) /: "cards"
let (_, dayOfYear) = toOrdinalDate date.localDay
let (year, month, day) = toGregorian date.localDay
let
headers = authHeaders username password
url = baseUrl hostname /: "boards" /: T.pack (show boardId) /: "stacks" /: T.pack (show stackId) /: "cards"
(_, dayOfYear) = toOrdinalDate date.localDay
(year, month, day) = toGregorian date.localDay
expandedTitle =
T.replace "%YY" (T.pack $ show year)
$ T.replace "%MM" (T.pack $ show month)
$ T.replace "%DD" (T.pack $ show day) title
let
body =
object
[ "title" .= expandedTitle
@ -193,8 +193,7 @@ createCard hostname username password boardId stackId title description date wee
runReq defaultHttpConfig $ do
_ <- req POST url (ReqBodyJson body) ignoreResponse headers
when (weeklyRepeats > 0) $ do
let
repeats = weeklyRepeats - 1
oneWeek = 604800
nextDate = addLocalTime oneWeek date
let repeats = weeklyRepeats - 1
let oneWeek = 604800
let nextDate = addLocalTime oneWeek date
liftIO $ createCard hostname username password boardId stackId title description nextDate repeats