diff --git a/apps/dumili/api/prisma/schema.prisma b/apps/dumili/api/prisma/schema.prisma index 7db403621..aabe25404 100644 --- a/apps/dumili/api/prisma/schema.prisma +++ b/apps/dumili/api/prisma/schema.prisma @@ -92,6 +92,7 @@ model issueSuggestion { publicationcode String @db.VarChar(12) issuenumber String @db.VarChar(13) issuecode String @db.VarChar(25) + price String? @db.VarChar(160) acceptedOnEntries indexation[] @relation("indexation_accepted_issue_suggestion_idToissue_suggestion") indexation indexation @relation(fields: [indexationId], references: [id], onUpdate: Restrict, map: "issue_suggestion_indexation_id_fk") diff --git a/apps/dumili/api/services/indexation/index.ts b/apps/dumili/api/services/indexation/index.ts index b8bffee70..144a308da 100644 --- a/apps/dumili/api/services/indexation/index.ts +++ b/apps/dumili/api/services/indexation/index.ts @@ -221,6 +221,21 @@ export default (io: Server) => { .then(({ id }) => callback({ suggestionId: id })), ); + indexationSocket.on("updateIssueSuggestion", (suggestion, callback) => + prisma.indexation + .update({ + data: { + acceptedIssueSuggestion: { + update: suggestion, + }, + }, + where: { + id: indexationSocket.data.indexation.id, + } + }) + .then(() => callback({ status: "OK" })), + ); + indexationSocket.on("createOcrDetails", async (ocrDetails, callback) => { if ( !indexationSocket.data.indexation.pages.some( diff --git a/apps/dumili/api/services/indexation/types.ts b/apps/dumili/api/services/indexation/types.ts index 416d37ba3..90a4ab5d9 100644 --- a/apps/dumili/api/services/indexation/types.ts +++ b/apps/dumili/api/services/indexation/types.ts @@ -111,6 +111,16 @@ export default abstract class { callback: (data: { suggestionId: storySuggestion["id"] }) => void, ) => void; + abstract updateIssueSuggestion: ( + values: Pick< + issueSuggestion, + "price" + >, + callback: ( + data: { status: "OK" } + ) => void, + ) => void; + abstract acceptIssueSuggestion: ( suggestionId: issueSuggestion["id"] | null, callback: (data: { status: "OK" }) => void, diff --git a/apps/dumili/src/components/DumiliBook.vue b/apps/dumili/src/components/DumiliBook.vue deleted file mode 100644 index b9d2caec2..000000000 --- a/apps/dumili/src/components/DumiliBook.vue +++ /dev/null @@ -1,343 +0,0 @@ - - - { - coverHeight = (target as HTMLImageElement).naturalHeight; - coverWidth = (target as HTMLImageElement).naturalWidth; - } - " - /> - - - - - - - - - - - - - {{ - `polygon(${[ - [x1, y1], - [x2, y2], - [x3, y3], - [x4, y4], - ] - .map(([x, y]) => `${x}% ${y}%`) - .join(",")})` - }} - - - - - - - - - - - - - - - diff --git a/apps/dumili/src/components/StorySuggestionList.vue b/apps/dumili/src/components/StorySuggestionList.vue index ba944d037..c05e79d7c 100644 --- a/apps/dumili/src/components/StorySuggestionList.vue +++ b/apps/dumili/src/components/StorySuggestionList.vue @@ -24,6 +24,24 @@ > + + @@ -40,6 +58,7 @@ import { dumiliSocketInjectionKey } from "~/composables/useDumiliSocket"; import { FullEntry } from "~dumili-services/indexation/types"; import { suggestions } from "../stores/suggestions"; import { storySuggestion } from "~prisma/client_dumili"; +import { getEntryPages } from "~dumili-utils/entryPages"; const { t: $t } = useI18n(); diff --git a/apps/dumili/src/components/TableOfContents.vue b/apps/dumili/src/components/TableOfContents.vue index 7c3bcba9d..edadc6a0d 100644 --- a/apps/dumili/src/components/TableOfContents.vue +++ b/apps/dumili/src/components/TableOfContents.vue @@ -1,13 +1,27 @@ + + {{ $t("Méta-données") }} + {{ $t("Prix") }} + {}" + /> + - + { return loadIndexation(); }; +watchDebounced( + () => JSON.stringify([indexation.value.acceptedIssueSuggestion?.price]), + () => { + if (indexation.value.acceptedIssueSuggestion) { + const { price } = indexation.value.acceptedIssueSuggestion; + indexationSocket.value!.services.updateIssueSuggestion({ + price, + }); + } + }, + { debounce: 500, maxWait: 1000 }, +); + watch(currentEntry, (entry) => { if (entry) { currentPage.value = getFirstPageOfEntry( diff --git a/apps/dumili/src/components/TextEditor.vue b/apps/dumili/src/components/TextEditor.vue index 556fe56e1..41f2774e0 100644 --- a/apps/dumili/src/components/TextEditor.vue +++ b/apps/dumili/src/components/TextEditor.vue @@ -64,7 +64,11 @@ const textContent = computed(() => { } const issuecode = issue.value!.issuecode!.split("/")[1]; const rows = [ - [issuecode], + [ + [issuecode], + issue.value!.price ? [`[price:${issue.value!.price}]`] : [], + [`[pages:${indexation.value!.pages.length}]`], + ].flat(), ...indexation.value!.entries.map((entry, idx) => { const storyWithDetails = storiesWithDetails.value!.find( ({ storycode }) => storycode === entry.acceptedStory?.storycode, diff --git a/apps/dumili/src/pages/indexation/[id].vue b/apps/dumili/src/pages/indexation/[id].vue index 1a2df4f9b..5e1f4927f 100644 --- a/apps/dumili/src/pages/indexation/[id].vue +++ b/apps/dumili/src/pages/indexation/[id].vue @@ -78,7 +78,7 @@ > - +