Skip to content

Made a lot of Changes for DB implementation

Praviin Premsankar requested to merge praviinSprint3 into main

issue #23 (closed) Made a lot of Changes:

  • Removed Database file, added DatabaseManger class instead
  • Added a lot of new functions for DB functionality:
    • getUserByUsername: Given a username returns userModel if exists in DB or null otherwise
    • getAllUsers: Returns list of UserModel
    • updateUsername: Changes username
    • changePassword: Given username and password, if valid, changes password to newPassword
    • isValidCredentials: Given username and passwrod returns true/false for valid user in DB
    • getBookById: given bookid, returns corresposnding BookModel
    • clearBookCollection: deletes all books from db
    • clearUserCollection: deletes all users from db
  • Modified BookModel class to include more fields
  • Modified UserModel class, before library was a mutablelist of BookModel, is now a mutableList of BsonValue (which is basically bookid), can get corresponding bookModel with getBookById function added
  • Slightly modified MainPageViewModel to account for change in UserModel structure (have left code in comments, might be needed later on)
  • mainPageView: added code in comments (not necessary now, but might be later)
  • Added DB functions in Main just to test it out (also as reference if you want to know how to implement DB functions in other classes, can be removed as needed). Also slightly changed code in App function to account for change in userModel structure
Edited by Praviin Premsankar

Merge request reports