feat: add endpoint to get active banners

This commit is contained in:
2026-03-02 22:32:05 +07:00
parent 960493f414
commit 6ffa087e91
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,19 @@
import { AppError } from "../../../../helpers/error/instances/app";
import { prisma } from "../../../../utils/databases/prisma/connection";
export const findAllActiveHeroBannerRepository = async () => {
try {
return await prisma.heroBanner.findMany({
where: {
startDate: {
lte: new Date(),
},
endDate: {
gte: new Date(),
},
},
});
} catch (error) {
throw new AppError(500, "Failed to fetch active hero banners", error);
}
};