diff --git a/src/module/auth/auth.route.ts b/src/module/auth/auth.route.ts index 705d1b4..3d3e6f2 100644 --- a/src/module/auth/auth.route.ts +++ b/src/module/auth/auth.route.ts @@ -15,6 +15,7 @@ const authRouter = Router(); authRouter.get( "/me", // #swagger.tags = ['auth'] + // #swagger.description = 'Get currently logged in user' jwtAuthMiddleware, authController.getUser, ); @@ -22,6 +23,7 @@ authRouter.get( authRouter.post( "/register", /* #swagger.tags = ['auth'] + #swagger.description = 'Register a new user' #swagger.requestBody = { schema: { $ref: "#/components/schemas/RegisterSchema" } } */ @@ -32,6 +34,7 @@ authRouter.post( authRouter.post( "/login", /* #swagger.tags = ['auth'] + #swagger.description = 'Login user' #swagger.requestBody = { schema: { $ref: "#/components/schemas/LoginSchema" } } */ @@ -42,6 +45,7 @@ authRouter.post( authRouter.post( "/google", /* #swagger.tags = ['auth'] + #swagger.description = 'Login user with Google OAuth' #swagger.requestBody = { schema: { $ref: "#/components/schemas/OAuthSchema" } } */ @@ -52,6 +56,7 @@ authRouter.post( authRouter.post( "/fcm-token", /* #swagger.tags = ['auth'] + #swagger.description = 'Add FCM token to user' #swagger.requestBody = { schema: { $ref: "#/components/schemas/FCMTokenSchema" } } */ @@ -63,6 +68,7 @@ authRouter.post( authRouter.delete( "/fcm-token", // #swagger.tags = ['auth'] + // #swagger.description = 'Remove FCM token from user' jwtAuthMiddleware, validator(fcmTokenSchema), authController.removeFCMToken, diff --git a/src/module/category/category.route.ts b/src/module/category/category.route.ts index 956d409..bc6eed9 100644 --- a/src/module/category/category.route.ts +++ b/src/module/category/category.route.ts @@ -8,6 +8,7 @@ const categoryRouter = Router(); categoryRouter.get( "/", // #swagger.tags = ['categories'] + // #swagger.description = 'Get all categories' categoryController.getAllCategories, ); diff --git a/src/module/chat/chat.route.ts b/src/module/chat/chat.route.ts index f0673d3..f707a32 100644 --- a/src/module/chat/chat.route.ts +++ b/src/module/chat/chat.route.ts @@ -19,6 +19,7 @@ chatRouter.use(jwtAuthMiddleware); chatRouter.post( "/rooms", /* #swagger.tags = ['chat'] + #swagger.description = 'Create a new chat room' #swagger.requestBody = { schema: { $ref: "#/components/schemas/CreateRoomSchema" } } */ @@ -28,11 +29,13 @@ chatRouter.post( chatRouter.get( "/rooms", // #swagger.tags = ['chat'] + // #swagger.description = 'Get all chat rooms' chatController.getRooms, ); chatRouter.get( "/rooms/:roomId/messages", // #swagger.tags = ['chat'] + // #swagger.description = 'Get messages in a chat room' validator(getRoomMessagesSchema), chatController.getRoomMessages, ); @@ -42,6 +45,7 @@ chatRouter.get( chatRouter.post( "/rooms/:roomId/messages/text", /* #swagger.tags = ['chat'] + #swagger.description = 'Send a text message' #swagger.requestBody = { schema: { $ref: "#/components/schemas/SendTextMessageSchema" } } */ @@ -66,6 +70,7 @@ chatRouter.post( chatRouter.post( "/rooms/:roomId/typing", /* #swagger.tags = ['chat'] + #swagger.description = 'Update typing status' #swagger.requestBody = { schema: { $ref: "#/components/schemas/SetIsTypingSchema" } } */ @@ -85,6 +90,7 @@ chatRouter.post( chatRouter.get( "/rooms/:roomId/presence", // #swagger.tags = ['chat'] + // #swagger.description = 'Get room presence' validator( z.object({ params: z.object({ diff --git a/src/module/learner/learner.route.ts b/src/module/learner/learner.route.ts index dccbfde..64e4730 100644 --- a/src/module/learner/learner.route.ts +++ b/src/module/learner/learner.route.ts @@ -23,12 +23,14 @@ learnerRouter.use(verifyLearner); learnerRouter.get( "/profile", // #swagger.tags = ['learners'] + // #swagger.description = 'Get the profile data of the currently logged in learner' learnerController.getProfile, ); learnerRouter.patch( "/profile", /* #swagger.tags = ['learners'] + #swagger.description = 'Update the profile data of the currently logged in learner' #swagger.requestBody = { schema: { $ref: "#/components/schemas/UpdateLearnerProfileSchema" } } */ @@ -39,6 +41,7 @@ learnerRouter.patch( learnerRouter.patch( "/profile/learning-style", /* #swagger.tags = ['learners'] + #swagger.description = 'Update the learning style of the currently logged in learner' #swagger.requestBody = { schema: { $ref: "#/components/schemas/UpdateLearningStyleSchema" } } */ @@ -49,6 +52,7 @@ learnerRouter.patch( learnerRouter.patch( "/profile/interests", /* #swagger.tags = ['learners'] + #swagger.description = 'Update the interests of the currently logged in learner' #swagger.requestBody = { schema: { $ref: "#/components/schemas/UpdateInterestsSchema" } } */ @@ -59,6 +63,7 @@ learnerRouter.patch( learnerRouter.put( "/profile/picture", /* #swagger.tags = ['learners'] + #swagger.description = 'Update the profile picture of the currently logged in learner' #swagger.requestBody = { required: true, content: { @@ -74,6 +79,7 @@ learnerRouter.put( learnerRouter.put( "/password", /* #swagger.tags = ['learners'] + #swagger.description = 'Change the password of the currently logged in learner' #swagger.requestBody = { schema: { $ref: "#/components/schemas/ChangePasswordSchema" } } */ diff --git a/src/module/notification/notification.route.ts b/src/module/notification/notification.route.ts index 64d3232..03d138e 100644 --- a/src/module/notification/notification.route.ts +++ b/src/module/notification/notification.route.ts @@ -18,6 +18,7 @@ notificationRouter.use(jwtAuthMiddleware); notificationRouter.get( "/", // #swagger.tags = ['notifications'] + // #swagger.description = 'Get all notifications for the logged in user' validator(getNotificationsSchema), getNotifications, ); @@ -25,6 +26,7 @@ notificationRouter.get( notificationRouter.post( "/:notificationId/read", // #swagger.tags = ['notifications'] + // #swagger.description = 'Mark a notification as read' validator(markAsReadSchema), markAsRead, ); @@ -32,6 +34,7 @@ notificationRouter.post( notificationRouter.post( "/read-all", // #swagger.tags = ['notifications'] + // #swagger.description = 'Mark all notifications as read' markAllAsRead, ); diff --git a/src/module/order/order.route.ts b/src/module/order/order.route.ts index 9d07811..148bd44 100644 --- a/src/module/order/order.route.ts +++ b/src/module/order/order.route.ts @@ -19,6 +19,7 @@ orderRouter.use(jwtAuthMiddleware); orderRouter.get( "/me", // #swagger.tags = ['orders'] + // #swagger.description = 'Get all orders (session) of the current user' validator(getMyOrdersSchema), orderController.getMyOrders, ); @@ -26,6 +27,7 @@ orderRouter.get( orderRouter.post( "/", /* #swagger.tags = ['orders'] + #swagger.description = 'Create a new order' #swagger.requestBody = { schema: { $ref: "#/components/schemas/CreateOrderSchema" } } */ @@ -37,6 +39,7 @@ orderRouter.post( orderRouter.post( "/:orderId/accept", // #swagger.tags = ['orders'] + // #swagger.description = 'Accept an order' verifyTutor, validator(changeOrderStatusSchema), orderController.acceptOrder, @@ -45,6 +48,7 @@ orderRouter.post( orderRouter.post( "/:orderId/decline", // #swagger.tags = ['orders'] + // #swagger.description = 'Decline an order' verifyTutor, validator(changeOrderStatusSchema), orderController.declineOrder, @@ -53,6 +57,7 @@ orderRouter.post( orderRouter.post( "/:orderId/cancel", // #swagger.tags = ['orders'] + // #swagger.description = 'Cancel an order' verifyTutor, validator(changeOrderStatusSchema), orderController.cancelOrder, @@ -61,6 +66,7 @@ orderRouter.post( orderRouter.get( "/unreviewed", // #swagger.tags = ['orders'] + // #swagger.description = 'Get all unreviewed orders of the learner' verifyLearner, orderController.getUnreviewedOrders, ); diff --git a/src/module/review/review.route.ts b/src/module/review/review.route.ts index 6a3c133..4c8e129 100644 --- a/src/module/review/review.route.ts +++ b/src/module/review/review.route.ts @@ -17,6 +17,7 @@ const reviewRouter = Router(); reviewRouter.get( "/tutories/:tutoriesId", // #swagger.tags = ['reviews'] + // #swagger.description = 'Get reviews of a tutories' validator(getReviewsSchema), reviewController.getTutoriesReviews, ); @@ -28,6 +29,7 @@ reviewRouter.use(verifyLearner); reviewRouter.post( "/orders/:orderId", /* #swagger.tags = ['reviews'] + #swagger.description = 'Create review for an order' #swagger.requestBody = { schema: { $ref: "#/components/schemas/CreateReviewSchema" } } */ @@ -38,6 +40,7 @@ reviewRouter.post( reviewRouter.post( "/orders/:orderId/dismiss", // #swagger.tags = ['reviews'] + // #swagger.description = 'Dismiss review prompt' validator(dismissReviewSchema), reviewController.dismissReviewPrompt, ); diff --git a/src/module/tutories/tutories.route.ts b/src/module/tutories/tutories.route.ts index cd5f963..fb35868 100644 --- a/src/module/tutories/tutories.route.ts +++ b/src/module/tutories/tutories.route.ts @@ -21,6 +21,7 @@ tutoriesRouter.use(jwtAuthMiddleware); tutoriesRouter.get( "/", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Get all tutories (tutor services)' validator(getTutoriesSchema), tutoriesController.getAllTutories, ); @@ -28,6 +29,7 @@ tutoriesRouter.get( tutoriesRouter.get( "/avg-rate", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Get average hourly rate of tutories in specified category, city, or district)' validator(getAverageRateSchema), tutoriesController.getAverageRate, ); @@ -35,18 +37,22 @@ tutoriesRouter.get( tutoriesRouter.get( "/locations", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Get all locations where tutories are available' tutoriesController.getLocations, ); tutoriesRouter.get( "/recommendations", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Get recommended tutories for learner' verifyLearner, tutoriesController.getRecommendations, ); tutoriesRouter.get( "/interaction/:tutoriesId", + // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Track interaction with tutories (view)' verifyLearner, validator(trackInteractionSchema), tutoriesController.trackInteraction, @@ -55,6 +61,7 @@ tutoriesRouter.get( tutoriesRouter.get( "/:tutoriesId", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Get details of a tutories' tutoriesController.getTutories, ); @@ -65,12 +72,14 @@ tutoriesRouter.use(verifyTutor); tutoriesRouter.get( "/me", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Get all tutories of current logged in tutor' tutoriesController.getMyTutories, ); tutoriesRouter.post( "/", /* #swagger.tags = ['tutors/services'] + #swagger.description = 'Create a new tutories (tutor service)' #swagger.requestBody = { schema: { $ref: "#/components/schemas/CreateTutoriesSchema" } } */ @@ -80,6 +89,7 @@ tutoriesRouter.post( tutoriesRouter.patch( "/:tutoriesId", /* #swagger.tags = ['tutors/services'] + # #swagger.description = 'Update a tutories (tutor service)' #swagger.requestBody = { schema: { $ref: "#/components/schemas/UpdateTutoriesSchema" } } */ @@ -89,6 +99,7 @@ tutoriesRouter.patch( tutoriesRouter.delete( "/:tutoriesId", // #swagger.tags = ['tutors/services'] + // #swagger.description = 'Delete a tutories (tutor service)' tutoriesController.deleteTutories, ); diff --git a/src/swagger/components.ts b/src/swagger/components.ts index 8b698c7..36f64f4 100644 --- a/src/swagger/components.ts +++ b/src/swagger/components.ts @@ -33,12 +33,10 @@ export const components = { UpdateLearnerProfileSchema: { name: "David Gacoan", email: "example@bangkit.academy", - phoneNumber: "081234567890", + phoneNumber: "6281234567890", city: "Samarinda", district: "Samarinda Utara", gender: "male/female", - interests: ["categoryId", "categoryId"], - learningStyle: "visual/auditory/kinesthetic", }, UpdateTutorProfileSchema: { name: "Dony Gacoan", @@ -47,7 +45,7 @@ export const components = { city: "Samarinda", district: "Samarinda Utara", gender: "male/female", - $availability: { + availability: { 1: ["07:00", "08:00"], 3: ["08:00", "09:00"], 6: ["10:00", "13:00"],