Skip to content

Commit

Permalink
remove v2 from collection name
Browse files Browse the repository at this point in the history
  • Loading branch information
VovaStelmashchuk committed Jan 5, 2025
1 parent b594433 commit fb820fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions server/api/project.post.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineEventHandler(async (event) => {

const slug = `slug-${generateRandomString(6)}`;

const insertResult = await db.collection("projects_v2").insertOne({
const insertResult = await db.collection("projects").insertOne({
slug: slug,
dxf: dxfArray,
uploadedAt: new Date(),
Expand All @@ -34,7 +34,7 @@ export default defineEventHandler(async (event) => {
};
});

db.collection("projects_v2").updateOne(
db.collection("projects").updateOne(
{ _id: insertResult.insertedId },
{ $set: { dxf: dxfRecords } }
);
Expand All @@ -44,7 +44,7 @@ export default defineEventHandler(async (event) => {
dxfRecord.svg = svgResult.svg;
dxfRecord.generateSvgError = svgResult.error;

db.collection("projects_v2").updateOne(
db.collection("projects").updateOne(
{ _id: insertResult.insertedId },
{ $set: { dxf: dxfRecords } }
);
Expand Down
2 changes: 1 addition & 1 deletion server/api/project/[slug].get.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, "slug");

const db = await connectDB();
const project = await db.collection("projects_v2").findOne({ slug: slug });
const project = await db.collection("projects").findOne({ slug: slug });

if (!project) {
throw createError({ statusCode: 404, message: "Project not found" });
Expand Down
2 changes: 1 addition & 1 deletion server/api/project/[slug]/nest.post.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineEventHandler(async (event) => {
requestedAt: new Date(),
});

const project = await db.collection("projects_v2").findOne({ slug });
const project = await db.collection("projects").findOne({ slug });
const arrayOfDxfWithCount = files.map((file) => {
const dxfString = project.dxf.find((d) => d.slug === file.slug).data;
return {
Expand Down

0 comments on commit fb820fd

Please sign in to comment.