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

View File

@ -2,6 +2,11 @@
"env" : {
"MONGO_USER":"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.
## Project Structure :
```
/root
```
/root
|- controllers
| |-- admin.js
| |-- auth.js
@ -39,15 +37,14 @@
| |-- query.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
Method: POST
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
Method: GET
Requirements : |-- isAuth
@ -127,9 +123,9 @@
```
## File :- BLog.js
## File :- BLog.js
```
```
Route : /addBlog
Method: POST
Body Params : _id , title , body , author , image
@ -162,9 +158,9 @@
```
## File :- Coupon.js
## File :- Coupon.js
```
```
Route : /set-coupon
Method: POST
Body Params : percentage , coupon_code , remainingTimes
@ -231,11 +227,11 @@
Requiremnts : isAuth
Body Params : route , userId
```
```
## File Payments.js
## File Payments.js
```
```
Route : /verification
Method : POST
@ -248,11 +244,12 @@
Requirements : requireLogin
Body Params : courseId , couponCode
```
```
## File Profle.js
```
## File Profle.js
```
Route : getProfile
Method : GET
Requirements : requireLogin
@ -283,6 +280,8 @@
```
## File Query.js
```
@ -308,4 +307,3 @@
Method : POST
Requirements : None
Body Params : type
```