示例#1
0
def saveApplicantData(jobRef, Name, Experience_years, Phone_number, Email,
                      cv_link, IdUserDb):
    Apply_date = datetime.datetime.now()
    query = cursor.execute(f'''INSERT INTO Applicant
    ( 
        jobRef, Name, Experience_years, Phone_number, Email, cv_link, Apply_date, IdUserDb
    ) 
    VALUES 
    ('{jobRef}', '{Name}', {Experience_years}, '{Phone_number}', '{Email}', '{cv_link}', '{Apply_date}', '{IdUserDb}')
    ''')
    cnxn.commit()
示例#2
0
def list_jobs(user_id, role_id):
    if (role_id == 100):
        query = f"SELECT JobRef,Title FROM jobs WHERE IdUserDb='{user_id}'"
    else:
        query = f"SELECT JobRef,Title FROM jobs WHERE IdUserDb='{user_id}' And Role={role_id}"

    jobs = cursor.execute(query)
    possible_jobs = []
    for row in jobs:
        possible_jobs.append({"jobRef": row[0], "jobTitle": row[1]})

    return possible_jobs
示例#3
0
def list_internships(user_id, degree):
   degree = get_degree(degree)
   if(degree == 0):
      internships = cursor.execute(f"SELECT Title, RefInternship FROM internships WHERE IdUserDb='{user_id}'")  
   internships = cursor.execute(f"SELECT Title, RefInternship FROM internships WHERE IdUserDb='{user_id}' and Degree={degree}")
   
   if not internships : 
      return "no available internships opportunity at the moment"

   possible_internships = []
   for row in internships:
      possible_internships.append(
         {
            "internshipRef": row[0],
            "internshipTitle": row[1]
         }
      )
   if len(possible_internships) == 0 : 
      possible_internships =  "no available internships opportunity at the moment"

   return possible_internships
示例#4
0
def get_job_data(job_option, JobRef, user_id):
    job_option = transform_option(job_option)
    query = cursor.execute(
        f"SELECT {job_option.capitalize()} FROM jobs WHERE JobRef='{JobRef}' AND IdUserDb='{user_id}'"
    )

    job_data = ""
    for row in query:
        job_data = row[0]

    if (type(job_data) is datetime.datetime):
        return job_data.strftime(f'''%d/%m/%Y''')

    return job_data
示例#5
0
def detail_internship(ref, user_id):
   internships = cursor.execute(f"SELECT Description, Technologies, Period, ExpirationDate FROM internships WHERE IdUserDb='{user_id}' and RefInternship='{ref}'")

   description = ""
   technologies = ""
   period = ""
   deadline = ""
   for row in internships.fetchall():
      description = "" + row[0]
      technologies = "" + row[1]
      period = "" + row[2]
      deadline = "" +row[3]

   # if(datetime.datetime.now() < deadline):
   #    deadline = "" + deadline.strftime(f'''%d/%m/%Y''')
   message = f"description: {description} \ntechnologies:{technologies}\nperiod: {period}\ndeadline: {deadline}"
   
   return message
示例#6
0
def getLocation(user_id):
    intro = cursor.execute(
        f"SELECT Location FROM Infos WHERE IdUserDb='{user_id}'")
    info_data = check_error(intro, "Not currently available :c")
    return info_data