Skip to content

Commit

Permalink
Merge branch 'develop' into 346-add-independent-jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-carlos-sousa authored Mar 27, 2024
2 parents 02c7145 + 82886d0 commit 581408a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/api/middleware/validators/company.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,4 @@ export const edit = useExpressValidators([
.withMessage(ValidationReasons.ARRAY_SIZE(CompanyConstants.contacts.min_length, CompanyConstants.contacts.max_length)),
body("logo", ValidationReasons.DEFAULT)
.optional()
.isString().withMessage(ValidationReasons.STRING).bail()
.isURL().withMessage(ValidationReasons.URL),
]);
5 changes: 3 additions & 2 deletions src/api/routes/company.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { concurrentOffersNotExceeded } from "../middleware/validators/validatorU

import { or } from "../middleware/utils.js";

import * as fileMiddleware from "../middleware/files.js";
import * as fileMiddleware from "../middleware/files.js";
import OfferService from "../../services/offer.js";
import AccountService from "../../services/account.js";
import Offer from "../../models/Offer.js";
Expand Down Expand Up @@ -245,7 +245,8 @@ export default (app) => {
try {
const companyService = new CompanyService();
const offerService = new OfferService();
const company = await companyService.changeAttributes(req.params.companyId, req.body);
const logo = req.file && (req?.file?.url || `${config.webserver_host}/static/${req.file.filename}`);
const company = await companyService.changeAttributes(req.params.companyId, { ...req.body, logo });
await offerService.updateAllOffersByCompanyId(company);
return res.json(company);
} catch (err) {
Expand Down

0 comments on commit 581408a

Please sign in to comment.