def assignment_insert(self, assignment): """ Add or update an assignment owned by the given user """ if assignment.from_datastore: assignment_with_parent = assignment else: assignment_with_parent = Assignment(parent = main.get_parent_key(endpoints.get_current_user()), name = assignment.name) assignment_with_parent.put() return assignment_with_parent
def assignment_insert(self, assignment): if assignment.from_datastore: assignment_with_parent = assignment else: assignment_with_parent = Assignment(parent=main.get_parent_key(endpoints.get_current_user()), name=assignment.name) assignment_with_parent.put() return assignment_with_parent
def note_insert(self, note): if note.from_datastore: note_with_parent = note else: note_with_parent = Note(parent=main.get_parent_key(endpoints.get_current_user()), note = note.note, company_entity_key = note.company_entity_key) note_with_parent.put() return note_with_parent
def favorite_insert(self, favorite): if favorite.from_datastore: favorite_with_parent = favorite else: favorite_with_parent = Favorite(parent=main.get_parent_key(endpoints.get_current_user()), company_entity_key = favorite.company_entity_key) favorite_with_parent.put() return favorite_with_parent
def favorite_insert(self, favorite): if favorite.from_datastore: favorite_with_parent = favorite else: favorite_with_parent = Favorite( parent=main.get_parent_key(endpoints.get_current_user()), company_entity_key=favorite.company_entity_key) favorite_with_parent.put() return favorite_with_parent
def note_for_company(self, request): user = endpoints.get_current_user() query = Note.query(ancestor=main.get_parent_key(user)).filter(Note.company_entity_key == request.company_entity_key) returnNote = Note(note="", company_entity_key=request.company_entity_key) for note in query: returnNote = note break return returnNote
def note_insert(self, note): if note.from_datastore: note_with_parent = note else: note_with_parent = Note(parent=main.get_parent_key( endpoints.get_current_user()), note=note.note, company_entity_key=note.company_entity_key) note_with_parent.put() return note_with_parent
def favorite_for_company(self, request): user = endpoints.get_current_user() query = Favorite.query(ancestor=main.get_parent_key(user)).filter(Favorite.company_entity_key == request.company_entity_key) returnFavorite = Favorite(message="null") for favorite in query: returnFavorite = favorite break return returnFavorite
def favorite_for_company(self, request): user = endpoints.get_current_user() query = Favorite.query(ancestor=main.get_parent_key(user)).filter( Favorite.company_entity_key == request.company_entity_key) returnFavorite = Favorite(message="null") for favorite in query: returnFavorite = favorite break return returnFavorite
def company_insert_favorite(self, request): user = endpoints.get_current_user() favBool = request.favorite key = ndb.Key(urlsafe=request.entityKey) query_favorite = Favorite.query( ancestor=main.get_parent_key(user)).filter( Favorite.company_entity_key == key) my_favorite = Favorite(parent=main.get_parent_key(user), company_entity_key=key) found = False logging.info(favBool) for item in query_favorite: logging.info("favorite logged") my_favorite = item found = True logging.info(my_favorite) if favBool: logging.info("favorite bool = True") if not found: logging.info("creating favorite") # my_favorite = Favorite(parent=main.get_parent_key(user), company_entity_key=key) my_favorite.put() else: if found: logging.info("delete") my_favorite.key.delete() return request
def note_for_company(self, request): user = endpoints.get_current_user() query = Note.query(ancestor=main.get_parent_key(user)).filter( Note.company_entity_key == request.company_entity_key) returnNote = Note(note="", company_entity_key=request.company_entity_key) for note in query: returnNote = note break return returnNote
def profile_insert(self, request): """ insert or update profile """ if request.from_datastore: my_profile_with_parent = request else: my_profile_with_parent = Profile(parent = main.get_parent_key(endpoints.get_current_user()), first_name=request.first_name, last_name=request.last_name, phone_number=request.phone_number, friends=request.friends, events=request.events) my_profile_with_parent.put() return my_profile_with_parent
def company_list_favorite(self, query): # list of companies with favorite boolean attached to favorites user = endpoints.get_current_user() for company in query: company.favorite = False key = ndb.Key(urlsafe=company.entityKey) favQuery = Favorite.query(ancestor=main.get_parent_key(user)).filter(Favorite.company_entity_key == key) for favorite in favQuery: company.favorite = True return query
def profile_insert(self, request): """ insert or update profile """ if request.from_datastore: my_profile_with_parent = request else: my_profile_with_parent = Profile(parent=main.get_parent_key( endpoints.get_current_user()), first_name=request.first_name, last_name=request.last_name, phone_number=request.phone_number, friends=request.friends, events=request.events) my_profile_with_parent.put() return my_profile_with_parent
def company_insert_favorite(self, request): user = endpoints.get_current_user() favBool = request.favorite key = ndb.Key(urlsafe=request.entityKey) query_favorite = Favorite.query(ancestor=main.get_parent_key(user)).filter(Favorite.company_entity_key == key) my_favorite = Favorite(parent=main.get_parent_key(user), company_entity_key=key) found = False logging.info(favBool) for item in query_favorite: logging.info("favorite logged") my_favorite = item found = True logging.info(my_favorite) if favBool: logging.info("favorite bool = True") if not found: logging.info("creating favorite") # my_favorite = Favorite(parent=main.get_parent_key(user), company_entity_key=key) my_favorite.put() else: if found: logging.info("delete") my_favorite.key.delete() return request
def company_list_favorite(self, query): # list of companies with favorite boolean attached to favorites user = endpoints.get_current_user() for company in query: company.favorite = False key = ndb.Key(urlsafe=company.entityKey) favQuery = Favorite.query( ancestor=main.get_parent_key(user)).filter( Favorite.company_entity_key == key) for favorite in favQuery: company.favorite = True return query
def student_list(self, query): """ List all the students for a given user """ user = endpoints.get_current_user() students = Student.query(ancestor=main.get_parent_key(user)).order(Student.rose_username) return students
def assignments_list(self, query): user = endpoints.get_current_user() assignments = Assignment.query(ancestor=main.get_parent_key(user)).order(Assignment.name) return assignments
def profile_get(self, query): """ get the current user's profile """ user = endpoints.get_current_user() profile = Profile.query(ancestor=main.get_parent_key(user)).order( Profile.first_name) return profile
def profile_get(self, query): """ get the current user's profile """ user = endpoints.get_current_user() profile=Profile.query(ancestor=main.get_parent_key(user)).order(Profile.first_name) return profile
def assignment_list(self, query): """ List all the assignments owned by the given user """ user = endpoints.get_current_user() assignments = Assignment.query(ancestor=main.get_parent_key(user)).order(Assignment.name) return assignments
def student_list(self, query): user = endpoints.get_current_user() students = Student.query(ancestor=main.get_parent_key(user)).order(Student.rose_username) return students