Merge branch 'main' into yashrajverma

This commit is contained in:
yashraj verma 2021-05-27 20:33:54 +05:30 committed by GitHub
commit b31361fb4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 274 additions and 268 deletions

View File

@ -9,8 +9,8 @@ const { getAllCoupons } = require('./coupon');
//test credentials of razorpay //test credentials of razorpay
const instance = new razorpay({ const instance = new razorpay({
key_id : 'rzp_test_tLx9c6GiWjKcsl' , key_id : process.env.KEY_ID ,
key_secret : '4Cf52d6C3amkptdRLCTdC2sT' key_secret : process.env.KEY_SECRET
}) ; }) ;
module.exports.postVerify =async (req , res , next) => { module.exports.postVerify =async (req , res , next) => {
@ -108,6 +108,9 @@ module.exports.postRazorpay = async (req , res , next) => {
const courseId = req.body.courseId ; const courseId = req.body.courseId ;
const couponCode = req.body.couponCode ; const couponCode = req.body.couponCode ;
const userId = req.user._id ; const userId = req.user._id ;
console.log("Course ID =" ,courseId ," Coupon code =" , couponCode ," user ID =" , userId) ;
let user = await User.findById(userId) ; let user = await User.findById(userId) ;
let student =await Student.findById(user.student) ; let student =await Student.findById(user.student) ;
let course =await CourseType.findById(courseId) ; let course =await CourseType.findById(courseId) ;

View File

@ -2,6 +2,11 @@
"env" : { "env" : {
"MONGO_USER":"Cantilever", "MONGO_USER":"Cantilever",
"MONGO_PASSWORD" :"Cantilever" , "MONGO_PASSWORD" :"Cantilever" ,
"MONGO_DEFAULT_DATABASE" :"myFirstDatabase" "MONGO_DEFAULT_DATABASE" :"myFirstDatabase" ,
"KEY_ID" : "rzp_live_aD9j5WLBGtdQxt" ,
"KEY_SECRET" : "o9BDCwYcpNcHyFL5yjiY7OWG" ,
"EMAIL" : "AKIA2G7743RRTZMVXE3X" ,
"HOST" : "email-smtp.us-east-1.amazonaws.com" ,
"PASS" : "BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c"
} }
} }

View File

@ -1,9 +1,7 @@
# Cantileverlabs Nodejs Backend API Documentation. # Cantileverlabs Nodejs Backend API Documentation.
## Project Structure : ## Project Structure :
```
``` /root
/root
|- controllers |- controllers
| |-- admin.js | |-- admin.js
| |-- auth.js | |-- auth.js
@ -39,15 +37,14 @@
| |-- query.js | |-- query.js
| |
|- app.js |- app.js
``` ```
### App will listen on the port `http://localhost:5000`
### App will listen on the port `http://localhost:5000` # Routes Functions and Body Parameters.
# Routes Functions and Body Parameters. ## File :- Admin.js
## File :- Admin.js ```
```
Route : /addSchedule Route : /addSchedule
Method: POST Method: POST
Requirements : |-- isAuth Requirements : |-- isAuth
@ -65,11 +62,10 @@
``` ```
## File :- Auth.js ## File :- Auth.js
### Note: `All the Body Params are as it is`
### Note: `All the Body Params are as it is` ```
```
Route : /protected Route : /protected
Method: GET Method: GET
Requirements : |-- isAuth Requirements : |-- isAuth
@ -127,9 +123,9 @@
``` ```
## File :- BLog.js ## File :- BLog.js
``` ```
Route : /addBlog Route : /addBlog
Method: POST Method: POST
Body Params : _id , title , body , author , image Body Params : _id , title , body , author , image
@ -162,9 +158,9 @@
``` ```
## File :- Coupon.js ## File :- Coupon.js
``` ```
Route : /set-coupon Route : /set-coupon
Method: POST Method: POST
Body Params : percentage , coupon_code , remainingTimes Body Params : percentage , coupon_code , remainingTimes
@ -231,11 +227,11 @@
Requiremnts : isAuth Requiremnts : isAuth
Body Params : route , userId Body Params : route , userId
``` ```
## File Payments.js ## File Payments.js
``` ```
Route : /verification Route : /verification
Method : POST Method : POST
@ -248,11 +244,12 @@
Requirements : requireLogin Requirements : requireLogin
Body Params : courseId , couponCode Body Params : courseId , couponCode
``` ```
## File Profle.js
``` ## File Profle.js
```
Route : getProfile Route : getProfile
Method : GET Method : GET
Requirements : requireLogin Requirements : requireLogin
@ -283,6 +280,8 @@
``` ```
## File Query.js ## File Query.js
``` ```
@ -308,4 +307,3 @@
Method : POST Method : POST
Requirements : None Requirements : None
Body Params : type Body Params : type
```