Skip to content

Commit 0ed5a2c

Browse files
committed
mod: disable user to update vndb id
1 parent dc52a1c commit 0ed5a2c

File tree

6 files changed

+28
-833
lines changed

6 files changed

+28
-833
lines changed

app/api/edit/sync/clients/bangumi.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

app/api/edit/sync/clients/vndb.ts

Lines changed: 0 additions & 142 deletions
This file was deleted.

app/api/edit/sync/helpers.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

app/api/edit/sync/index.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1-
export { syncPatchFromApis } from './runner'
1+
import { prisma } from '~/prisma/index'
2+
import { processPatch } from '~/migration/sync-ts/processPatch'
3+
4+
export async function syncPatchFromApis(
5+
patchId: number,
6+
vndbId: string | null
7+
) {
8+
try {
9+
await prisma.patch
10+
.update({ where: { id: patchId }, data: { vndb_id: vndbId } })
11+
.catch(() => {})
12+
13+
const p = await prisma.patch.findUnique({
14+
where: { id: patchId },
15+
select: { id: true, name: true, bid: true, vndb_id: true }
16+
})
17+
if (!p) return
18+
19+
await processPatch({
20+
id: p.id,
21+
name: p.name,
22+
bid: p.bid ?? null,
23+
vndb_id: p.vndb_id ?? null
24+
})
25+
} catch (e) {
26+
console.error('syncPatchFromApis failed:', e)
27+
}
28+
}

0 commit comments

Comments
 (0)