feat(support): update Swagger documentation for support endpoints

This commit is contained in:
rahat0078
2026-04-17 00:19:22 +06:00
parent 739e3d1ad6
commit 86b2292272
3 changed files with 123 additions and 41 deletions
+28 -9
View File
@@ -13,6 +13,8 @@ const getAllSupportFromDB = async (
search?: string,
type?: string,
status?: string,
page: number = 1,
limit: number = 10,
) => {
const andCondition: Prisma.SupportWhereInput[] = [];
@@ -55,14 +57,31 @@ const getAllSupportFromDB = async (
const whereCondition: Prisma.SupportWhereInput =
andCondition.length > 0 ? { AND: andCondition } : {};
const result = await prisma.support.findMany({
where: whereCondition,
orderBy: {
createdAt: "desc",
},
});
const skip = (page - 1) * limit;
return result;
const [data, total] = await Promise.all([
prisma.support.findMany({
where: whereCondition,
skip,
take: limit,
orderBy: {
createdAt: "desc",
},
}),
prisma.support.count({
where: whereCondition,
}),
]);
return {
meta: {
page,
limit,
total,
totalPage: Math.ceil(total / limit),
},
data,
};
};
const getSingleSupportFromDB = async (
@@ -125,8 +144,8 @@ const deleteSupportFromDB = async (
}
const result = await prisma.support.delete({
where: {id}
})
where: { id },
});
return result;
};