Skip to content

Commit

Permalink
feat: add public account fields to table as property to bypass auth
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Apr 25, 2024
1 parent b51ac9d commit 089713a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bd_api/apps/api/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,32 @@ def last_updated_at(self):
updates = [u.latest for u in self.updates.all() if u.latest]
return max(updates) if updates else None

@property
def published_by_info(self) -> dict:
if not self.published_by:
return None
return {
"firstName": self.published_by.first_name,
"lastName": self.published_by.last_name,
"email": self.published_by.email,
"github": self.published_by.github,
"twitter": self.published_by.twitter,
"website": self.published_by.website,
}

@property
def data_cleaned_by_info(self) -> dict:
if not self.data_cleaned_by:
return None
return {
"firstName": self.data_cleaned_by.first_name,
"lastName": self.data_cleaned_by.last_name,
"email": self.data_cleaned_by.email,
"github": self.data_cleaned_by.github,
"twitter": self.data_cleaned_by.twitter,
"website": self.data_cleaned_by.website,
}

def get_similarity_of_area(self, other: "Table"):
count_all = 0
count_yes = 0
Expand Down

0 comments on commit 089713a

Please sign in to comment.