mirror of
https://github.com/xfarrow/blink
synced 2025-06-27 09:03:02 +02:00
Update job_offer_model.js
This commit is contained in:
@ -47,21 +47,23 @@ 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){
|
if (!jobOffer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAdmin = await OrganizationAdmin.isAdmin(requester, jobOffer.organization_id);
|
const isAdmin = await OrganizationAdmin.isAdmin(requester, jobOffer.organization_id);
|
||||||
if (isAdmin) {
|
|
||||||
const deletedRows = await knex('JobOffer')
|
if (!isAdmin) {
|
||||||
.where({
|
|
||||||
id: jobOfferId
|
|
||||||
}).del();
|
|
||||||
return deletedRows === 1;
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deletedRows = await knex('JobOffer')
|
||||||
|
.where({
|
||||||
|
id: jobOfferId
|
||||||
|
})
|
||||||
|
.del();
|
||||||
|
return deletedRows === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findById(jobOfferId) {
|
async function findById(jobOfferId) {
|
||||||
|
Reference in New Issue
Block a user