removed isHiring from Organization. Will be calculated

This commit is contained in:
xfarrow 2024-03-18 16:24:56 +01:00
parent 61f021db3c
commit 8636416003
4 changed files with 9 additions and 6 deletions

View File

@ -47,6 +47,11 @@ async function insert(requester, organizationId, title, description, requirement
async function remove(requester, jobOfferId) { async function remove(requester, jobOfferId) {
const jobOffer = await findById(jobOfferId); const jobOffer = await findById(jobOfferId);
if(!jobOffer){
return false;
}
const isAdmin = await OrganizationAdmin.isAdmin(requester, jobOffer.organization_id); const isAdmin = await OrganizationAdmin.isAdmin(requester, jobOffer.organization_id);
if (isAdmin) { if (isAdmin) {
const deletedRows = await knex('JobOffer') const deletedRows = await knex('JobOffer')

View File

@ -21,12 +21,11 @@ const knex = require('../utils/knex_config');
* @param {*} isHiring * @param {*} isHiring
* @returns * @returns
*/ */
function createOrganization(name, location, description, isHiring) { function createOrganization(name, location, description) {
const organization = { const organization = {
name: name, name: name,
location: location, location: location,
description: description, description: description
is_hiring: isHiring
}; };
return organization; return organization;
} }

View File

@ -34,7 +34,7 @@ async function createOrganization(req, res) {
errors: errors.array() errors: errors.array()
}); });
} }
const organization = Organization.createOrganization(req.body.name, req.body.location, req.body.description, req.body.is_hiring); const organization = Organization.createOrganization(req.body.name, req.body.location, req.body.description);
const insertedOrganization = await Organization.insert(organization, req.jwt.person_id); const insertedOrganization = await Organization.insert(organization, req.jwt.person_id);
res.set('Location', `/api/organizations/${insertedOrganization.id}`); res.set('Location', `/api/organizations/${insertedOrganization.id}`);
return res.status(201).json(insertedOrganization); return res.status(201).json(insertedOrganization);

View File

@ -7,8 +7,7 @@ CREATE TABLE IF NOT EXISTS public."Organization"
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
name character varying(128) NOT NULL, name character varying(128) NOT NULL,
location character varying, location character varying,
description text, description text
is_hiring boolean
) )
TABLESPACE pg_default; TABLESPACE pg_default;