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) {
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')

View File

@ -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;
}

View File

@ -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);

View File

@ -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;