Skip to content

Commit

Permalink
Check if workspace membership is up to date (#6)
Browse files Browse the repository at this point in the history
* Check if workspace membership is up to date

* Bump version

* Use set
  • Loading branch information
lloesche authored Sep 23, 2024
1 parent 1864b9d commit 94d34fd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fixattiosync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
__author__ = "Some Engineering Inc."
__license__ = "AGPL-3.0"
__copyright__ = "Copyright © 2024 Some Engineering Inc."
__version__ = "0.0.12"
__version__ = "0.0.13"
13 changes: 11 additions & 2 deletions fixattiosync/attioresources.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,18 @@ class AttioUser(AttioResource):
workspaces: list[AttioWorkspace] = field(default_factory=list)

def __eq__(self: Self, other: Any) -> bool:
if not hasattr(other, "id") or not hasattr(other, "email"):
if (
not hasattr(other, "id")
or not hasattr(other, "email")
or not hasattr(other, "workspaces")
or not isinstance(other.workspaces, list)
):
return False
return bool(self.id == other.id and str(self.email).lower() == str(other.email).lower())
return bool(
self.id == other.id
and str(self.email).lower() == str(other.email).lower()
and {w.id for w in self.workspaces} == {w.id for w in other.workspaces}
)

@classmethod
def make(cls: Type[Self], data: dict[str, Any]) -> Self:
Expand Down
13 changes: 11 additions & 2 deletions fixattiosync/fixresources.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,18 @@ class FixUser:
workspaces: list[FixWorkspace] = field(default_factory=list)

def __eq__(self: Self, other: Any) -> bool:
if not hasattr(other, "id") or not hasattr(other, "email"):
if (
not hasattr(other, "id")
or not hasattr(other, "email")
or not hasattr(other, "workspaces")
or not isinstance(other.workspaces, list)
):
return False
return bool(self.id == other.id and str(self.email).lower() == str(other.email).lower())
return bool(
self.id == other.id
and str(self.email).lower() == str(other.email).lower()
and {w.id for w in self.workspaces} == {w.id for w in other.workspaces}
)

def attio_data(
self, person: Optional[AttioPerson] = None, workspaces: Optional[list[AttioWorkspace]] = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "fixattiosync"
version = "0.0.12"
version = "0.0.13"
authors = [{name="Some Engineering Inc."}]
description = "Fix Attio Sync"
license = {file="LICENSE"}
Expand Down

0 comments on commit 94d34fd

Please sign in to comment.