Ejemplo n.º 1
0
    def get(self, id):
        claims = get_jwt_claims()
        print(claims)
        application = ApplicationModel.find_by_candidate(id)
        job_list_id = []
        for appl in application:
            job_list_id.append(appl.json()['job'])
        jobs_applied = []
        for list_of_jobs in job_list_id:
            job_list = JobModel.find_by_id(list_of_jobs).json()
            jobs_applied.append(job_list)

        return jobs_applied
Ejemplo n.º 2
0
    def get(self, id):
        claims = get_jwt_claims()
        print(claims)
        if claims['identity'] == id:
            application = ApplicationModel.find_by_candidate(id)
            job_list_id = []
            for appl in application:
                job_list_id.append(appl.json()['job'])
            jobs_applied = []
            for list_of_jobs in job_list_id:
                job_list = json.dumps(JobModel.find_by_id(list_of_jobs).json(),
                                      indent=1,
                                      sort_keys=True,
                                      default=str)
                jobs_applied.append(json.loads(job_list))

            return jobs_applied
        else:
            return {
                'message': 'Unauthorized Access',
                'error': 'authorization_required'
            }, 401