🚧 wip: try to create character with VA in bulk
This commit is contained in:
19
src/modules/internal/repositories/bulkInsertVA.repository.ts
Normal file
19
src/modules/internal/repositories/bulkInsertVA.repository.ts
Normal 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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user