def get(self, id):
        application = ApplicationModel.find_by_job(id)
        candidate_list_id = []
        for appl in application:
            candidate_list_id.append(appl.json()['candidate'])
        candidates_applied = []
        for id in candidate_list_id:
            candidate = UserModel.find_by_id(id).json()
            candidates_applied.append(candidate)

        return candidates_applied
Beispiel #2
0
    def get(self, id):
        claims = get_jwt_claims()
        id_recruiter = claims['identity']
        jobs = JobModel.find_by_posted_by(id_recruiter)
        id_exists = False
        for job in jobs:
            if job.json()['id'] == id:
                id_exists = True

        if id_exists:
            application = ApplicationModel.find_by_job(id)
            candidate_list_id = []
            for appl in application:
                candidate_list_id.append(appl.json()['candidate'])
            candidates_applied = []
            for id in candidate_list_id:
                candidate = UserModel.find_by_id(id).json()
                candidates_applied.append(candidate)
            return candidates_applied
        else:
            return {
                'message': 'Job Not Associated with the recruiter',
                'error': 'unauthorized_access'
            }, 401