| 20 | use OCP\AppFramework\Http\Attribute\NoAdminRequired; |
| 21 | |
| 22 | class DataloadController extends Controller |
| 23 | { |
| 24 | private $logger; |
| 25 | private $DataloadService; |
| 26 | |
| 27 | public function __construct( |
| 28 | string $appName, |
| 29 | IRequest $request, |
| 30 | LoggerInterface $logger, |
| 31 | DataloadService $DataloadService |
| 32 | ) |
| 33 | { |
| 34 | parent::__construct($appName, $request); |
| 35 | $this->logger = $logger; |
| 36 | $this->DataloadService = $DataloadService; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * create a new dataload |
| 41 | * |
| 42 | * @param $datasetId |
| 43 | * @param int $datasourceId |
| 44 | * @return DataResponse |
| 45 | * @throws \OCP\DB\Exception |
| 46 | */ |
| 47 | #[NoAdminRequired] |
| 48 | public function create($datasetId, int $datasourceId): DataResponse |
| 49 | { |
| 50 | return new DataResponse(['id' => $this->DataloadService->create($datasetId, $datasourceId)]); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * get all data loads for a dataset or report |
| 55 | * |
| 56 | * @param $datasetId |
| 57 | * @param $reportId |
| 58 | * @return DataResponse |
| 59 | */ |
| 60 | #[NoAdminRequired] |
| 61 | public function read($datasetId): DataResponse |
| 62 | { |
| 63 | return new DataResponse(['dataloads' => $this->DataloadService->read($datasetId)]); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * update dataload |
| 68 | * |
| 69 | * @param int $dataloadId |
| 70 | * @param $name |
| 71 | * @param $option |
| 72 | * @param $schedule |
| 73 | * @return DataResponse |
| 74 | */ |
| 75 | #[NoAdminRequired] |
| 76 | public function update(int $dataloadId, $name, $option, $schedule, $storageMapping = null): DataResponse |
| 77 | { |
| 78 | return new DataResponse(['update' => $this->DataloadService->update($dataloadId, $name, $option, $schedule, $storageMapping)]); |
| 79 | } |
nothing calls this directly
no outgoing calls
no test coverage detected