fenya123 / forum123

Flask application written for educational purposes.
http://193.124.115.171/
1 stars 1 forks source link

Add missed fixes for 62 ticket #90

Closed birthdaysgift closed 1 year ago

birthdaysgift commented 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:

  1. In User.create_user() method:

Instead of

password_hash=hashlib.sha256(password.encode()).hexdigest()

we can use our _get_password_hash() method.

  1. For User.create_user(), 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.

    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()