diff --git a/appinfo.xml b/appinfo.xml
new file mode 100644
index 0000000..1a23cd3
--- /dev/null
+++ b/appinfo.xml
@@ -0,0 +1,9 @@
+
+
+ deckflow
+ Deckflow
+ Automatische Workflows für Nextcloud Decks
+ 1.0.0
+ Dein Name
+ GPL-3.0
+
\ No newline at end of file
diff --git a/appinfo/application.php b/appinfo/application.php
deleted file mode 100644
index 97519ae..0000000
--- a/appinfo/application.php
+++ /dev/null
@@ -1,22 +0,0 @@
-getContainer()->registerService('SettingsController', function($c) {
- return new SettingsController(
- $c->query('OCP\IRequest'),
- $c->query('OCP\IUserSession'),
- $c->query('OCA\Deckflow\Service\WorkflowService')
- );
- });
- }
-}
diff --git a/appinfo/routes.php b/appinfo/routes.php
deleted file mode 100644
index 7c5732a..0000000
--- a/appinfo/routes.php
+++ /dev/null
@@ -1,20 +0,0 @@
-registerService('SettingsController', function(IContainer $c) {
- return new \OCA\Deckflow\Controller\SettingsController(
- $c->query('OCP\IRequest'),
- $c->query('OCP\IUserSession'),
- $c->query('OCA\Deckflow\Service\WorkflowService')
- );
-});
-
-// Hier wird die Route für den Webhook definiert
-$container->registerService('WebhookController', function(IContainer $c) {
- return new \OCA\Deckflow\Controller\WebhookController(
- $c->query('OCP\IRequest'),
- $c->query('OCA\Deckflow\Service\WorkflowService')
- );
-});
diff --git a/assets/js/addWorkflow.js b/assets/js/addWorkflow.js
deleted file mode 100644
index c9e7304..0000000
--- a/assets/js/addWorkflow.js
+++ /dev/null
@@ -1,24 +0,0 @@
-document.getElementById('addWorkflow').addEventListener('click', function() {
- let workflowContainer = document.getElementById('workflows');
- let newWorkflow = document.createElement('div');
- newWorkflow.classList.add('workflow');
-
- newWorkflow.innerHTML = `
-
-
-
-
-
-
-
-
- `;
-
- workflowContainer.appendChild(newWorkflow);
-});
diff --git a/composer.json b/composer.json
index 0d6deaf..682248b 100644
--- a/composer.json
+++ b/composer.json
@@ -1,15 +1,22 @@
{
- "name": "deckflow",
- "description": "Automatisierung von Deck Workflows mit Flow",
+ "name": "deckflow/deckflow",
+ "description": "Automatische Workflows für Nextcloud Decks",
"type": "nextcloud-app",
+ "version": "1.0.0",
+ "license": "GPL-3.0",
+ "authors": [
+ {
+ "name": "Dein Name",
+ "email": "deine@email.de"
+ }
+ ],
"require": {
- "php": ">=7.2",
- "nextcloud/server": "^23.0"
+ "php": "^7.2",
+ "nextcloud/app-framework": "^1.0"
},
"autoload": {
"psr-4": {
- "OCA\\Deckflow\\": "lib/"
+ "Deckflow\\": "src/"
}
}
- }
-
\ No newline at end of file
+ }
\ No newline at end of file
diff --git a/controller/SettingsController.php b/controller/SettingsController.php
deleted file mode 100644
index 3d13baf..0000000
--- a/controller/SettingsController.php
+++ /dev/null
@@ -1,33 +0,0 @@
-workflowService = $workflowService;
- }
-
- public function showSettingsForm() {
- $workflows = $this->workflowService->getWorkflows();
- return $this->render('settings.php', [
- 'workflows' => $workflows
- ]);
- }
-
- public function saveWorkflows() {
- $deckId = $_POST['deckId'];
- $sourceStackId = $_POST['sourceStack'];
- $targetStackId = $_POST['targetStack'];
-
- $this->workflowService->saveWorkflows($deckId, $sourceStackId, $targetStackId);
- }
-}
diff --git a/controller/WebhookController.php b/controller/WebhookController.php
deleted file mode 100644
index 3fc735e..0000000
--- a/controller/WebhookController.php
+++ /dev/null
@@ -1,25 +0,0 @@
-workflowService = $workflowService;
- }
-
- public function moveCards() {
- $deckId = $_POST['deckId'];
- $sourceStackId = $_POST['sourceStackId'];
- $targetStackId = $_POST['targetStackId'];
-
- $this->workflowService->moveOverdueCards($deckId, $sourceStackId, $targetStackId);
- }
-}
diff --git a/cron.php b/cron.php
deleted file mode 100644
index ca4464c..0000000
--- a/cron.php
+++ /dev/null
@@ -1,11 +0,0 @@
-getWorkflows();
-
-foreach ($workflows as $workflow) {
- $workflowService->moveOverdueCards($workflow['deck_id'], $workflow['source_stack_id'], $workflow['target_stack_id']);
-}
diff --git a/db/schema.xml b/db/schema.xml
deleted file mode 100644
index 535ca92..0000000
--- a/db/schema.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
diff --git a/lib/Service/WorkflowService.php b/lib/Service/WorkflowService.php
deleted file mode 100644
index 112fb73..0000000
--- a/lib/Service/WorkflowService.php
+++ /dev/null
@@ -1,61 +0,0 @@
-db = $db;
- $this->userSession = $userSession;
- $this->deckService = $deckService;
- }
-
- // Speichert die Workflows
- public function saveWorkflows($deckId, $sourceStackId, $targetStackId) {
- $userId = $this->userSession->getUser()->getUID();
- $this->db->executeQuery("INSERT INTO *PREFIX*deckflow_workflows (user_id, deck_id, source_stack_id, target_stack_id)
- VALUES (?, ?, ?, ?)", [
- $userId,
- $deckId,
- $sourceStackId,
- $targetStackId
- ]);
- }
-
- // Ruft alle Workflows für den aktuellen Benutzer ab
- public function getWorkflows() {
- $userId = $this->userSession->getUser()->getUID();
- $result = $this->db->executeQuery("SELECT * FROM *PREFIX*deckflow_workflows WHERE user_id = ?", [$userId]);
- return $result->fetchAll();
- }
-
- // Webhook zur Ausführung des Workflows, Karten zu verschieben
- public function moveOverdueCards($deckId, $sourceStackId, $targetStackId) {
- $deck = $this->deckService->getDeckById($deckId);
- $sourceStack = $deck->getStackById($sourceStackId);
- $targetStack = $deck->getStackById($targetStackId);
-
- foreach ($sourceStack->getCards() as $card) {
- if ($this->isCardOverdue($card)) {
- $this->moveCardToTargetStack($card, $targetStack);
- }
- }
- }
-
- private function isCardOverdue($card) {
- $dueDate = $card->getDueDate();
- return $dueDate && $dueDate < time();
- }
-
- private function moveCardToTargetStack($card, $targetStack) {
- $this->deckService->moveCardToStack($card, $targetStack);
- }
-}
diff --git a/src/BackgroundJob/WorkflowJob.php b/src/BackgroundJob/WorkflowJob.php
new file mode 100644
index 0000000..1f77570
--- /dev/null
+++ b/src/BackgroundJob/WorkflowJob.php
@@ -0,0 +1,22 @@
+workflowMapper = $workflowMapper;
+ }
+
+ protected function run($argument)
+ {
+ // Hier kommt die Logik für das Ausführen des Workflows hin
+ }
+}
\ No newline at end of file
diff --git a/src/Controller/DeckflowController.php b/src/Controller/DeckflowController.php
new file mode 100644
index 0000000..0e591bc
--- /dev/null
+++ b/src/Controller/DeckflowController.php
@@ -0,0 +1,32 @@
+request = $request;
+ }
+
+ public function index()
+ {
+ return new TemplateResponse('deckflow', 'index');
+ }
+
+ public function createWorkflow()
+ {
+ // Hier kommt die Logik für das Erstellen eines Workflows hin
+ }
+
+ public function editWorkflow()
+ {
+ // Hier kommt die Logik für das Bearbeiten eines Workflows hin
+ }
+}
\ No newline at end of file
diff --git a/src/Db/WorkflowMapper.php b/src/Db/WorkflowMapper.php
new file mode 100644
index 0000000..008aaa8
--- /dev/null
+++ b/src/Db/WorkflowMapper.php
@@ -0,0 +1,20 @@
+?php
+
+namespace Deckflow\Db;
+
+use OCP\AppFramework\Db\Mapper;
+use Deckflow\Model\Workflow;
+
+class WorkflowMapper extends Mapper
+{
+ public function __construct(\OCP\IDBConnection $db)
+ {
+ parent::__construct($db, 'deckflow_workflows', Workflow::class);
+ }
+
+ public function findWorkflowsByUserId($userId)
+ {
+ $sql = 'SELECT * FROM deckflow_workflows WHERE user_id = ?';
+ return $this->findEntities($sql, [$userId]);
+ }
+}
\ No newline at end of file
diff --git a/src/Model/Workflow.php b/src/Model/Workflow.php
new file mode 100644
index 0000000..5d9f8fe
--- /dev/null
+++ b/src/Model/Workflow.php
@@ -0,0 +1,25 @@
+addType('id', 'integer');
+ $this->addType('userId', 'string');
+ $this->addType('deckId', 'integer');
+ $this->addType('sourceStackId', 'integer');
+ $this->addType('targetStackId', 'integer');
+ $this->addType('createdAt', 'timestamp');
+ }
+}
\ No newline at end of file
diff --git a/templates/settings.php b/templates/settings.php
deleted file mode 100644
index 4636244..0000000
--- a/templates/settings.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
Deckflow Einstellungen
-
-
-