feat: add bulk insert module
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -63,3 +63,6 @@ server.exe
|
|||||||
/uploads
|
/uploads
|
||||||
|
|
||||||
/scripts/git-multipush.ts
|
/scripts/git-multipush.ts
|
||||||
|
|
||||||
|
# IDE configuration
|
||||||
|
/.idea
|
||||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
12
.idea/backend.iml
generated
12
.idea/backend.iml
generated
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/backend.iml" filepath="$PROJECT_DIR$/.idea/backend.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -1,9 +1,7 @@
|
|||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { AppError } from "../../../helpers/error/instances/app";
|
import { AppError } from "../../../helpers/error/instances/app";
|
||||||
import { prisma } from "../../../utils/databases/prisma/connection";
|
import { prisma } from "../../../utils/databases/prisma/connection";
|
||||||
import { generateUUIDv7 } from "../../../helpers/databases/uuidv7";
|
|
||||||
import { MediaFullInfoResponse } from "../types/mediaFullInfo.type";
|
import { MediaFullInfoResponse } from "../types/mediaFullInfo.type";
|
||||||
import { SystemAccountId } from "../../../config/account/system";
|
|
||||||
import { bulkInsertMediaProducerStudioLicensorRepository } from "./bulkInsertMediaProducerStudioLicensor.repository";
|
import { bulkInsertMediaProducerStudioLicensorRepository } from "./bulkInsertMediaProducerStudioLicensor.repository";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +132,7 @@ export const InsertMediaRepository = async ({ payload }: { payload: MediaFullInf
|
|||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
|
|
||||||
prisma.$transaction(async (tx) => {
|
await prisma.$transaction(async (tx) => {
|
||||||
const media = await tx.media.upsert({
|
const media = await tx.media.upsert({
|
||||||
where: { mal_id: payload.mal_id },
|
where: { mal_id: payload.mal_id },
|
||||||
create: constructMediaPayload,
|
create: constructMediaPayload,
|
||||||
|
|||||||
Reference in New Issue
Block a user