Fixed wrong mapping on tracks endpoints
changed mapping from title to name Change-Id: I6b1e778ab75d472a2cf2e2b3be6a837d54ee49e7
This commit is contained in:
parent
a32759f2dd
commit
0713cc835e
@ -307,7 +307,7 @@ final class OAuth2SummitTracksApiController extends OAuth2ProtectedController
|
||||
if (is_null($summit)) return $this->error404();
|
||||
|
||||
$rules = [
|
||||
'title' => 'required|string|max:50',
|
||||
'name' => 'required|string|max:50',
|
||||
'description' => 'required|string|max:500',
|
||||
'code' => 'sometimes|string|max:5',
|
||||
'session_count' => 'sometimes|integer',
|
||||
@ -405,7 +405,7 @@ final class OAuth2SummitTracksApiController extends OAuth2ProtectedController
|
||||
if (is_null($summit)) return $this->error404();
|
||||
|
||||
$rules = [
|
||||
'title' => 'sometimes|string|max:50',
|
||||
'name' => 'sometimes|string|max:50',
|
||||
'description' => 'sometimes|string|max:500',
|
||||
'code' => 'sometimes|string|max:5',
|
||||
'session_count' => 'sometimes|integer',
|
||||
|
@ -36,8 +36,8 @@ final class PresentationCategoryFactory
|
||||
* @return PresentationCategory
|
||||
*/
|
||||
public static function populate(PresentationCategory $track, array $data){
|
||||
if(isset($data['title']))
|
||||
$track->setTitle(trim($data['title']));
|
||||
if(isset($data['name']))
|
||||
$track->setTitle(trim($data['name']));
|
||||
|
||||
if(isset($data['code']) && !empty($data['code']))
|
||||
$track->setCode(trim($data['code']));
|
||||
|
@ -64,9 +64,9 @@ final class SummitTrackService
|
||||
throw new ValidationException(sprintf("track id %s already has code %s assigned on summit id %s", $former_track->getId(), $data['code'], $summit->getId()));
|
||||
}
|
||||
|
||||
$former_track = $summit->getPresentationCategoryByTitle($data['title']);
|
||||
$former_track = $summit->getPresentationCategoryByTitle($data['name']);
|
||||
if (!is_null($former_track))
|
||||
throw new ValidationException(sprintf("track id %s already has title %s assigned on summit id %s", $former_track->getId(), $data['title'], $summit->getId()));
|
||||
throw new ValidationException(sprintf("track id %s already has title %s assigned on summit id %s", $former_track->getId(), $data['name'], $summit->getId()));
|
||||
|
||||
$track = PresentationCategoryFactory::build($summit, $data);
|
||||
|
||||
@ -105,10 +105,10 @@ final class SummitTrackService
|
||||
throw new ValidationException(sprintf("track id %s already has code %s assigned on summit id %s", $former_track->getId(), $data['code'], $summit->getId()));
|
||||
}
|
||||
|
||||
if (isset($data['title'])) {
|
||||
$former_track = $summit->getPresentationCategoryByTitle($data['title']);
|
||||
if (isset($data['name'])) {
|
||||
$former_track = $summit->getPresentationCategoryByTitle($data['name']);
|
||||
if (!is_null($former_track) && $former_track->getId() != $track_id)
|
||||
throw new ValidationException(sprintf("track id %s already has title %s assigned on summit id %s", $former_track->getId(), $data['title'], $summit->getId()));
|
||||
throw new ValidationException(sprintf("track id %s already has title %s assigned on summit id %s", $former_track->getId(), $data['name'], $summit->getId()));
|
||||
}
|
||||
|
||||
$track = PresentationCategoryFactory::populate($track, $data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user