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