Skip to content

Commit 290d018

Browse files
committed
fix: correct input parsing in getTag function and ensure error handling returns response
1 parent 60a4e1a commit 290d018

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/backend/services/tag.action.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getTag = async (
2929
_input: z.infer<typeof TagRepositoryInput.getTag>
3030
) => {
3131
try {
32-
const input = await TagRepositoryInput.createInput.parseAsync(_input);
32+
const input = await TagRepositoryInput.getTag.parseAsync(_input);
3333
const response = await persistenceRepository.tags.find({
3434
where: eq("name", input.name),
3535
});
@@ -39,7 +39,7 @@ export const getTag = async (
3939
success: true as const,
4040
};
4141
} catch (error) {
42-
handleActionException(error);
42+
return handleActionException(error);
4343
}
4444
};
4545

@@ -58,7 +58,7 @@ export const createTag = async (
5858

5959
return response.rows[0];
6060
} catch (error) {
61-
handleActionException(error);
61+
return handleActionException(error);
6262
}
6363
};
6464

@@ -101,13 +101,7 @@ export const syncTagsWithArticles = async (
101101
inArray("tag_id", tagsToRemove)
102102
),
103103
});
104-
console.log({
105-
tagsToRemove,
106-
tagsToAdd,
107-
attachedTagIds,
108-
inputTagIds: input.tag_ids,
109-
});
110104
} catch (error) {
111-
handleActionException(error);
105+
return handleActionException(error);
112106
}
113107
};

0 commit comments

Comments
 (0)