_id can't be undefined

This commit is contained in:
Sainan 2024-12-29 21:44:28 +01:00
parent 981df33601
commit ccda64e8b8

View File

@ -4,7 +4,7 @@ import { getRecipe } from "@/src/services/itemDataService";
import { logger } from "@/src/utils/logger";
import { Types } from "mongoose";
export const startRecipe = async (recipeName: string, accountId: string): Promise<{ RecipeId: { $oid?: string } }> => {
export const startRecipe = async (recipeName: string, accountId: string): Promise<{ RecipeId: { $oid: string } }> => {
const recipe = getRecipe(recipeName);
if (!recipe) {
@ -34,6 +34,6 @@ export const startRecipe = async (recipeName: string, accountId: string): Promis
const newInventory = await inventory.save();
return {
RecipeId: { $oid: newInventory.PendingRecipes[newInventory.PendingRecipes.length - 1]._id?.toString() }
RecipeId: { $oid: newInventory.PendingRecipes[newInventory.PendingRecipes.length - 1]._id.toString() }
};
};