예제 #1
0
 def setStatusForUser(self, movie_id, user_id, userStatus):
     movie = session.query(Movie).filter(Movie.id == movie_id).first()
     for listeningUser in movie.listeningUsers:
         if listeningUser.user_id == user_id:
             listeningUser.status = userStatus
     self.saveMovie(movie)
     print movie.listeningUsers
예제 #2
0
 def findNonArchivedForUser(self, userId):
     return session.query(Movie).filter(Movie.listeningUsers.any(user_id=userId)).\
         filter(~Movie.listeningUsers.any(status=UserStatus.ARCHIVED)).all()
예제 #3
0
 def findByStatus(self, status):
     return session.query(Movie).filter(Movie.status == status).all()
예제 #4
0
 def findById(self, id):
     return session.query(Movie).filter(Movie.id == id).one()
예제 #5
0
 def findByIMDBId(self, imdbId):
     return session.query(Movie).filter(Movie.imdbId == imdbId).all()
예제 #6
0
 def findForUser(self, user_id):
     return session.query(Movie).filter(
         Movie.listeningUsers.any(user_id=user_id)).all()
예제 #7
0
 def findByEmailIdAndPassword(self, emailId, password):
     return session.query(User).filter(User.emailId == emailId).filter(
         User.password == md5.new(password).hexdigest()).one()
예제 #8
0
 def findByEmailId(self, emailId):
     return session.query(User).filter(User.emailId == emailId).first()
예제 #9
0
 def findById(self, id):
     return session.query(User).filter(User.id == id).one()
예제 #10
0
 def findAll(self):
     return session.query(User).all()