Created client model #88
No reviewers
Labels
No labels
CI/CD
MongoDB
PostgreSQL
api
authentication
bug
documentation
duplicate
enhancement
example issue
fix
good first issue
help wanted
high-level requirement
infrastructure
invalid
low-level requirement
medium-level requirement
question
security
test
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AndreFerreira5/starranja!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "db-models-client"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Below is the client model as defined in the db. Merging this to the db-models branch will move issue #82 to Done in the Project.
Looks good. Just have to remember to be consistent in using
utcnowto keep dates and times consistent with UTC.Also, calling replace() instead of save() on
Clientwon't updateupdated_at. Most likely won't be a problem, but worth keeping in mind.@ -0,0 +75,4 @@# - Partial update; all fields optionalclass ClientUpdate(BaseModel):Doesn't the
updatedAtalso need to be changed here explicitly (and every time the client is updated)?@ -0,0 +36,4 @@async def save(self, *args, **kwargs):self.updated_at = datetime.now(UTC)return await super().save(*args, **kwargs)Won't be likely be needed, but also wouldn't hurt overriding
Client.replace()the same waysave()is, here.@ -0,0 +1,92 @@from datetime import UTC, datetimedatetime.utcnow()is deprecated from python 3.12 onwards, you should usedatetime.now(timezone.utc)@ -0,0 +1,92 @@from datetime import UTC, datetimehere you should not type id as an string, but as
PydanticObjectIdas that is the type beanie uses on the id by default.also,
alias="id"is redundant as beanie already exposes it as idid: PydanticObjectIdthis should sufficethe model looks nice! however, you need to address the changes requested in comments by me and @vascodias23
when that is done, i think it is ready for merging!
@ -0,0 +75,4 @@# - Partial update; all fields optionalclass ClientUpdate(BaseModel):Yes, every time a client have some information changed the
updatedAtmust be updated.it is done