feat: add endpoint to fetch media by slug

This commit is contained in:
2026-04-01 23:28:22 +07:00
parent 697374d6cd
commit 17eb272b1d
9 changed files with 66 additions and 31 deletions

View File

@ -0,0 +1,15 @@
import { AppError } from "../../../../helpers/error/instances/app";
import { mediaModel } from "../../model";
export const selectMediaIdFromSlugRepository = async (slug: string) => {
try {
return await mediaModel.findUnique({
where: { slug },
select: {
id: true,
},
});
} catch (error) {
throw new AppError(500, "Failed to fetch media ID from slug.", error);
}
};