Closed birthdaysgift closed 1 year ago
While working on encapsulating models creation (#62), we missed some fixes at the PR review (#64). Here is the list of those fixes:
User.create_user()
Instead of password_hash=hashlib.sha256(password.encode()).hexdigest() we can use our _get_password_hash() method.
Instead of
password_hash=hashlib.sha256(password.encode()).hexdigest()
we can use our _get_password_hash() method.
_get_password_hash()
Topic.create_topic()
Post.create_post()
Since this method is actually creates a new object let's make it to return this object. Like we did it in user.create_session() method. Yes now we don't use the returned object, but it's a good design to make "create_" methods return created object. And we need to do the same thing for Topic.create_topic() and Post.create_post()
Since this method is actually creates a new object let's make it to return this object. Like we did it in user.create_session() method.
user.create_session()
Yes now we don't use the returned object, but it's a good design to make "create_" methods return created object.
And we need to do the same thing for Topic.create_topic() and Post.create_post()
While working on encapsulating models creation (#62), we missed some fixes at the PR review (#64). Here is the list of those fixes:
User.create_user()
method:User.create_user()
,Topic.create_topic()
andPost.create_post()
: