Repository: bvanelli/actualpy

Issue:
Read Accounts Notes
### Description

I could not find how to query an account's note via actualpy, but I have seen someone who said he did it with the official api on discord. 

Is it possible to implement? 

Below, the code example he have posted, I don't know if it is helpful:

```
getAccountNote: async function (account) {
    const notes = await api.runQuery(
      api.q('notes')
        .filter({ id: `account-${account.id}` })
        .select('*')
      );
    if (notes.data.length && notes.data[0].note) {
      return notes.data[0].note;
    }
    return undefined;
  },
```

Thank you!

Discussion:
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/bvanelli/actualpy/pull/64?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 96.95%. Comparing base [(`0762863`)](https://app.codecov.io/gh/bvanelli/actualpy/commit/07628637f9974072545450a2ba4425beb632524e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli) to head [(`abd5135`)](https://app.codecov.io/gh/bvanelli/actualpy/commit/abd513512749e02d64a0eb1543f73a50f7c1954d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main      #64   +/-   ##
=======================================
  Coverage   96.95%   96.95%           
=======================================
  Files          13       13           
  Lines        1839     1842    +3     
=======================================
+ Hits         1783     1786    +3     
  Misses         56       56           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/bvanelli/actualpy/pull/64?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli).


Patch:
diff --git a/actual/database.py b/actual/database.py
index 72a34f1..a33d46e 100644
--- a/actual/database.py
+++ b/actual/database.py
@@ -214,6 +214,11 @@ class Accounts(BaseModel, table=True):
         )
         return decimal.Decimal(value) / 100
 
+    @property
+    def notes(self) -> Optional[str]:
+        """Returns notes for the account. If none are present, returns `None`."""
+        return object_session(self).scalar(select(Notes.note).where(Notes.id == f"account-{self.id}"))
+
 
 class Banks(BaseModel, table=True):
     id: Optional[str] = Field(default=None, sa_column=Column("id", Text, primary_key=True))
@@ -366,7 +371,7 @@ class MessagesCrdt(SQLModel, table=True):
     id: Optional[int] = Field(default=None, sa_column=Column("id", Integer, primary_key=True))
 
 
-class Notes(SQLModel, table=True):
+class Notes(BaseModel, table=True):
     id: Optional[str] = Field(default=None, sa_column=Column("id", Text, primary_key=True))
     note: Optional[str] = Field(default=None, sa_column=Column("note", Text))
 


Test patch:
diff --git a/tests/test_database.py b/tests/test_database.py
index 794bdba..f09297a 100644
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -5,6 +5,7 @@ from datetime import date, timedelta
 import pytest
 
 from actual import ActualError
+from actual.database import Notes
 from actual.queries import (
     create_account,
     create_rule,
@@ -181,3 +182,12 @@ def test_rollback(session):
     assert len(session.info["messages"])
     session.rollback()
     assert "messages" not in session.info
+
+
+def test_model_notes(session):
+    account_with_note = create_account(session, "Bank 1")
+    account_without_note = create_account(session, "Bank 2")
+    session.add(Notes(id=f"account-{account_with_note.id}", note="My note"))
+    session.commit()
+    assert account_with_note.notes == "My note"
+    assert account_without_note.notes is None