def delete(self, id): board = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashDashboardBoard).filter_by(board_id=id).first() Session = sessionmaker(bind=DBConnectionsFacade.get_edusson_ds()) sess = Session() sess.delete(board) sess.commit()
def delete(self, id): user = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashUser).filter_by(user_id=id).first() Session = sessionmaker(bind=DBConnectionsFacade.get_edusson_ds()) sess = Session() sess.delete(user) sess.commit()
def get(self, id): id = int(id) board = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashDashboardBoard).filter_by(board_id=id).first() if not board: return self.write(json.dumps({})) self.write(json.dumps(to_dict(board)))
def get_current_dashboard_id(dash_url): dashboard_id = None dashboard = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashDashboard).filter_by(url=dash_url).first() if dashboard: dashboard_id = dashboard.dashboard_id return dashboard_id
def get(self, id): id = int(id) # user = DBConnectionsFacade.get_edusson_ds_orm_session().query(DashUser).outerjoin(DashUser.boards).filter_by( user = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashUser).filter_by(user_id=id).first() if not user: raise MyAppException(reason='User cannot be found', status_code=400) user = to_dict(user) user['password'] = '' user['boards'] = filter( lambda x: x['dashboard_id'] == get_analytic_dashboard(), user['boards']) user['boards'] = list(map(lambda x: x['board_id'], user['boards'])) self.write(json.dumps(user))
def __init__(self): self.session = DBConnectionsFacade.get_edusson_ds_orm_session()
def get(self): boards = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashDashboardBoard).all() boards = [to_dict(board) for board in boards] self.write(json.dumps(boards))
def get(self): users = DBConnectionsFacade.get_edusson_ds_orm_session().query( DashUser).order_by(DashUser.user_id).all() users = [to_dict(user) for user in users] self.write(json.dumps(users))