From aa8e67120fc281c9fae3a868805b0e8653a38b3b Mon Sep 17 00:00:00 2001 From: xfarrow Date: Wed, 13 Mar 2024 12:02:14 +0100 Subject: [PATCH] bugfixes --- .../nodejs/src/models/organization_admin_model.js | 2 +- .../nodejs/src/routes/organization_post_routes.js | 13 +++++++++++++ .../apis/nodejs/src/routes/organization_routes.js | 8 ++++---- .../validators/organization_admin_validator.js | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/backend/apis/nodejs/src/models/organization_admin_model.js b/backend/apis/nodejs/src/models/organization_admin_model.js index e356b05..5b1af12 100644 --- a/backend/apis/nodejs/src/models/organization_admin_model.js +++ b/backend/apis/nodejs/src/models/organization_admin_model.js @@ -71,7 +71,7 @@ async function removeOrganizationAdmin(personId, organizationId) { .where('id_organization', organizationId) .del(); - // TODO: If the user instead deletes their entire profile, the organization will not be deleted. Fix. (database schema) + // TODO: If the user instead deletes their entire profile, the organization will not be deleted. Fix. const remainingAdministrators = await transaction('OrganizationAdministrator') .where({ id_organization: organizationId diff --git a/backend/apis/nodejs/src/routes/organization_post_routes.js b/backend/apis/nodejs/src/routes/organization_post_routes.js index 584b8a4..73ab9e2 100644 --- a/backend/apis/nodejs/src/routes/organization_post_routes.js +++ b/backend/apis/nodejs/src/routes/organization_post_routes.js @@ -11,6 +11,19 @@ IN THE SOFTWARE. */ +/****************************************************************************** + * ⚠ WARNING ⚠ + * + * + * Posts are now scheduled to be developed at a later stage in the development + * process, with the possibility that it may not be developed at all. + * I am unsure whether it is a good thing or it'll only be used to + * flood timelines with low-effort content, like other competing platforms. + * + * + * + ******************************************************************************/ + const organizationPostModel = require('../models/organization_post_model'); const express = require('express'); const jwtUtils = require('../utils/middleware_utils'); diff --git a/backend/apis/nodejs/src/routes/organization_routes.js b/backend/apis/nodejs/src/routes/organization_routes.js index e224522..0cdc1b3 100644 --- a/backend/apis/nodejs/src/routes/organization_routes.js +++ b/backend/apis/nodejs/src/routes/organization_routes.js @@ -28,7 +28,7 @@ const organizationValidator = require('../utils/validators/organization_validato async function createOrganization(req, res) { try { - const errors = organizationValidator.createOrganizationValidator(req); + const errors = organizationValidator.validationResult(req); if (!errors.isEmpty()) { return res.status(400).json({ errors: errors.array() @@ -53,7 +53,7 @@ async function createOrganization(req, res) { * Required field(s): none. */ async function updateOrganization(req, res) { - const errors = organizationValidator.createOrganizationValidator(req); + const errors = organizationValidator.validationResult(req); if (!errors.isEmpty()) { return res.status(400).json({ errors: errors.array() @@ -109,7 +109,7 @@ async function updateOrganization(req, res) { */ async function deleteOrganization(req, res) { try { - const errors = organizationValidator.createOrganizationValidator(req); + const errors = organizationValidator.validationResult(req); if (!errors.isEmpty()) { return res.status(400).json({ errors: errors.array() @@ -141,7 +141,7 @@ async function deleteOrganization(req, res) { */ async function getOrganization(req, res) { try { - const errors = organizationValidator.createOrganizationValidator(req); + const errors = organizationValidator.validationResult(req); if (!errors.isEmpty()) { return res.status(400).json({ errors: errors.array() diff --git a/backend/apis/nodejs/src/utils/validators/organization_admin_validator.js b/backend/apis/nodejs/src/utils/validators/organization_admin_validator.js index 218442f..522f881 100644 --- a/backend/apis/nodejs/src/utils/validators/organization_admin_validator.js +++ b/backend/apis/nodejs/src/utils/validators/organization_admin_validator.js @@ -17,7 +17,7 @@ const { } = require("express-validator"); const addOrganizationAdminValidator = [ - check('id').trim().notEmpty().escape(), + check('person_id').trim().notEmpty().escape(), check('organizationId').trim().notEmpty().escape() ];