🚧 wip: try to create character with VA in bulk

This commit is contained in:
2026-01-24 22:02:34 +07:00
parent 7d26ca7f7b
commit fe10412f1a
9 changed files with 153 additions and 13 deletions

View File

@ -0,0 +1,19 @@
import { Prisma } from "@prisma/client";
import { AppError } from "../../../helpers/error/instances/app";
import { prisma } from "../../../utils/databases/prisma/connection";
export const bulkInsertVARepository = async (
payload: Prisma.VoiceActorUpsertArgs["create"],
) => {
try {
const insertedVA = await prisma.voiceActor.upsert({
where: { malId: payload.malId },
create: payload,
update: payload,
select: { id: true },
});
return insertedVA.id;
} catch (error) {
throw new AppError(500, "Failed to bulk insert VAs", error);
}
};