Created client model #88

Merged
duarteneves5 merged 6 commits from db-models-client into db-models 2025-11-03 17:55:37 +00:00
duarteneves5 commented 2025-10-31 21:04:32 +00:00 (Migrated from github.com)

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.

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.
vascodias23 (Migrated from github.com) approved these changes 2025-10-31 23:34:05 +00:00
vascodias23 (Migrated from github.com) left a comment

Looks good. Just have to remember to be consistent in using utcnow to keep dates and times consistent with UTC.
Also, calling replace() instead of save() on Client won't update updated_at. Most likely won't be a problem, but worth keeping in mind.

Looks good. Just have to remember to be consistent in using `utcnow` to keep dates and times consistent with UTC. Also, calling replace() instead of save() on `Client` won't update `updated_at`. Most likely won't be a problem, but worth keeping in mind.
@ -0,0 +75,4 @@
# - Partial update; all fields optional
class ClientUpdate(BaseModel):
vascodias23 (Migrated from github.com) commented 2025-10-31 23:25:13 +00:00

Doesn't the updatedAt also need to be changed here explicitly (and every time the client is updated)?

Doesn't the `updatedAt` also need to be changed here explicitly (and every time the client is updated)?
vascodias23 (Migrated from github.com) reviewed 2025-10-31 23:35:43 +00:00
@ -0,0 +36,4 @@
async def save(self, *args, **kwargs):
self.updated_at = datetime.now(UTC)
return await super().save(*args, **kwargs)
vascodias23 (Migrated from github.com) commented 2025-10-31 23:35:43 +00:00

Won't be likely be needed, but also wouldn't hurt overriding Client.replace() the same way save() is, here.

Won't be likely be needed, but also wouldn't hurt overriding `Client.replace()` the same way `save()` is, here.
AndreFerreira5 (Migrated from github.com) reviewed 2025-11-01 11:42:07 +00:00
@ -0,0 +1,92 @@
from datetime import UTC, datetime
AndreFerreira5 (Migrated from github.com) commented 2025-11-01 11:42:06 +00:00

datetime.utcnow() is deprecated from python 3.12 onwards, you should use datetime.now(timezone.utc)

`datetime.utcnow()` is deprecated from python 3.12 onwards, you should use `datetime.now(timezone.utc)`
AndreFerreira5 (Migrated from github.com) reviewed 2025-11-01 11:47:42 +00:00
@ -0,0 +1,92 @@
from datetime import UTC, datetime
AndreFerreira5 (Migrated from github.com) commented 2025-11-01 11:47:42 +00:00

here you should not type id as an string, but as PydanticObjectId as that is the type beanie uses on the id by default.
also, alias="id" is redundant as beanie already exposes it as id

id: PydanticObjectId this should suffice

here you should not type id as an string, but as `PydanticObjectId` as that is the type beanie uses on the id by default. also, `alias="id"` is redundant as beanie already exposes it as id `id: PydanticObjectId` this should suffice
AndreFerreira5 (Migrated from github.com) requested changes 2025-11-01 11:48:49 +00:00
AndreFerreira5 (Migrated from github.com) left a comment

the 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!

the 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!
GFMpt13 (Migrated from github.com) reviewed 2025-11-01 13:20:13 +00:00
@ -0,0 +75,4 @@
# - Partial update; all fields optional
class ClientUpdate(BaseModel):
GFMpt13 (Migrated from github.com) commented 2025-11-01 13:20:13 +00:00

Yes, every time a client have some information changed the updatedAt must be updated.

Yes, every time a client have some information changed the `updatedAt` must be updated.
duarteneves5 commented 2025-11-03 17:55:32 +00:00 (Migrated from github.com)

the 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!

it is done

> the 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! it is done
Sign in to join this conversation.
No description provided.