From ba328d38ffb8d25d3ee38fc635b2522c93ba6b37 Mon Sep 17 00:00:00 2001 From: Thomas Haaf Date: Thu, 13 Jun 2024 13:00:33 +0200 Subject: [PATCH] fix lint issues --- client/src/views/PostFormView.vue | 99 +++++++++++++++++++++---------- server/src/routes/posts.ts | 16 ++--- 2 files changed, 73 insertions(+), 42 deletions(-) diff --git a/client/src/views/PostFormView.vue b/client/src/views/PostFormView.vue index caf34d3..f95749c 100644 --- a/client/src/views/PostFormView.vue +++ b/client/src/views/PostFormView.vue @@ -11,27 +11,48 @@
- +
- +
- +
- +
{{ t("posts.form.message.hint") }}
@@ -54,12 +75,15 @@

{{ (form?.title?.length ?? 0) > 0 ? form?.title : t("posts.form.preview.title") }}

-
+
- +
@@ -68,22 +92,41 @@

{{ tc("posts.form.imageupload", Object.keys(files).length) }} - ({{ - convertToHumanReadableFileSize(totalBytesInFiles) }}) + ({{ convertToHumanReadableFileSize(totalBytesInFiles) }})

- -
+ +
Dateien fallen lassen Neue Dateien hierher ziehen oder hier klicken um Dateien auszuwählen
- +
@@ -204,7 +247,6 @@ } @keyframes shake { - 10%, 90% { transform: scale(0.9) translate3d(-1px, 0, 0); @@ -251,8 +293,6 @@ import { computed, onMounted, reactive, ref, watch } from "vue"; import { useRoute, useRouter } from "vue-router"; import VueTagsInput from "@sipec/vue3-tags-input"; - - const tag = ref(""); const tags = ref<{ text: string; tiClasses?: string[] }[]>([]); // vue-tags-input internal format const md = ref(null); @@ -279,7 +319,6 @@ const props = defineProps({ }, }); - const totalBytesInFiles = computed(() => Object.values(files) .map((it) => it.size) @@ -309,7 +348,6 @@ onMounted(async () => { // ADD already existing attachments to files processAttachments(resJson.attachments); } - } catch (e) { postHasError.value = true; } @@ -321,7 +359,6 @@ onMounted(async () => { }, 1000); }); - // Function to process attachments and populate the files object const processAttachments = (attachments: Attachment[]) => { attachments.forEach((attachment) => { @@ -329,7 +366,7 @@ const processAttachments = (attachments: Attachment[]) => { const file = new File([blob], attachment.filename, { type: attachment.file.mimeType }); files[attachment.file.sha256] = file; }); -} +}; // Create a computed property to generate URLs for the files const filesWithUrls = computed(() => { @@ -350,7 +387,7 @@ const removeImageFileFromMarkdown = (file: File) => { setTimeout(() => { form.markdown = markDownBeforeRemove.replace(strToRemove, ""); }, 0); -} +}; const dropMarkdown = (evt: DragEvent) => { const items = evt.dataTransfer?.items; diff --git a/server/src/routes/posts.ts b/server/src/routes/posts.ts index c3a42fe..ad6607a 100644 --- a/server/src/routes/posts.ts +++ b/server/src/routes/posts.ts @@ -174,8 +174,6 @@ router.post( } else { return { postId: post.id, attachments: [] }; } - - }) .catch((err) => { throw new InternalServerError(true, "Could not create post " + err); @@ -186,7 +184,6 @@ router.post( }, ); - // EDIT EXISTING POST router.post("/:id(\\d+$)", authMiddleware, multipleFilesUpload, async (req: Request, res: Response, next) => { const postId = +req.params.id; @@ -227,7 +224,6 @@ router.post("/:id(\\d+$)", authMiddleware, multipleFilesUpload, async (req: Requ // tags: tagsToUseInPost, }) .then(async (updateResult) => { - manager.getRepository(AttachmentEntity).delete({ post: { id: post.id } }); const attachmentEntities: AttachmentEntity[] = await Promise.all( @@ -277,11 +273,11 @@ async function getPersistedTagsForPost(post: PostEntity, bodyJson: PostRequestDt const alreadySavedTags = bodyJson.stringTags?.length > 0 ? await AppDataSource.manager - .getRepository(TagEntity) - .createQueryBuilder("tagEntity") - .select() - .where("tagEntity.name IN(:...names)", { names: bodyJson.stringTags }) - .getMany() + .getRepository(TagEntity) + .createQueryBuilder("tagEntity") + .select() + .where("tagEntity.name IN(:...names)", { names: bodyJson.stringTags }) + .getMany() : await Promise.all([]); tagsToUseInPost.push(...alreadySavedTags); @@ -318,8 +314,6 @@ router.get("/tags/:search", async (req: Request, res: Response, next) => { .catch(next); }); - - // DELETE POST router.get("/delete/:id(\\d+$)", async (req: Request, res: Response, next) => { await AppDataSource.manager.transaction(async (manager) => {