mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
max 360 days expiracy for creation poll
This commit is contained in:
parent
a69c3ab1da
commit
d3f3b75252
@ -1,7 +1,8 @@
|
||||
nelmio_cors:
|
||||
defaults:
|
||||
origin_regex: true
|
||||
allow_origin: [ '%env(CORS_ALLOW_ORIGIN)%' ] # you can test locally with this value '^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
|
||||
# allow_origin: [ '%env(CORS_ALLOW_ORIGIN)%' ] # you can test locally with this value '^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
|
||||
allow_origin: [ '^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$' ]
|
||||
allow_methods: [ 'GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE' ]
|
||||
allow_headers: [ '*' ]
|
||||
expose_headers: [ 'Authorization' ]
|
||||
|
@ -265,7 +265,7 @@ class PollController extends EmailsController {
|
||||
* requirements = {"creator"="\w+"}
|
||||
* )
|
||||
* @param Request $request
|
||||
*
|
||||
* @description create a new poll
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function newPollAction( Request $request ) {
|
||||
@ -291,8 +291,10 @@ class PollController extends EmailsController {
|
||||
// TODO check this one
|
||||
$newpoll->setAllowedAnswers( $data[ 'allowed_answers' ] );
|
||||
}
|
||||
$expiracyCalculated = $newpoll->addDaysToDate( new DateTime(),
|
||||
$data[ 'default_expiracy_days_from_now' ] );
|
||||
// define a maximum expiration
|
||||
$expiracyCalculated = min($newpoll->addDaysToDate( new DateTime(),
|
||||
$data[ 'default_expiracy_days_from_now' ] ), $newpoll->addDaysToDate( new DateTime(),
|
||||
360 ));
|
||||
|
||||
$newpoll->setExpiracyDate( $expiracyCalculated );
|
||||
$emOwner = $this->getDoctrine()->getRepository( Owner::class );
|
||||
|
Loading…
Reference in New Issue
Block a user