MCPcopy Create free account

hub / github.com/ankurdotio/testdog / functions

Functions120 in github.com/ankurdotio/testdog

↓ 59 callersMethodset
* Set a value in Redis * @param {string} key - Key to set * @param {any} value - Value to store (will be stringified) * @param {number} [expi
src/config/redis.js:147
↓ 57 callersMethodget
* Get a value from Redis * @param {string} key - Key to get value for * @returns {Promise<any>} - Promise resolving to the value or null if not
src/config/redis.js:130
↓ 31 callersFunctionasyncHandler
(fn)
src/utils/asyncHandler.js:8
↓ 18 callersMethodcreate
(paymentData)
src/dao/payment.dao.js:6
↓ 10 callersFunctionconvertCurrency
(amount, fromCurrency, toCurrency)
src/utils/currencyUtils.js:39
↓ 10 callersFunctionvalidate
(req, res, next)
src/validators/payment.validator.js:5
↓ 8 callersMethodfindById
* Find a user by ID. * @param {string} userId - MongoDB user ID. * @returns {Promise<Object|null>} - Found user document or null.
src/dao/user.dao.js:40
↓ 7 callersMethoddisconnect
* Close Redis connection * @returns {Promise<void>}
src/config/redis.js:117
↓ 6 callersMethodgenerateAccessToken
* Generate JWT token from user ID. * @param {string} userId * @returns {string} - JWT Token
src/services/user.service.js:77
↓ 6 callersMethodsanitizeCartResponse
* Sanitize cart response for client * @param {Object} cart - Cart document * @returns {Object} - Sanitized cart data
src/services/cart.service.js:291
↓ 6 callersMethodsanitizeProductResponse
* Remove sensitive data from product response * @param {Object} product - Product document * @returns {Object} - Sanitized product data
src/services/product.service.js:143
↓ 5 callersFunctioncreateRateLimiterWithFallback
(options)
src/middlewares/rateLimiter.middleware.js:31
↓ 5 callersMethoddelete
(paymentId)
src/dao/payment.dao.js:367
↓ 5 callersMethodfindByEmail
* Find a user by email. Useful during login or password reset. * @param {string} email - User's email address. * @returns {Promise<Object|null>}
src/dao/user.dao.js:22
↓ 5 callersMethodfindCartByUserId
* Find cart by user ID * @param {string} userId - User ID * @returns {Promise<Object|null>} - Found cart document or null
src/dao/cart.dao.js:13
↓ 5 callersMethodfindProductById
* Find a product by ID. * @param {string} productId - MongoDB product ID. * @returns {Promise<Object|null>} - Found product document or null.
src/dao/product.dao.js:29
↓ 5 callersFunctiontimeStringToSeconds
(timeString)
src/utils/timeUtils.js:6
↓ 4 callersMethodconnect
* Initialize Redis client if not already initialized * @returns {Promise<boolean>} - True if successfully connected or already connected
src/config/redis.js:54
↓ 4 callersMethodfindByRazorpayOrderId
(razorpayOrderId)
src/dao/payment.dao.js:53
↓ 4 callersFunctionformatCurrency
(amount, currency)
src/utils/currencyUtils.js:86
↓ 4 callersMethodupdateStatus
(paymentId, status, additionalData = {})
src/dao/payment.dao.js:121
↓ 3 callersMethodgenerateRefreshToken
* generate JWT refresh token. * @param {string} userId * @returns {string} - JWT Refresh Token
src/services/user.service.js:88
↓ 2 callersMethodaddRefundInfo
(paymentId, refundData)
src/dao/payment.dao.js:171
↓ 2 callersMethodcreateCart
* Create a new cart for user * @param {string} userId - User ID * @returns {Promise<Object>} - Created cart document
src/dao/cart.dao.js:26
↓ 2 callersFunctioncreateRedisStore
(prefix)
src/middlewares/rateLimiter.middleware.js:11
↓ 2 callersMethodfindProductsByName
* Find products by name using basic text search (fallback method) * @param {string} keyword - Search keyword * @param {number} limit - Number of
src/dao/product.dao.js:170
↓ 2 callersMethodgenerateOrderId
()
src/services/payment.service.js:20
↓ 2 callersMethodgetCart
* Get user's cart * @param {string} userId - User ID * @returns {Promise<Object>} - User's cart
src/services/cart.service.js:118
↓ 2 callersFunctiongetExchangeRate
(fromCurrency, toCurrency)
src/utils/currencyUtils.js:63
↓ 2 callersMethodgetMe
* Return current logged-in user details. * @param {string} userId - MongoDB user ID from token * @returns {Promise<Object|null>} - User details
src/services/user.service.js:68
↓ 2 callersMethodgetPaymentDetails
(paymentId)
src/services/payment.service.js:326
↓ 2 callersMethodisConnected
* Get Redis connection status * @returns {boolean} - True if connected, false otherwise
src/config/redis.js:109
↓ 2 callersMethodregisterUser
* Register a new user after checking for existing email/username. * @param {Object} userData - { googleId?, username, email, password,name?, avatar
src/services/user.service.js:19
↓ 2 callersFunctionrestrictTo
(...roles)
src/middlewares/auth.middleware.js:63
↓ 2 callersMethodupdateWithPaymentDetails
( paymentId, razorpayPaymentId, razorpaySignature, paymentMethod )
src/dao/payment.dao.js:144
↓ 1 callersMethodaddItemToCart
* Add item to cart or update existing item * @param {string} userId - User ID * @param {Object} itemData - Item data to add * @returns {Promi
src/dao/cart.dao.js:41
↓ 1 callersMethodaddToCart
* Add product to cart with validation and business logic * @param {string} userId - User ID * @param {Object} cartData - Cart item data * @re
src/services/cart.service.js:13
↓ 1 callersMethodautocompleteSearch
* Autocomplete search for products using MongoDB Atlas Search. * @param {string} keyword - The search term typed by the user. * @param {number}
src/dao/product.dao.js:129
↓ 1 callersMethodclearCart
* Clear entire cart * @param {string} userId - User ID * @returns {Promise<Object>} - Cleared cart
src/services/cart.service.js:223
↓ 1 callersMethodclearCart
* Clear entire cart * @param {string} userId - User ID * @returns {Promise<Object|null>} - Updated cart document or null
src/dao/cart.dao.js:163
↓ 1 callersFunctionconnectToDatabase
()
src/config/db.js:5
↓ 1 callersMethodcountAllProducts
* Count all products in the database. * @returns {Promise<number>} - Total count of products.
src/dao/product.dao.js:21
↓ 1 callersMethodcreateCartOrder
(userId, shippingAddress = null, notes = '')
src/services/payment.service.js:25
↓ 1 callersMethodcreateProduct
* Create a new product document in the database. * @param {Object} productData - Contains product details like name, price, etc. * @returns {Pro
src/dao/product.dao.js:13
↓ 1 callersMethodcreateSingleProductOrder
( userId, productId, quantity = 1, selectedSize = null, selectedColor = null, shipping
src/services/payment.service.js:140
↓ 1 callersFunctioncreateTransporter
()
src/config/email.config.js:15
↓ 1 callersMethodcreateUser
* Create a new user document in the database. * @param {Object} userData - Contains username, email, password, etc. * @returns {Promise<Object>}
src/dao/user.dao.js:13
↓ 1 callersMethoddel
* Delete a key from Redis * @param {string} key - Key to delete * @returns {Promise<boolean>} - Promise resolving to true if successful
src/config/redis.js:167
↓ 1 callersMethodfindAllProducts
* Find all products with pagination. * @param {number} page - Page number for pagination. * @param {number} limit - Number of products per page.
src/dao/product.dao.js:67
↓ 1 callersMethodfindByGoogleId
* Find a user by Google ID. * @param {string} googleId - User's Google ID. * @returns {Promise<Object|null>} - Found user document or null.
src/dao/user.dao.js:31
↓ 1 callersMethodfindByRazorpayPaymentId
(razorpayPaymentId)
src/dao/payment.dao.js:65
↓ 1 callersMethodfindByUsername
* Find a user by username. * @param {string} username - User's unique username. * @returns {Promise<Object|null>} - Found user document or null.
src/dao/user.dao.js:58
↓ 1 callersMethodfindCartItemByProduct
* Check if item exists in cart * @param {string} userId - User ID * @param {string} productId - Product ID * @param {string} selectedSize - S
src/dao/cart.dao.js:188
↓ 1 callersMethodfuzzySearch
* Fuzzy search for products based on a keyword. * Uses MongoDB Atlas Search for advanced text search capabilities. * @param {string} keyword - S
src/dao/product.dao.js:78
↓ 1 callersMethodgenerateVerificationToken
* Generate user verification token by ID. * @param {string} userId - MongoDB user ID * @returns {Promise<Object>} - Verification token
src/services/user.service.js:196
↓ 1 callersMethodgetAllProducts
* Get all products with pagination * @param {number} page - Page number * @param {number} limit - Items per page * @returns {Promise<Object>}
src/services/product.service.js:179
↓ 1 callersMethodgetAllUsersPaginated
* Get paginated list of users. * @param {number} page - Page number * @param {number} limit - Number of users per page * @returns {Promise<Ob
src/dao/user.dao.js:106
↓ 1 callersMethodgetAutocompleteSuggestions
* Get autocomplete suggestions * @param {string} keyword - Search keyword * @param {number} limit - Number of suggestions * @returns {Promise
src/services/product.service.js:225
↓ 1 callersFunctiongetLevel
()
src/loggers/winston.logger.js:14
↓ 1 callersMethodgetProductById
* Get product by ID * @param {string} productId - Product ID * @returns {Promise<Object>} - Product data
src/services/product.service.js:165
↓ 1 callersMethodgetRandomProduct
* Get a random product from the database. * @returns {Promise<Object|null>} - Random product document or null if no products exist.
src/dao/product.dao.js:160
↓ 1 callersMethodgetRandomUser
* Get a random user from the database. * @returns {Promise<Object|null>} - Random user document or null if no users exist.
src/dao/user.dao.js:90
↓ 1 callersMethodgetUserPaymentHistory
(userId, status = null, page = 1, limit = 10)
src/services/payment.service.js:345
↓ 1 callersMethodgetUserPayments
(userId, options = {})
src/dao/payment.dao.js:77
↓ 1 callersMethodhandlePaymentCaptured
(paymentData)
src/services/payment.service.js:451
↓ 1 callersMethodhandlePaymentFailed
(paymentData)
src/services/payment.service.js:470
↓ 1 callersMethodhandleRefundProcessed
(refundData)
src/services/payment.service.js:483
↓ 1 callersMethodhandleWebhook
(signature, payload)
src/services/payment.service.js:415
↓ 1 callersMethodincrementCartItemQuantity
* Update existing cart item quantity by incrementing * @param {string} userId - User ID * @param {string} productId - Product ID * @param {st
src/dao/cart.dao.js:218
↓ 1 callersMethodloginUser
* Login user by checking email and comparing password. * @param {string} email * @param {string} password * @returns {Promise<Object>} - User
src/services/user.service.js:52
↓ 1 callersMethodprocessProductData
* Process and set default values for product data * @param {Object} productData - Raw product data * @returns {Object} - Processed product data
src/services/product.service.js:86
↓ 1 callersMethodrefundPayment
(paymentId, refundAmount = null, reason = '')
src/services/payment.service.js:364
↓ 1 callersMethodremoveCartItem
* Remove item from cart * @param {string} userId - User ID * @param {string} itemId - Cart item ID * @returns {Promise<Object|null>} - Update
src/dao/cart.dao.js:124
↓ 1 callersMethodsearchProducts
* Search products using fuzzy search * @param {string} keyword - Search keyword * @param {number} limit - Number of results * @returns {Promi
src/services/product.service.js:204
↓ 1 callersFunctionsendVerificationEmail
(to, verificationLink)
src/utils/sendEmail.js:4
↓ 1 callersMethodupdateCartItem
* Update cart item quantity * @param {string} userId - User ID * @param {string} itemId - Cart item ID * @param {number} quantity - New quant
src/services/cart.service.js:144
↓ 1 callersMethodupdateCartItemQuantity
* Update cart item quantity * @param {string} userId - User ID * @param {string} itemId - Cart item ID * @param {number} quantity - New quant
src/dao/cart.dao.js:81
↓ 1 callersMethodupdateUser
* Update user details like username or email. * @param {string} userId - MongoDB user ID * @param {Object} updateData - Fields to update * @r
src/services/user.service.js:127
↓ 1 callersMethodvalidateCartItems
* Validate cart items and remove unavailable products * @param {Object} cart - Cart document * @returns {Promise<Object>} - Validated cart
src/services/cart.service.js:241
↓ 1 callersMethodvalidateProductBusinessRules
* Validate business rules for product creation * @param {Object} productData - Product data to validate
src/services/product.service.js:37
↓ 1 callersMethodverifyEmail
* Verify user email using verification token. * @param {string} token - Verification token * @returns {Promise<Object>} - Verified user object
src/services/user.service.js:215
↓ 1 callersMethodverifyPayment
(razorpayOrderId, razorpayPaymentId, razorpaySignature)
src/services/payment.service.js:254
↓ 1 callersMethodverifyPaymentSignature
( razorpayOrderId, razorpayPaymentId, razorpaySignature )
src/services/payment.service.js:239
↓ 1 callersMethodverifyRefreshToken
* Verify Refresh Token and return user details. * @param {string} refreshToken - Refresh token * @returns {Promise<Object>} - User object
src/services/user.service.js:153
MethodcheckUserByEmail
* Check if a user exists with given email. * Useful for forgot-password flow. * @param {string} email * @returns {Promise<Object|null>} - Fou
src/services/user.service.js:102
Methodconstructor
* Create an operational error instance. * @param {string} message - Error message to show to client. * @param {number} statusCode - HTTP status
src/utils/appError.js:11
Methodconstructor
()
src/services/payment.service.js:12
Methodconstructor
* Create a new RedisService instance (private constructor) * @param {Object} options - Redis connection options
src/config/redis.js:28
MethodcreateProduct
* Create a new product with validation and business logic * @param {Object} productData - Product data from request * @returns {Promise<Object>}
src/services/product.service.js:11
MethoddeleteProductById
* Delete a product by ID. * @param {string} productId - MongoDB product ID. * @returns {Promise<Object|null>} - Deleted product document or null
src/dao/product.dao.js:58
MethoddeleteUserById
* Delete a user by ID. * @param {string} userId - MongoDB user ID. * @returns {Promise<Object|null>} - Deleted user document or null.
src/dao/user.dao.js:82
FunctionerrorHandler
(err, req, res, next)
src/middlewares/errorHandler.js:9
Methodexists
* Check if a key exists in Redis * @param {string} key - Key to check * @returns {Promise<boolean>} - Promise resolving to true if key exists
src/config/redis.js:182
Methodexpire
* Set expiration time on a key * @param {string} key - Key to expire * @param {number} seconds - Seconds until expiration * @returns {Promise
src/config/redis.js:198
MethodfindById
(paymentId, populate = false)
src/dao/payment.dao.js:16
MethodfindByOrderId
(orderId)
src/dao/payment.dao.js:41
MethodfindProductsByCategory
* Find products by category. * @param {string} category - Product category. * @returns {Promise<Array>} - Array of found product documents.
src/dao/product.dao.js:37
MethodgetAllUsersPaginated
* Get all users with pagination. * @param {number} page * @param {number} limit * @returns {Promise<Object>} - Paginated users with total cou
src/services/user.service.js:266
MethodgetInstance
* Get the singleton instance of RedisService * @param {Object} options - Redis connection options * @returns {RedisService} - The singleton inst
src/config/redis.js:17
MethodgetOrderTypeStats
(dateFilter = {})
src/dao/payment.dao.js:335
next →1–100 of 120, ranked by callers