From fe7e0c2fe5bb083c873afd1984ab500b9df13b4b Mon Sep 17 00:00:00 2001 From: Nikita Volodin Date: Fri, 18 Aug 2023 18:33:19 -0400 Subject: [PATCH 1/2] docs(process-firefly-transactions): add cospend and firefly3 api urls --- workflows/process-firefly-transactions.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/workflows/process-firefly-transactions.yaml b/workflows/process-firefly-transactions.yaml index 86b3d77db..bdea4617f 100644 --- a/workflows/process-firefly-transactions.yaml +++ b/workflows/process-firefly-transactions.yaml @@ -49,6 +49,12 @@ # to public nextcloud and firefly addresses. # - Run the script `./workflows/process-firefly-transactions/test-locally.sh` # from the root of the repository. +# +# For reference: +# - The Firefly III API is documented here: +# `https://docs.firefly-iii.org/firefly-iii/api/`. +# - The cospend API is defined here: +# `https://github.com/julien-nc/cospend-nc/blob/main/appinfo/routes.php`. on: script: From bb8c069ba802199f90fb3851a1e21845a9d73a11 Mon Sep 17 00:00:00 2001 From: Nikita Volodin Date: Fri, 18 Aug 2023 19:21:54 -0400 Subject: [PATCH 2/2] feat(process-firefly-transactions): support ff3 transaction categories --- .../process-firefly-transactions/submit-to-cospend/src/main.ts | 1 + .../submit-to-cospend/src/schema.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/workflows/process-firefly-transactions/submit-to-cospend/src/main.ts b/workflows/process-firefly-transactions/submit-to-cospend/src/main.ts index a2347784d..d61c1c3da 100644 --- a/workflows/process-firefly-transactions/submit-to-cospend/src/main.ts +++ b/workflows/process-firefly-transactions/submit-to-cospend/src/main.ts @@ -187,6 +187,7 @@ async function main() { const categoryid = pipe( O.fromNullable(category), + O.orElse(() => O.fromNullable(t.category_name)), O.flatMap((name) => RA.findFirst(Object.values(p.categories), (_) => _.name === name) ), diff --git a/workflows/process-firefly-transactions/submit-to-cospend/src/schema.ts b/workflows/process-firefly-transactions/submit-to-cospend/src/schema.ts index c06858718..799de02f2 100644 --- a/workflows/process-firefly-transactions/submit-to-cospend/src/schema.ts +++ b/workflows/process-firefly-transactions/submit-to-cospend/src/schema.ts @@ -222,6 +222,8 @@ const FireflyTransaction = S.struct({ amount: S.string, description: S.string, tags: S.array(S.string), + category_id: S.nullable(S.string), + category_name: S.nullable(S.string), }) ), }),