Fix for no Files present in tenant

This commit is contained in:
2026-03-21 17:09:38 +01:00
parent 9dbb194c8a
commit ac2e2fcfe9
3 changed files with 20 additions and 6 deletions

View File

@@ -237,7 +237,7 @@ export default async function fileRoutes(server: FastifyInstance) {
// MULTIPLE PRESIGNED URLs
// -------------------------------------------------
if (!ids || !Array.isArray(ids) || ids.length === 0) {
return reply.code(400).send({ error: "No ids provided" })
return { files: [] }
}
const rows = await server.db

View File

@@ -36,6 +36,9 @@ export const useFiles = () => {
let data = []
data = await useEntities("files").select("*, incominginvoice(*), project(*), vendor(*), customer(*), contract(*), plant(*), createddocument(*), vehicle(*), product(*), profile(*), check(*), inventoryitem(*)")
if (!Array.isArray(data) || data.length === 0) {
return []
}
const res = await useNuxtApp().$api("/api/files/presigned",{
@@ -138,4 +141,4 @@ export const useFiles = () => {
return {uploadFiles, selectDocuments, selectSomeDocuments, selectDocument, downloadFile, dataURLtoFile}
}
}

View File

@@ -371,9 +371,9 @@ const syncdokubox = async () => {
<UProgress animation="carousel" class="w-1/2"/>
</div>
<div v-else>
<div v-if="displayMode === 'list'">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-800">
<div v-else>
<div v-if="displayMode === 'list'">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-800">
<thead class="bg-gray-50 dark:bg-gray-800 sticky top-0 z-20">
<tr>
<th class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold sm:pl-6">Name</th>
@@ -412,6 +412,11 @@ const syncdokubox = async () => {
</UDropdown>
</td>
</tr>
<tr v-if="renderedFileList.length === 0">
<td colspan="3" class="px-6 py-16 text-center text-sm text-gray-500">
Keine Dateien oder Ordner vorhanden.
</td>
</tr>
</tbody>
</table>
</div>
@@ -438,6 +443,12 @@ const syncdokubox = async () => {
/>
<span class="text-xs font-medium text-center truncate w-full">{{ entry.label }}</span>
</div>
<div
v-if="renderedFileList.length === 0"
class="col-span-full rounded-xl border border-dashed border-gray-300 dark:border-gray-700 px-6 py-16 text-center text-sm text-gray-500"
>
Keine Dateien oder Ordner vorhanden.
</div>
</div>
</div>
</UDashboardPanelContent>
@@ -497,4 +508,4 @@ const syncdokubox = async () => {
</template>
</UCard>
</UModal>
</template>
</template>