Skip to content

Commit c17f0f1

Browse files
committed
dumili: Don't add a space between each column in the text editor
Apply lint
1 parent da7286c commit c17f0f1

File tree

11 files changed

+126
-108
lines changed

11 files changed

+126
-108
lines changed

apps/dumili/api/services/indexation/index.ts

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type {
1919
issueSuggestion,
2020
Prisma,
2121
storyKindSuggestion,
22-
storySuggestion
22+
storySuggestion,
2323
} from "~prisma/client_dumili";
2424

2525
import type { SessionDataWithIndexation } from "../../index";
@@ -328,14 +328,17 @@ const setInferredEntriesStoryKinds = async (
328328
}
329329

330330
const mostInferredStoryKind = Object.entries(
331-
(pagesInferredStoryKinds
332-
.filter(({ aiKumikoResult }) => aiKumikoResult !== null) as { aiKumikoResult: aiKumikoResult }[])
331+
(
332+
pagesInferredStoryKinds.filter(
333+
({ aiKumikoResult }) => aiKumikoResult !== null,
334+
) as { aiKumikoResult: aiKumikoResult }[]
335+
)
333336
.map(({ aiKumikoResult: { id, inferredStoryKindRowsStr } }) => ({
334337
id,
335-
inferredStoryKindRowsStr
338+
inferredStoryKindRowsStr,
336339
}))
337340
.groupBy("inferredStoryKindRowsStr", "id[]"),
338-
).sort((a, b) => b[1].length - a[1].length)[0][0]
341+
).sort((a, b) => b[1].length - a[1].length)[0][0];
339342

340343
const entryIdx = services._socket.data.indexation.entries.findIndex(
341344
({ id }) => id === entry.id,
@@ -355,20 +358,21 @@ const setInferredEntriesStoryKinds = async (
355358
});
356359

357360
if (mostInferredStoryKind) {
358-
console.log('Story kind suggestions: ', indexation.entries[entryIdx].storyKindSuggestions)
361+
console.log(
362+
"Story kind suggestions: ",
363+
indexation.entries[entryIdx].storyKindSuggestions,
364+
);
359365
const suggestion = indexation.entries[entryIdx].storyKindSuggestions.find(
360-
({ storyKindRowsStr }) =>
361-
storyKindRowsStr === mostInferredStoryKind,
362-
)
366+
({ storyKindRowsStr }) => storyKindRowsStr === mostInferredStoryKind,
367+
);
363368
if (suggestion) {
364369
await prisma.storyKindSuggestionAi.create({
365370
data: {
366371
suggestionId: suggestion.id,
367372
},
368373
});
369-
}
370-
else {
371-
console.warn('No suggestion found for ', mostInferredStoryKind)
374+
} else {
375+
console.warn("No suggestion found for ", mostInferredStoryKind);
372376
}
373377
}
374378

@@ -402,15 +406,15 @@ const listenEvents = (services: IndexationServices) => ({
402406
data: {
403407
image: url
404408
? {
405-
connectOrCreate: {
406-
create: {
407-
url,
408-
},
409-
where: {
410-
url,
409+
connectOrCreate: {
410+
create: {
411+
url,
412+
},
413+
where: {
414+
url,
415+
},
411416
},
412-
},
413-
}
417+
}
414418
: { disconnect: true },
415419
},
416420
where: {
@@ -548,11 +552,11 @@ const listenEvents = (services: IndexationServices) => ({
548552
suggestionId === null
549553
? { disconnect: true }
550554
: {
551-
connect: {
552-
id: suggestionId,
553-
indexationId: services._socket.data.indexation.id,
555+
connect: {
556+
id: suggestionId,
557+
indexationId: services._socket.data.indexation.id,
558+
},
554559
},
555-
},
556560
},
557561
where: {
558562
id: services._socket.data.indexation.id,
@@ -575,8 +579,8 @@ const listenEvents = (services: IndexationServices) => ({
575579
...suggestion,
576580
ai: suggestion.ai
577581
? {
578-
create: {},
579-
}
582+
create: {},
583+
}
580584
: undefined,
581585
},
582586
})
@@ -837,9 +841,9 @@ export const createEntry = async (indexationId: string, position: number) =>
837841
storyKindSuggestions: {
838842
createMany: {
839843
data: (await prisma.storyKindRows.findMany()).map(({ id }) => ({
840-
storyKindRowsStr: id
841-
}))
842-
}
843-
}
844+
storyKindRowsStr: id,
845+
})),
846+
},
847+
},
844848
},
845-
})
849+
});

apps/dumili/api/services/indexation/kumiko.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ const runKumikoOnPage = async (
8282
`Kumiko: page ${page.pageNumber}: inferred story kind is ${inferredStoryKind}, inferred number of rows is ${inferredNumberOfRows}`,
8383
);
8484

