DbExecutor

class DbExecutor(val kafkaConfigurator: KafkaConfigurator)
Companion:
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def addNewUsersToChat(users: List[UUID], chatId: String, chatName: ChatName)(implicit connection: Connection, ec: ExecutionContext): DbResponse[Int]
def checkUsersSession(sessionId: UUID, userId: UUID, validityTime: Long)(implicit connection: Connection): DbResponse[Int]
def createGroupChat(users: List[User], chatName: ChatName, chatId: ChatId)(implicit connection: Connection, ex: ExecutionContext): DbResponse[Chat]
def createSession(sessionId: UUID, userId: UUID, validityTime: Long)(implicit connection: Connection): DbResponse[Int]
def createSingleChat(me: User, otherId: UUID, chatId: ChatId, chatName: ChatName)(implicit connection: Connection, ec: ExecutionContext): DbResponse[Int]
def createUser(user: User, pass: Password, settings: Settings)(implicit connection: Connection): DbResponse[Int]
def findChatUsers(chatId: ChatId)(implicit connection: Connection): DbResponse[List[User]]
def findMyChats(userUUID: UUID)(implicit connection: Connection): DbResponse[Map[Chat, Map[Partition, Offset]]]
def findUser(login: Login, pass: Password)(implicit connection: Connection): DbResponse[(User, Settings)]

szukanie człowieka przy logowaniu przy logowaniu

szukanie człowieka przy logowaniu przy logowaniu

def findUsers(logins: List[Login])(implicit connection: Connection): DbResponse[List[User]]

For small (<10) list of users

For small (<10) list of users

def findUsersSession(userUUID: UUID)(implicit connection: Connection): DbResponse[List[SessionInfo]]
def leaveTheChat(userId: UUID, chatId: ChatId, groupChat: Boolean)(implicit connection: Connection): DbResponse[Int]

Method return number of other chat users

Method return number of other chat users

def removeAllExpiredUserSessions(userId: UUID)(implicit connection: Connection): DbResponse[Int]
def removeSession(sessionId: UUID, userId: UUID, validityTime: Long)(implicit connection: Connection): DbResponse[Int]

jeśli zwróci zero to znaczy, że nie usunęło sesji bo jej nie ma, albo bo usera już nie ma wtedy przekieruj na stronę logowania.

jeśli zwróci zero to znaczy, że nie usunęło sesji bo jej nie ma, albo bo usera już nie ma wtedy przekieruj na stronę logowania.

Metody można używać też do wylogowania z konkretnej sesji.

def updateChatName(myUUID: UUID, chatId: String, newName: ChatName)(implicit connection: Connection): DbResponse[Int]
def updateChatOffsetAndMessageTime(userId: UUID, chat: Chat, sortedOffsets: => Seq[(Int, Long)])(implicit connection: Connection): DbResponse[Int]
def updateChatSilence(chatId: ChatId, userId: UUID, silent: Boolean)(implicit connection: Connection): DbResponse[Int]
def updateJoiningOffset(user: User, offset: Offset)(implicit connection: Connection): DbResponse[Int]
def updateMyLogin(userId: UUID, newLogin: Login)(implicit connection: Connection): DbResponse[Int]
def updateSession(sessionId: UUID, userId: UUID, newValidityTime: Long)(implicit connection: Connection): DbResponse[Int]

jeśli zwraca zero to znaczy, że nie ma updatowanej sesji i takie rządanie należy przekierować na stronę logowania

jeśli zwraca zero to znaczy, że nie ma updatowanej sesji i takie rządanie należy przekierować na stronę logowania

def updateUsersPassword(user: User, oldPass: Password, newPass: Password)(implicit connection: Connection): DbResponse[Int]