Ejemplo n.º 1
0
 def post(self, decoded_payload):
     ''' Assign courses to lecturers '''
     email = decoded_payload.get('email')
     data = request.json.get('payload')
     payload = hod_api.payload.get('payload') or data
     response, code = HODService.assign_courses(email=email, data=payload)
     return response, code
Ejemplo n.º 2
0
    def post(self):
        ''' Signup a new HOD '''
        data = request.json
        payload = hod_api.payload or data
        schema = NewHODSchema()

        try:
            new_payload = schema.load(payload)._asdict()
        except ValidationError as e:
            response = {'success': False, 'error': e.messages}
            return response, 400
        response, code = HODService.create_hod(data=new_payload)
        return response, code
Ejemplo n.º 3
0
    def post(self, decoded_payload):
        ''' Edit details of logged in HOD '''
        email = decoded_payload.get('email')
        data = request.json
        schema = EditHODSchema()
        payload = hod_api.payload or data

        try:
            new_payload = schema.load(payload)._asdict()
        except ValidationError as e:
            response = {'success': False, 'error': e.messages}
            return response, 400

        response, code = HODService.edit_me(email=email, data=new_payload)
        return response, code
 def get(self, semester, decoded_payload):
     email = decoded_payload.get('email')
     response, code = HODService.get_courses(email=email, semester=semester)
     return response, code
 def get(self, decoded_payload):
     email = decoded_payload.get('email')
     response, code = HODService.get_lecturers(email=email)
     return response, code
Ejemplo n.º 6
0
 def get(self, decoded_payload):
     ''' Get details of logged in HOD '''
     email = decoded_payload.get('email')
     response, code = HODService.get_me(email=email)
     return response, code
Ejemplo n.º 7
0
 def get(self, semester, decoded_payload):
     ''' View courses and assigned lecturers '''
     email = decoded_payload.get('email')
     response, code = HODService.get_assigned(email=email,
                                              semester=semester)
     return response, code
Ejemplo n.º 8
0
 def get(self, semester, decoded_payload):
     ''' Get all courses in HOD's department filtered by provided semester '''
     email = decoded_payload.get('email')
     response, code = HODService.get_courses(email=email, semester=semester)
     return response, code
Ejemplo n.º 9
0
 def get(self, decoded_payload):
     ''' Get all lecturers in HOD's department '''
     email = decoded_payload.get('email')
     response, code = HODService.get_lecturers(email=email)
     return response, code