refactor mylistings and my rentals
This commit is contained in:
@@ -53,7 +53,7 @@ const checkAndUpdateReviewVisibility = async (rental) => {
|
||||
return rental;
|
||||
};
|
||||
|
||||
router.get("/my-rentals", authenticateToken, async (req, res) => {
|
||||
router.get("/renting", authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const rentals = await Rental.findAll({
|
||||
where: { renterId: req.user.id },
|
||||
@@ -72,7 +72,7 @@ router.get("/my-rentals", authenticateToken, async (req, res) => {
|
||||
res.json(rentals);
|
||||
} catch (error) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.error("Error in my-rentals route", {
|
||||
reqLogger.error("Error in renting route", {
|
||||
error: error.message,
|
||||
stack: error.stack,
|
||||
userId: req.user.id,
|
||||
@@ -81,7 +81,7 @@ router.get("/my-rentals", authenticateToken, async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get("/my-listings", authenticateToken, async (req, res) => {
|
||||
router.get("/owning", authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const rentals = await Rental.findAll({
|
||||
where: { ownerId: req.user.id },
|
||||
@@ -100,7 +100,7 @@ router.get("/my-listings", authenticateToken, async (req, res) => {
|
||||
res.json(rentals);
|
||||
} catch (error) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.error("Error in my-listings route", {
|
||||
reqLogger.error("Error in owning route", {
|
||||
error: error.message,
|
||||
stack: error.stack,
|
||||
userId: req.user.id,
|
||||
|
||||
Reference in New Issue
Block a user