Esempio n. 1
0
    def get_full_name(slack_handle):
        query = Session.query(Employees) \
            .filter(Employees.slack_handle == slack_handle) \
            .filter(Employees.enabled) \
            .limit(1) \
            .one()

        return query.name
Esempio n. 2
0
    def get_random_employee():
        from app.Sentences import Sentences
        query = Session.query(Employees, Sentences) \
            .filter(Employees.id == Sentences.employee_id) \
            .filter(Employees.enabled) \
            .order_by(func.random()) \
            .limit(1) \
            .one()

        return query.Employees.slack_handle
Esempio n. 3
0
 def get_all_channels():
     return Session.query(Channels) \
         .filter(Channels.enabled == True) \
         .all()
Esempio n. 4
0
 def get(id):
     return Session.query(Employees) \
         .filter(Employees.id == id) \
         .one()
Esempio n. 5
0
    def toggle(slack_id, toggle):
        Session.query(Employees) \
            .filter(Employees.id == slack_id) \
            .update({'enabled': toggle})

        return Session.commit()