File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,4 @@ export const edit = useExpressValidators([
131131 . withMessage ( ValidationReasons . ARRAY_SIZE ( CompanyConstants . contacts . min_length , CompanyConstants . contacts . max_length ) ) ,
132132 body ( "logo" , ValidationReasons . DEFAULT )
133133 . optional ( )
134- . isString ( ) . withMessage ( ValidationReasons . STRING ) . bail ( )
135- . isURL ( ) . withMessage ( ValidationReasons . URL ) ,
136134] ) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import { concurrentOffersNotExceeded } from "../middleware/validators/validatorU
1313
1414import { or } from "../middleware/utils.js" ;
1515
16- import * as fileMiddleware from "../middleware/files.js" ;
16+ import * as fileMiddleware from "../middleware/files.js" ;
1717import OfferService from "../../services/offer.js" ;
1818import AccountService from "../../services/account.js" ;
1919import Offer from "../../models/Offer.js" ;
@@ -245,7 +245,8 @@ export default (app) => {
245245 try {
246246 const companyService = new CompanyService ( ) ;
247247 const offerService = new OfferService ( ) ;
248- const company = await companyService . changeAttributes ( req . params . companyId , req . body ) ;
248+ const logo = req . file && ( req ?. file ?. url || `${ config . webserver_host } /static/${ req . file . filename } ` ) ;
249+ const company = await companyService . changeAttributes ( req . params . companyId , { ...req . body , logo } ) ;
249250 await offerService . updateAllOffersByCompanyId ( company ) ;
250251 return res . json ( company ) ;
251252 } catch ( err ) {
You can’t perform that action at this time.
0 commit comments