diff --git a/backend/apis/nodejs/src/models/job_offer_model.js b/backend/apis/nodejs/src/models/job_offer_model.js index 82f094e..aa1e3fd 100644 --- a/backend/apis/nodejs/src/models/job_offer_model.js +++ b/backend/apis/nodejs/src/models/job_offer_model.js @@ -47,6 +47,11 @@ async function insert(requester, organizationId, title, description, requirement async function remove(requester, jobOfferId) { const jobOffer = await findById(jobOfferId); + + if(!jobOffer){ + return false; + } + const isAdmin = await OrganizationAdmin.isAdmin(requester, jobOffer.organization_id); if (isAdmin) { const deletedRows = await knex('JobOffer') diff --git a/backend/apis/nodejs/src/models/organization_model.js b/backend/apis/nodejs/src/models/organization_model.js index b200f3e..cae44b3 100644 --- a/backend/apis/nodejs/src/models/organization_model.js +++ b/backend/apis/nodejs/src/models/organization_model.js @@ -21,12 +21,11 @@ const knex = require('../utils/knex_config'); * @param {*} isHiring * @returns */ -function createOrganization(name, location, description, isHiring) { +function createOrganization(name, location, description) { const organization = { name: name, location: location, - description: description, - is_hiring: isHiring + description: description }; return organization; } diff --git a/backend/apis/nodejs/src/routes/organization_routes.js b/backend/apis/nodejs/src/routes/organization_routes.js index fb4d657..ae2899c 100644 --- a/backend/apis/nodejs/src/routes/organization_routes.js +++ b/backend/apis/nodejs/src/routes/organization_routes.js @@ -34,7 +34,7 @@ async function createOrganization(req, res) { 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); res.set('Location', `/api/organizations/${insertedOrganization.id}`); return res.status(201).json(insertedOrganization); diff --git a/backend/sql/3-create_organization.sql b/backend/sql/3-create_organization.sql index b46f8df..5a50921 100644 --- a/backend/sql/3-create_organization.sql +++ b/backend/sql/3-create_organization.sql @@ -7,8 +7,7 @@ CREATE TABLE IF NOT EXISTS public."Organization" id SERIAL PRIMARY KEY, name character varying(128) NOT NULL, location character varying, - description text, - is_hiring boolean + description text ) TABLESPACE pg_default;