def mailsentall(job_applications_id): return send_request( 'SELECT mail_sent.id, mail_content, date_sent, mail_sent.id_job_application FROM mail_sent INNER JOIN job_applications ON job_applications.id = mail_sent.id_job_application WHERE job_applications.id = %s;', job_applications_id)
def contracts(): return send_request('SELECT * FROM contract_types;')
def jobsall(): return send_request('SELECT * from jobs;')
def onejobapplicationid(job_applications_id): return send_request( 'SELECT job_applications.id, job_applications.date, id_advertisements, id_users, job_applications.name, job_applications.firstname, job_applications.email, job_applications.phone, message FROM job_applications INNER JOIN advertisement ON advertisement.id = job_applications.id_advertisements INNER JOIN users ON users.id = job_applications.id_users WHERE job_applications.id = %s;', job_applications_id)
def citiesall(): return send_request('SELECT * from cities;')
def onejobapplicationbyadvertisement(advertisement_id): return send_request( 'SELECT job_applications.id, job_applications.date, id_advertisements, id_users FROM job_applications INNER JOIN advertisement ON advertisement.id = job_applications.id_advertisements INNER JOIN users ON users.id = job_applications.id_users WHERE advertisement.id = %s;', advertisement_id)
def adminjobapplicationsall(): return send_request( 'SELECT job_applications.id, job_applications.date, id_advertisements, id_users, job_applications.name, job_applications.firstname, job_applications.email, job_applications.phone, message FROM job_applications INNER JOIN advertisement ON advertisement.id = job_applications.id_advertisements INNER JOIN users ON users.id = job_applications.id_users;' )
def companiesall(): return send_request( 'SELECT companies.id, address, description_company, email, name, phone, website, activity, city FROM companies LEFT JOIN cities ON cities.id = companies.id_cities;' )
def usertypesall(): return send_request('SELECT * from user_types;')
def onecompany(company_id): return send_request( 'SELECT companies.id, address, description_company, email, name, phone, website, activity, city FROM companies LEFT JOIN cities ON cities.id = companies.id_cities WHERE companies.id = %%s;', company_id)
def usersall(): return send_request( 'SELECT users.id, name, firstname, birthday, role, users.phone as user_phone, users.email as users_email, users.address as users_address, password, id_user_types FROM users LEFT JOIN user_types ON user_types.id = users.id_user_types;' )
def registeruser(email): return send_request('SELECT id FROM users WHERE email = %s;', email)
def oneuser(user_id): return send_request( 'SELECT users.id, name, firstname, birthday, users.phone as user_phone, users.email as users_email, users.address as users_address, password FROM users WHERE users.id = %s;', user_id)
def oneadvertisement(ad_id): return send_request( 'SELECT title, advertisement.id, date, description, salary, city, name, type_contract, experience, job_type, worktime FROM advertisement LEFT JOIN cities ON cities.id = advertisement.id_cities LEFT JOIN companies ON companies.id = advertisement.id_companies LEFT JOIN contract_types ON contract_types.id = advertisement.id_contract_types LEFT JOIN jobs ON jobs.id = advertisement.id_jobs WHERE advertisement.id = (%s);', ad_id)