Exemple #1
0
 def update_team(cls, team):
     team_entry = db.session.query(TeamTableEntry).filter(
         TeamTableEntry.team_id == team.id).one_or_none()
     team_entry.team_name = team.name
     team_entry.picture = team.picture
     team_entry.location = team.location
     team_entry.description = team.description
     team_entry.welcome_message = team.welcome_message
     DatabaseClient.add(team_entry)
     return TeamModelMapper.to_team(team_entry)
    def add_or_update_chat(cls, chat):
        chat_entry = db.session.query(ChatTableEntry).filter(
            ChatTableEntry.user_id == chat.user_id,
            ChatTableEntry.chat_id == chat.chat_id,
            ChatTableEntry.team_id == chat.team_id).one_or_none()

        if chat_entry is not None:
            chat_entry.unseen_offset = chat.offset
        else:
            chat_entry = MessageDatabaseMapper.to_chat(chat)

        DatabaseClient.add(chat_entry)
Exemple #3
0
 def add_password_recovery(cls, password_recovery):
     recovery_entry = UserDatabaseMapper.to_password_recovery(
         password_recovery)
     DatabaseClient.add(recovery_entry)
Exemple #4
0
 def add_user(cls, user):
     user_entry = UserDatabaseMapper.to_user(user)
     DatabaseClient.add(user_entry)
Exemple #5
0
 def add_client(cls):
     client_entry = ClientTableEntry()
     DatabaseClient.add(client_entry)
     return RegularClient(client_id=client_entry.client_id)
 def add_channel_user(cls, channel_user):
     channel_user_entry = ChannelDatabaseMapper.to_channel_user(channel_user)
     DatabaseClient.add(channel_user_entry)
 def add_channel(cls, channel):
     channel_entry = ChannelDatabaseMapper.to_channel(channel)
     DatabaseClient.add(channel_entry)
Exemple #8
0
 def add_bot(cls, bot):
     bot_entry = BotDatabaseMapper.to_bot(bot)
     DatabaseClient.add(bot_entry)
Exemple #9
0
 def update_team_user(cls, team_user):
     team_user_entry = db.session.query(UsersByTeamsTableEntry).filter(
         UsersByTeamsTableEntry.user_id == team_user.user_id,
         UsersByTeamsTableEntry.team_id == team_user.team_id).one_or_none()
     team_user_entry.role = team_user.role
     DatabaseClient.add(team_user_entry)
Exemple #10
0
 def add_forbidden_word(cls, word):
     word_entry = TeamDatabaseMapper.to_forbidden_word(word)
     DatabaseClient.add(word_entry)
Exemple #11
0
 def add_invite(cls, invite):
     invite_entry = TeamDatabaseMapper.to_team_invite(invite)
     DatabaseClient.add(invite_entry)
Exemple #12
0
 def add_team_user(cls, team_user):
     team_user_entry = TeamDatabaseMapper.to_team_user(team_user)
     DatabaseClient.add(team_user_entry)
Exemple #13
0
 def add_team(cls, team):
     team_entry = TeamDatabaseMapper.to_team(team)
     DatabaseClient.add(team_entry)
     return TeamModelMapper.to_team(team_entry)
 def add_mention(cls, mention):
     mention_entry = MessageDatabaseMapper.to_mention(mention)
     DatabaseClient.add(mention_entry)
 def add_chat(cls, chat):
     chat_entry = MessageDatabaseMapper.to_chat(chat)
     DatabaseClient.add(chat_entry)
 def add_message(cls, message):
     message_entry = MessageDatabaseMapper.to_message(message)
     DatabaseClient.add(message_entry)
     return MessageModelMapper.to_message(message_entry)