create-myexam-app 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/package.json +1 -1
- package/projects/PaymentController.js +37 -0
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ console.log('\n[1] Hospital Management System')
|
|
|
13
13
|
console.log('[2] Library System Management')
|
|
14
14
|
console.log('[3] Parking Management System')
|
|
15
15
|
console.log('[4] School Management System\n')
|
|
16
|
+
console.log('[5] payment controller' )
|
|
16
17
|
|
|
17
18
|
rl.question('Pick (1-4): ', (answer) => {
|
|
18
19
|
|
|
@@ -21,6 +22,7 @@ rl.question('Pick (1-4): ', (answer) => {
|
|
|
21
22
|
'2': 'libray system management',
|
|
22
23
|
'3': 'parking managementt system',
|
|
23
24
|
'4': 'school management system',
|
|
25
|
+
'5': 'paymentController',
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
const chosen = projects[answer]
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Payment from "../models/Payment.js";
|
|
2
|
+
|
|
3
|
+
export const createPayment = async (req,res) => {
|
|
4
|
+
try{
|
|
5
|
+
const payment = await payment.create(req.body);
|
|
6
|
+
res.status(201).json(payment);
|
|
7
|
+
}catch(error){
|
|
8
|
+
res.status(500).json({message:error.message});
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getPayment = async (req,res) => {
|
|
13
|
+
try{
|
|
14
|
+
const payment = await Payment.find();
|
|
15
|
+
res.status(200).json(payment);
|
|
16
|
+
}catch(error){
|
|
17
|
+
res.status(500).json({message:error.message});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const updatePayment = async (req,res) => {
|
|
22
|
+
try{
|
|
23
|
+
const payment = await Payment.findByIdAndUpdate(req.parmas.id, req.body, {new:true});
|
|
24
|
+
res.status(200).json(payment);
|
|
25
|
+
}catch(error){
|
|
26
|
+
res.status(500).json({message:error.message});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const deletePayment = async (req,res) => {
|
|
31
|
+
try{
|
|
32
|
+
const payment = await Payment.findByIdAndDelete(req.parmas.id);
|
|
33
|
+
res.status(200).json({message: "deleted successfully"});
|
|
34
|
+
}catch(error){
|
|
35
|
+
res.status(500).josn({message:error.message});
|
|
36
|
+
}
|
|
37
|
+
};
|