85-
const inferredStoryKindRowsStr = (await prisma.storyKindRows.findFirst({
86-
where: {
87-
kind: inferredStoryKind,
88-
numberOfRows: inferredNumberOfRows,
89-
},
90-
}))?.id
85+
const inferredStoryKindRowsStr = (
86+
await prisma.storyKindRows.findFirst({
87+
where: {
88+
kind: inferredStoryKind,
89+
numberOfRows: inferredNumberOfRows,
90+
},
91+
})
92+
)?.id;
9193

9294
await prisma.image.update({
9395
include: {

apps/dumili/api/services/indexations/index.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@ const listenEvents = ({ _socket }: IndexationsServices) => ({
5555
},
5656
})
5757
.then((indexation) => createEntry(indexation.id, 1))
58-
.then((entry) => prisma.entry.update({
59-
data: {
60-
acceptedStoryKindSuggestionId: entry.storyKindSuggestions.find(
61-
(s) => s.storyKindRowsStr.split('/')[0] === COVER
62-
)!.id,
63-
},
64-
where: {
65-
id: entry.id,
66-
},
67-
})),
58+
.then((entry) =>
59+
prisma.entry.update({
60+
data: {
61+
acceptedStoryKindSuggestionId: entry.storyKindSuggestions.find(
62+
(s) => s.storyKindRowsStr.split("/")[0] === COVER,
63+
)!.id,
64+
},
65+
where: {
66+
id: entry.id,
67+
},
68+
}),
69+
),
6870

6971
getIndexations: (): Promise<
7072
Prisma.indexationGetPayload<{

apps/dumili/src/components/TextEditor.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ watch(
133133
hasEntrycodesLongerThanFirstColumnMaxWidth,
134134
(value) => {
135135
if (value) {
136-
debugger;
137136
showEntryLetters.value = true;
138137
}
139138
},
@@ -204,7 +203,7 @@ const text = computed(() =>
204203
.map((row) =>
205204
row
206205
.map((text, idx) => String(text || "").padEnd(columnWidths[idx] || 0))
207-
.join(" "),
206+
.join(""),
208207
)
209208
.join("\n"),
210209
);

apps/edgecreator/api/services/upload/index.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const getEdgeCreatorServices = (token: string) =>
2222
).addNamespace<EdgeCreatorServices>(namespaces.EDGECREATOR, {
2323
session: {
2424
getToken: () => Promise.resolve(token),
25-
clearSession: () => { },
25+
clearSession: () => {},
2626
sessionExists: () => Promise.resolve(true),
2727
},
2828
});
@@ -122,13 +122,14 @@ const getTargetFilePath = async (
122122
let filePath = `${getEdgesPath()}/${countrycode}`;
123123
filePath = isEdgePhoto
124124
? getNextAvailableFile(
125-
`${filePath}/photos/${magazinecode}.${issuenumber}.photo`,
126-
"jpg",
127-
)
128-
: `${filePath}/elements/${filename.includes(magazinecode)
129-
? filename
130-
: `${magazinecode}.${filename}`
131-
}`;
125+
`${filePath}/photos/${magazinecode}.${issuenumber}.photo`,
126+
"jpg",
127+
)
128+
: `${filePath}/elements/${
129+
filename.includes(magazinecode)
130+
? filename
131+
: `${magazinecode}.${filename}`
132+
}`;
132133

133134
mkdirSync(dirname(filePath), { recursive: true });
134135
return filePath;

apps/edgecreator/src/composables/useModelLoad.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ export default () => {
164164
);
165165
} catch (e) {
166166
onError(
167-
`Invalid step ${originalStepNumber} (${component}) : ${e as string
167+
`Invalid step ${originalStepNumber} (${component}) : ${
168+
e as string
168169
}, step will be ignored.`,
169170
originalStepNumber,
170171
);

apps/edgecreator/src/stores/step.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ export const step = defineStore("step", () => {
213213
useI18n()
214214
.t(
215215
`Issue codes {completedIssuecode} and {issuecode} ` +
216-
`don't have the same components` +
217-
`: {completedIssueSteps} vs {currentIssueComponents}`,
216+
`don't have the same components` +
217+
`: {completedIssueSteps} vs {currentIssueComponents}`,
218218
{
219219
completedIssuecode,
220220
issuecode,

packages/api/services/coa/stories/index.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ import { Prisma } from "~prisma-schemas/schemas/coa";
55
import { prismaClient as prismaCoa } from "~prisma-schemas/schemas/coa/client";
66

77
export default {
8-
getStoryDetails: async (storycodes: string[]) => !storycodes.length ? ({ stories: {} as Record<string, inducks_story>, storyUrls: {} as Record<string, string> }) :
9-
Promise.all([
10-
prismaCoa.inducks_story.findMany({
11-
where: {
12-
storycode: { in: storycodes },
13-
},
14-
}),
15-
prismaCoa.$queryRaw<{ storycode: string; url: string }[]>`
8+
getStoryDetails: async (storycodes: string[]) =>
9+
!storycodes.length
10+
? {
11+
stories: {} as Record<string, inducks_story>,
12+
storyUrls: {} as Record<string, string>,
13+
}
14+
: Promise.all([
15+
prismaCoa.inducks_story.findMany({
16+
where: {
17+
storycode: { in: storycodes },
18+
},
19+
}),
20+
prismaCoa.$queryRaw<{ storycode: string; url: string }[]>`
1621
select s.storycode, CONCAT('webusers/webusers/', url) AS url
1722
from inducks_story s
1823
inner join coa.inducks_storyversion sv on s.originalstoryversioncode = sv.storyversioncode
@@ -21,12 +26,12 @@ export default {
2126
where s.storycode IN (${Prisma.join(storycodes)})
2227
and eu.sitecode = 'webusers'
2328
group by s.storycode`,
24-
])
25-
.then(([stories, storyUrls]) => ({
26-
stories: stories.groupBy("storycode"),
27-
storyUrls: storyUrls.groupBy("storycode", "url"),
28-
}))
29-
.catch((e) => ({ error: "Error", errorDetails: e })),
29+
])
30+
.then(([stories, storyUrls]) => ({
31+
stories: stories.groupBy("storycode"),
32+
storyUrls: storyUrls.groupBy("storycode", "url"),
33+
}))
34+
.catch((e) => ({ error: "Error", errorDetails: e })),
3035

3136
getStoryversionsDetails: (storyversioncodes: string[]) =>
3237
prismaCoa.inducks_storyversion

packages/api/services/collection/issues/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ const addOrChangeCopies = async (
320320
areToRead[copyNumber] !== undefined ? areToRead[copyNumber] : false,
321321
purchaseId: purchaseIds[copyNumber] || -2,
322322
};
323-
console.log('upsert', {
323+
console.log("upsert", {
324324
create: {
325325
...common,
326326
country: "",
@@ -334,7 +334,7 @@ const addOrChangeCopies = async (
334334
where: {
335335
id: issueId || 0,
336336
},
337-
})
337+
});
338338
return prismaDm.issue.upsert({
339339
create: {
340340
...common,

packages/api/services/cover-id/index.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ const listenEvents = () => ({
1515
}: EitherOr<{ base64?: string }, { url?: string }>) => {
1616
const buffer = url
1717
? (
18-
await axios.get(url, {
19-
responseType: "arraybuffer",
20-
})
21-
).data
18+
await axios.get(url, {
19+
responseType: "arraybuffer",
20+
})
21+
).data
2222
: Buffer.from(base64!.split(";base64,").pop()!, "base64");
2323

2424
const pastecResponse: SimilarImagesResult | null =
@@ -59,12 +59,14 @@ const listenEvents = () => ({
5959
covers.sort((cover1, cover2) =>
6060
Math.sign(
6161
pastecResponse.image_ids.indexOf(cover1.id) -
62-
pastecResponse.image_ids.indexOf(cover2.id),
62+
pastecResponse.image_ids.indexOf(cover2.id),
6363
),
6464
),
6565
);
6666

67-
console.log(`Cover ID search: matched issue codes ${coversByIssuecode.map(({ issuecode }) => issuecode).join(",")}`);
67+
console.log(
68+
`Cover ID search: matched issue codes ${coversByIssuecode.map(({ issuecode }) => issuecode).join(",")}`,
69+
);
6870

6971
return {
7072
covers: coversByIssuecode.map(({ issuecode, fullUrl }) => ({
@@ -135,7 +137,8 @@ const getCoverUrl = async (coverId: number) =>
135137
})
136138
.then(
137139
(cover) =>
138-
`${cover.sitecode}/${cover.sitecode === "webusers" ? "webusers" : ""
140+
`${cover.sitecode}/${
141+
cover.sitecode === "webusers" ? "webusers" : ""
139142
}${cover.url}`,
140143
);
141144

@@ -144,7 +147,8 @@ const getSimilarImages = async (
144147
): Promise<SimilarImagesResult | null> =>
145148
axios
146149
.post(
147-
`http://${process.env.PASTEC_HOSTS!}:${process.env.PASTEC_PORT
150+
`http://${process.env.PASTEC_HOSTS!}:${
151+
process.env.PASTEC_PORT
148152
}/index/searcher`,
149153
cover,
150154
{

0 commit comments

Comments
 (0)