Merge pull request #141 from DeimosPr4/ISSUE-eliminaciones-logicas

cambio a eliminaciones  lógicas en los microservicios
This commit is contained in:
Eduardo Quiros 2022-08-01 07:18:24 +00:00 committed by GitHub
commit a781bf42cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 8 deletions

View File

@ -32,6 +32,8 @@ export class CommonAreasService {
} }
async remove(id: string) { async remove(id: string) {
return this.commonAreaModel.findByIdAndRemove({ _id: id }).exec(); return this.commonAreaModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
} }

View File

@ -56,7 +56,9 @@ export class CommunitiesService {
} }
async remove(id: string) { async remove(id: string) {
return this.communityModel.findByIdAndRemove({ _id: id }).exec(); return this.communityModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
async findCommunityAdmin(community: string, user_type: string) { async findCommunityAdmin(community: string, user_type: string) {

View File

@ -33,6 +33,8 @@ export class PostCommentsService {
} }
async remove(id: string) { async remove(id: string) {
return this.commentModel.findByIdAndRemove({ _id: id }).exec(); return this.commentModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
} }

View File

@ -32,6 +32,8 @@ export class GuestsService {
} }
async remove(id: string) { async remove(id: string) {
return this.guestModel.findByIdAndRemove({ _id: id }).exec(); return this.guestModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
} }

View File

@ -31,6 +31,9 @@ export class ReportsService {
} }
async remove(id: string) { async remove(id: string) {
return this.reportModel.findByIdAndRemove({ _id: id }).exec(); return this.reportModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
} }

View File

@ -41,6 +41,8 @@ export class ReservationsService {
} }
async remove(id: string) { async remove(id: string) {
return this.reservationModel.findByIdAndRemove({ _id: id }).exec(); return this.reservationModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
} }

View File

@ -76,8 +76,14 @@ export class UsersService {
}); });
} }
async remove(id: string) { /* async remove(id: string) {
return this.userModel.findByIdAndRemove({ _id: id }).exec(); return this.userModel.findByIdAndRemove({ _id: id }).exec();
}*/
async remove(id: string) {
return this.userModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
//inicio de sesion //inicio de sesion
@ -142,7 +148,9 @@ export class UsersService {
} }
async deleteAdminSystem(id: string) { async deleteAdminSystem(id: string) {
return this.userModel.deleteOne({ _id: id }).exec(); return this.userModel.findOneAndUpdate({ _id: id }, {status: '-1'}, {
new: true,
});
} }
async validateEmail(email: string) { async validateEmail(email: string) {