Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

feat: Basic read/write functionality for database #23

Merged
merged 15 commits into from
Aug 19, 2024

Conversation

MitchellJC
Copy link
Collaborator

No description provided.

Copy link
Owner

@LimaoC LimaoC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm mostly, just some comments. Also, do we want to add a __init__.py to client/data so that it gets picked up by the auto documentation?

class User(NamedTuple):
"""Represents a user record in the SQLite database"""

id_: Optional[int]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the underscore suffix notation mean here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its to avoid name clashes with the inbuilt id() function.

return user_id


def save_posture(posture: Posture | tuple) -> None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm should this just be Posture so that we can just use posture.id_ below? why tuple as well?

Copy link
Collaborator Author

@MitchellJC MitchellJC Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking @avg-lebesgue-enjoyer and @polypies73 might not want to worry about using the Posture class and tried to make it a bit more flexible.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it'd be too much more work, wouldn't you just wrap a tuple in Posture() to convert it? It would also be nice for data validation reasons too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah okay I agree, I will typehint just Posture.

@MitchellJC
Copy link
Collaborator Author

lgtm mostly, just some comments. Also, do we want to add a __init__.py to client/data so that it gets picked up by the auto documentation?

Done.

@MitchellJC MitchellJC merged commit 0f5fb18 into main Aug 19, 2024
2 checks passed
@MitchellJC MitchellJC deleted the mitch-basic-db-write branch August 19, 2024 06:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants