Skip to content

Commit

Permalink
fix: add pending group by
Browse files Browse the repository at this point in the history
JSON column with postgre need to be converted first to text to be
possible use at group by

Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos committed Apr 8, 2024
1 parent 74ae062 commit 04739d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Db/SignRequestMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace OCA\Libresign\Db;

use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use OCA\Libresign\Helper\Pagination;
use OCA\Libresign\Service\IdentifyMethod\IIdentifyMethod;
use OCA\Libresign\Service\IdentifyMethodService;
Expand Down Expand Up @@ -464,6 +465,9 @@ private function getFilesAssociatedFilesWithMeQueryBuilder(string $userId, ?stri
'f.status',
'f.created_at',
);
if (!$qb->getConnection()->getDatabasePlatform() instanceof PostgreSQLPlatform) {
$qb->addGroupBy('f.metadata');
}

$or = [
$qb->expr()->eq('f.user_id', $qb->createNamedParameter($userId)),
Expand Down
8 changes: 8 additions & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
<code>callable(QueryBuilder): void</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Db/SignRequestMapper.php">
<UndefinedClass occurrences="1">
<code>PostgreSQLPlatform</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="1">
<code>$qb-&gt;getConnection()-&gt;getDatabasePlatform()</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Files/TemplateLoader.php">
<UndefinedClass occurrences="2">
<code>LoadSidebar</code>
Expand Down

0 comments on commit 04739d5

Please sign in to comment.