-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add API v3 routes for GET/POST forms
Signed-off-by: Christian Hartmann <[email protected]>
- Loading branch information
1 parent
30d7d8d
commit 35b5e92
Showing
4 changed files
with
30 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> | ||
* | ||
* @author affan98 <[email protected]> | ||
* @author Christian Hartmann <[email protected]> | ||
* @author Ferdinand Thiessen <[email protected]> | ||
* @author Jan-Christoph Borchardt <[email protected]> | ||
* @author John Molakvoæ (skjnldsv) <[email protected]> | ||
|
@@ -102,15 +103,21 @@ public function __construct( | |
* Return only with necessary information for Listing. | ||
* @return DataResponse | ||
*/ | ||
public function getForms(): DataResponse { | ||
$forms = $this->formMapper->findAllByOwnerId($this->currentUser->getUID()); | ||
public function getForms(string $type = 'owned'): DataResponse { | ||
if ($type == 'owned') { | ||
$forms = $this->formMapper->findAllByOwnerId($this->currentUser->getUID()); | ||
|
||
$result = []; | ||
foreach ($forms as $form) { | ||
$result[] = $this->formsService->getPartialFormArray($form); | ||
} | ||
$result = []; | ||
foreach ($forms as $form) { | ||
$result[] = $this->formsService->getPartialFormArray($form); | ||
} | ||
|
||
return new DataResponse($result); | ||
return new DataResponse($result); | ||
} elseif ($type == 'shared') { | ||
return $this->getSharedForms(); | ||
} else { | ||
throw new OCSBadRequestException(); | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters