287 lines
7.3 KiB
TypeScript
287 lines
7.3 KiB
TypeScript
// Database Helper - PostgreSQL
|
|
// Main entry point for the package
|
|
|
|
// Re-export database connection
|
|
export { db } from './src/db/db_index';
|
|
|
|
// Re-export schema
|
|
export * from './src/db/schema';
|
|
|
|
// Admin API helpers - explicitly namespaced exports to avoid duplicates
|
|
export {
|
|
// Banner
|
|
getBanners,
|
|
getBannerById,
|
|
createBanner,
|
|
updateBanner,
|
|
deleteBanner,
|
|
} from './src/admin-apis/banner';
|
|
|
|
export {
|
|
// Complaint
|
|
getComplaints,
|
|
resolveComplaint,
|
|
} from './src/admin-apis/complaint';
|
|
|
|
export {
|
|
// Constants
|
|
getAllConstants,
|
|
upsertConstants,
|
|
} from './src/admin-apis/const';
|
|
|
|
export {
|
|
// Coupon
|
|
getAllCoupons,
|
|
getCouponById,
|
|
invalidateCoupon,
|
|
validateCoupon,
|
|
getReservedCoupons,
|
|
getUsersForCoupon,
|
|
createCouponWithRelations,
|
|
updateCouponWithRelations,
|
|
generateCancellationCoupon,
|
|
createReservedCouponWithProducts,
|
|
createCouponForUser,
|
|
checkUsersExist,
|
|
checkCouponExists,
|
|
checkReservedCouponExists,
|
|
getOrderWithUser,
|
|
} from './src/admin-apis/coupon';
|
|
|
|
export {
|
|
// Order
|
|
updateOrderNotes,
|
|
getOrderDetails,
|
|
updateOrderPackaged,
|
|
updateOrderDelivered,
|
|
updateOrderItemPackaging,
|
|
removeDeliveryCharge,
|
|
getSlotOrders,
|
|
updateAddressCoords,
|
|
getAllOrders,
|
|
rebalanceSlots,
|
|
cancelOrder,
|
|
deleteOrderById,
|
|
} from './src/admin-apis/order';
|
|
|
|
export {
|
|
// Product
|
|
getAllProducts,
|
|
getProductById,
|
|
deleteProduct,
|
|
createProduct,
|
|
updateProduct,
|
|
toggleProductOutOfStock,
|
|
updateSlotProducts,
|
|
getSlotProductIds,
|
|
getSlotsProductIds,
|
|
getAllUnits,
|
|
getAllProductTags,
|
|
getProductReviews,
|
|
respondToReview,
|
|
getAllProductGroups,
|
|
createProductGroup,
|
|
updateProductGroup,
|
|
deleteProductGroup,
|
|
addProductToGroup,
|
|
removeProductFromGroup,
|
|
updateProductPrices,
|
|
} from './src/admin-apis/product';
|
|
|
|
export {
|
|
// Slots
|
|
getActiveSlotsWithProducts,
|
|
getActiveSlots,
|
|
getSlotsAfterDate,
|
|
getSlotByIdWithRelations,
|
|
createSlotWithRelations,
|
|
updateSlotWithRelations,
|
|
deleteSlotById,
|
|
updateSlotCapacity,
|
|
getSlotDeliverySequence,
|
|
updateSlotDeliverySequence,
|
|
} from './src/admin-apis/slots';
|
|
|
|
export {
|
|
// Staff User
|
|
getStaffUserByName,
|
|
getAllStaff,
|
|
getAllUsers,
|
|
getUserWithDetails,
|
|
updateUserSuspensionStatus,
|
|
checkStaffUserExists,
|
|
checkStaffRoleExists,
|
|
createStaffUser,
|
|
getAllRoles,
|
|
} from './src/admin-apis/staff-user';
|
|
|
|
export {
|
|
// Store
|
|
getAllStores,
|
|
getStoreById,
|
|
createStore,
|
|
updateStore,
|
|
deleteStore,
|
|
} from './src/admin-apis/store';
|
|
|
|
export {
|
|
// User
|
|
createUserByMobile,
|
|
getUserByMobile,
|
|
getUnresolvedComplaintsCount,
|
|
getAllUsersWithFilters,
|
|
getOrderCountsByUserIds,
|
|
getLastOrdersByUserIds,
|
|
getSuspensionStatusesByUserIds,
|
|
getUserBasicInfo,
|
|
getUserSuspensionStatus,
|
|
getUserOrders,
|
|
getOrderStatusesByOrderIds,
|
|
getItemCountsByOrderIds,
|
|
upsertUserSuspension,
|
|
searchUsers,
|
|
getAllNotifCreds,
|
|
getAllUnloggedTokens,
|
|
getNotifTokensByUserIds,
|
|
getUserIncidentsWithRelations,
|
|
createUserIncident,
|
|
} from './src/admin-apis/user';
|
|
|
|
export {
|
|
// Vendor Snippets
|
|
checkVendorSnippetExists,
|
|
getVendorSnippetById,
|
|
getVendorSnippetByCode,
|
|
getAllVendorSnippets,
|
|
createVendorSnippet,
|
|
updateVendorSnippet,
|
|
deleteVendorSnippet,
|
|
getProductsByIds,
|
|
getVendorSlotById,
|
|
getVendorOrdersBySlotId,
|
|
getOrderItemsByOrderIds,
|
|
getOrderStatusByOrderIds,
|
|
updateVendorOrderItemPackaging,
|
|
getVendorOrders,
|
|
} from './src/admin-apis/vendor-snippets';
|
|
|
|
export {
|
|
// User Address
|
|
getDefaultAddress as getUserDefaultAddress,
|
|
getUserAddresses,
|
|
getUserAddressById,
|
|
clearDefaultAddress as clearUserDefaultAddress,
|
|
createUserAddress,
|
|
updateUserAddress,
|
|
deleteUserAddress,
|
|
hasOngoingOrdersForAddress,
|
|
} from './src/user-apis/address';
|
|
|
|
export {
|
|
// User Banners
|
|
getActiveBanners as getUserActiveBanners,
|
|
} from './src/user-apis/banners';
|
|
|
|
export {
|
|
// User Cart
|
|
getCartItemsWithProducts as getUserCartItemsWithProducts,
|
|
getProductById as getUserProductById,
|
|
getCartItemByUserProduct as getUserCartItemByUserProduct,
|
|
incrementCartItemQuantity as incrementUserCartItemQuantity,
|
|
insertCartItem as insertUserCartItem,
|
|
updateCartItemQuantity as updateUserCartItemQuantity,
|
|
deleteCartItem as deleteUserCartItem,
|
|
clearUserCart,
|
|
} from './src/user-apis/cart';
|
|
|
|
export {
|
|
// User Complaint
|
|
getUserComplaints as getUserComplaints,
|
|
createComplaint as createUserComplaint,
|
|
} from './src/user-apis/complaint';
|
|
|
|
export {
|
|
// User Stores
|
|
getStoreSummaries as getUserStoreSummaries,
|
|
getStoreDetail as getUserStoreDetail,
|
|
} from './src/user-apis/stores';
|
|
|
|
export {
|
|
// User Product
|
|
getProductDetailById as getUserProductDetailById,
|
|
getProductReviews as getUserProductReviews,
|
|
getProductById as getUserProductByIdBasic,
|
|
createProductReview as createUserProductReview,
|
|
} from './src/user-apis/product';
|
|
|
|
export {
|
|
// User Slots
|
|
getActiveSlotsList as getUserActiveSlotsList,
|
|
getProductAvailability as getUserProductAvailability,
|
|
} from './src/user-apis/slots';
|
|
|
|
export {
|
|
// User Payments
|
|
getOrderById as getUserPaymentOrderById,
|
|
getPaymentByOrderId as getUserPaymentByOrderId,
|
|
getPaymentByMerchantOrderId as getUserPaymentByMerchantOrderId,
|
|
updatePaymentSuccess as updateUserPaymentSuccess,
|
|
updateOrderPaymentStatus as updateUserOrderPaymentStatus,
|
|
markPaymentFailed as markUserPaymentFailed,
|
|
} from './src/user-apis/payments';
|
|
|
|
export {
|
|
// User Auth
|
|
getUserByEmail as getUserAuthByEmail,
|
|
getUserByMobile as getUserAuthByMobile,
|
|
getUserById as getUserAuthById,
|
|
getUserCreds as getUserAuthCreds,
|
|
getUserDetails as getUserAuthDetails,
|
|
createUserWithCreds as createUserAuthWithCreds,
|
|
createUserWithMobile as createUserAuthWithMobile,
|
|
upsertUserPassword as upsertUserAuthPassword,
|
|
deleteUserAccount as deleteUserAuthAccount,
|
|
} from './src/user-apis/auth';
|
|
|
|
export {
|
|
// User Coupon
|
|
getActiveCouponsWithRelations as getUserActiveCouponsWithRelations,
|
|
getAllCouponsWithRelations as getUserAllCouponsWithRelations,
|
|
getReservedCouponByCode as getUserReservedCouponByCode,
|
|
redeemReservedCoupon as redeemUserReservedCoupon,
|
|
} from './src/user-apis/coupon';
|
|
|
|
export {
|
|
// User Profile
|
|
getUserById as getUserProfileById,
|
|
getUserDetailByUserId as getUserProfileDetailById,
|
|
getUserWithCreds as getUserWithCreds,
|
|
getNotifCred as getUserNotifCred,
|
|
upsertNotifCred as upsertUserNotifCred,
|
|
deleteUnloggedToken as deleteUserUnloggedToken,
|
|
getUnloggedToken as getUserUnloggedToken,
|
|
upsertUnloggedToken as upsertUserUnloggedToken,
|
|
} from './src/user-apis/user';
|
|
|
|
export {
|
|
// User Order
|
|
validateAndGetCoupon as validateAndGetUserCoupon,
|
|
applyDiscountToOrder as applyDiscountToUserOrder,
|
|
getAddressByIdAndUser as getUserAddressByIdAndUser,
|
|
getProductById as getOrderProductById,
|
|
checkUserSuspended,
|
|
getSlotCapacityStatus as getUserSlotCapacityStatus,
|
|
placeOrderTransaction as placeUserOrderTransaction,
|
|
deleteCartItemsForOrder as deleteUserCartItemsForOrder,
|
|
recordCouponUsage as recordUserCouponUsage,
|
|
getOrdersWithRelations as getUserOrdersWithRelations,
|
|
getOrderCount as getUserOrderCount,
|
|
getOrderByIdWithRelations as getUserOrderByIdWithRelations,
|
|
getCouponUsageForOrder as getUserCouponUsageForOrder,
|
|
getOrderBasic as getUserOrderBasic,
|
|
cancelOrderTransaction as cancelUserOrderTransaction,
|
|
updateOrderNotes as updateUserOrderNotes,
|
|
getRecentlyDeliveredOrderIds as getUserRecentlyDeliveredOrderIds,
|
|
getProductIdsFromOrders as getUserProductIdsFromOrders,
|
|
getProductsForRecentOrders as getUserProductsForRecentOrders,
|
|
} from './src/user-apis/order';
|