Add media image handling and related endpoints
CI / Backend (build + test) (push) Failing after 1m35s
CI / Frontend (lint + typecheck + build) (push) Successful in 43s

- Introduced `MediaImage` entity to manage images for markdown in instructions and news.
- Updated `IAppDbContext` and `AppDbContext` to include `MediaImages` DbSet.
- Implemented `DeleteMediaImageFilesAsync` method in `FactoryResetCommandHandler` to remove media images during factory reset.
- Added new API endpoints for uploading and retrieving media images, enhancing markdown support.
- Updated frontend components to utilize the new `MarkdownEditor` for image uploads in instructions and news.
- Enhanced documentation to reflect the new media handling features and API specifications.
This commit is contained in:
Leonid Pershin committed 2026-07-30 04:05:01 +03:00
1 parent cc7e2a7f8f
commit c2ed3240bd
37 files changed
+2052 -63

No files matched your search

+9
View File
@@ -134,6 +134,15 @@ export type InstructionTabDto = {
updatedAt: string | null
}
/** POST /api/admin/media/images — картинка для вставки в markdown. Ссылку клиент строит сам:
* `/api/media/images/{id}` (см. features/admin/media/api.ts). */
export type MediaImageDto = {
id: string
fileName: string
contentType: string
sizeBytes: number
}
export type LinkTokenResponse = {
deepLink: string | null
expiresAt: string
+12
View File
@@ -501,6 +501,12 @@ const resources = {
tabDeleted: 'Вкладка удалена.',
confirmDeleteTab: 'Удалить вкладку инструкций?',
},
media: {
uploadImage: 'Картинка',
uploading: 'Загрузка…',
uploadFailed: 'Не удалось загрузить картинку.',
hint: 'Картинку можно загрузить кнопкой, вставить из буфера (Ctrl+V) или перетащить в поле — в текст добавится ссылка ![…](…). До 5 МБ, JPEG/PNG/WEBP/GIF.',
},
news: {
create: 'Добавить новость',
title: 'Заголовок',
@@ -1095,6 +1101,12 @@ const resources = {
tabDeleted: 'Tab deleted.',
confirmDeleteTab: 'Delete this instruction tab?',
},
media: {
uploadImage: 'Image',
uploading: 'Uploading…',
uploadFailed: 'Failed to upload the image.',
hint: 'Upload an image with the button, paste it from the clipboard (Ctrl+V) or drop it onto the field — an ![…](…) link is inserted into the text. Up to 5 MB, JPEG/PNG/WEBP/GIF.',
},
news: {
create: 'Add post',
title: 'Title',
+5
View File
@@ -0,0 +1,5 @@
/** Оформление отрендеренного markdown (ссылки, списки, картинки) — одинаковое во всех местах:
* страница инструкций, лента новостей и предпросмотр в админке. */
export const MARKDOWN_CLASSES =
'[&_a]:text-primary [&_a]:hover:underline [&_li]:ml-4 [&_ul]:list-disc [&_ol]:list-decimal ' +
'[&_img]:my-2 [&_img]:max-w-full [&_img]:rounded-md [&_img]:border [&_img]:border-border'