chore: fix problem of transcation beeing commited throw update the "

category variant
This commit is contained in:
mahyargdz
2025-09-21 11:45:24 +03:30
parent 3d1aa01f2e
commit 79f597cc90
23 changed files with 52 additions and 97 deletions
-5
View File
@@ -72,10 +72,8 @@ export class LearningService {
}
async update(learningId: string, updateDto: UpdateLearningDTO) {
console.log(learningId);
if (!isValidObjectId(learningId)) throw new BadRequestError(CommonMessage.NotValidId);
const learning = await this.learningRepo.model.findByIdAndUpdate(learningId, updateDto, { new: true });
console.log(learning);
if (!learning) throw new BadRequestError(CommonMessage.NotFoundById);
return {
message: CommonMessage.Updated,
@@ -86,7 +84,6 @@ export class LearningService {
async updateCategory(catId: string, updateDto: UpdateLearningCategoryDTO) {
if (!isValidObjectId(catId)) throw new BadRequestError(CommonMessage.NotValidId);
const learningCategory = await this.learningCategoryRepo.model.findByIdAndUpdate(catId, updateDto, { new: true });
console.log(learningCategory);
if (!learningCategory) throw new BadRequestError(CommonMessage.NotFoundById);
return {
message: CommonMessage.Updated,
@@ -128,13 +125,11 @@ export class LearningService {
async getLearningProgressBySellerForAdmin() {
const progress = await this.learningProgressRepo.getLearningProgressBySellers();
console.log(progress);
return { progress };
}
async getLearningProgressWatched(sellerId: string, catId: string) {
const progress = await this.learningRepo.getVideosWithWatchStatus(sellerId, catId);
console.log(progress);
return { progress };
}
}