update multiple fields
Hi is there a other way to update multiple fields
currently i do it like this
currently i do it like this
const updatePollOption = (option: PollOptionsSchema) => {
const { isNew, id, ...options } = option;
return db
.update(tables.pollOptions)
.set({ ...options, pollId: pollId })
.where(eq(tables.pollOptions.id, option.id));
};
const result = await Promise.all(
pollOptions.map((option) => updatePollOption(option))
);