Clean attachment table

Clean code
Clean attachment table

Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Vitor Mattos
2021-07-15 00:06:55 -03:00
committed by Julius Härtl
parent c5d10dafb8
commit 39a927de18
5 changed files with 24 additions and 42 deletions

View File

@@ -28,9 +28,9 @@ use JsonSchema\Validator;
use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignmentMapper;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\Label;
use OCA\Deck\Db\LabelMapper;
@@ -38,7 +38,6 @@ use OCA\Deck\Db\StackMapper;
use OCA\Deck\NotFoundException;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\Comments\MessageTooLongException;
use OCP\Comments\NotFoundException as CommentNotFoundException;
use OCP\IDBConnection;
use OCP\IUserManager;
@@ -58,6 +57,8 @@ class BoardImportService {
private $stackMapper;
/** @var CardMapper */
private $cardMapper;
/** @var AssignmentMapper */
private $assignmentMapper;
/** @var ICommentsManager */
private $commentsManager;
/** @var string */
@@ -88,6 +89,7 @@ class BoardImportService {
AclMapper $aclMapper,
LabelMapper $labelMapper,
StackMapper $stackMapper,
AssignmentMapper $assignmentMapper,
CardMapper $cardMapper,
ICommentsManager $commentsManager
) {
@@ -98,6 +100,7 @@ class BoardImportService {
$this->labelMapper = $labelMapper;
$this->stackMapper = $stackMapper;
$this->cardMapper = $cardMapper;
$this->assignmentMapper = $assignmentMapper;
$this->commentsManager = $commentsManager;
}
@@ -149,9 +152,9 @@ class BoardImportService {
public function getAllowedImportSystems(): array {
if (!$this->allowedSystems) {
$allowedSystems = glob(__DIR__ . '/BoardImport*Service.php');
$allowedSystems = array_filter($allowedSystems, function($name) {
$allowedSystems = array_filter($allowedSystems, function ($name) {
$name = basename($name);
switch($name) {
switch ($name) {
case 'ABoardImportService.php':
case 'BoardImportService.php':
case 'BoardImportCommandService.php':
@@ -177,6 +180,11 @@ class BoardImportService {
return $this->systemInstance;
}
public function insertAssignment($assignment): self {
$this->assignmentMapper->insert($assignment);
return $this;
}
public function importBoard() {
$board = $this->getImportSystem()->getBoard();
if ($board) {