Skip to content

Commit 1db009c

Browse files
committed
intergarting changes
2 parents cd22003 + 9509fc9 commit 1db009c

File tree

8 files changed

+8
-11
lines changed

8 files changed

+8
-11
lines changed

Diff for: src/controllers/cart.controller.ts

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const getCart = async (req: Request, res: Response) => {
7171
as: "Product"
7272
} });
7373

74+
7475
return res.status(200).json({ cartitem });
7576
} catch (error: any) {
7677
console.log(error);

Diff for: src/controllers/checkout.controller.ts

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const createOrder = async (req: Request, res: Response) => {
2929
}));
3030

3131
const totalAmount = orderItems.reduce((total, item) => total + (item.price * item.quantity), 0);
32+
console.log(orderItems)
3233

3334
const order = await Order.create({
3435
orderId: uuidv4(),

Diff for: src/controllers/orderController.ts

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ export const getOrder = async (req: Request, res: Response) => {
105105
}
106106
};
107107

108+
109+
108110
export const getSellerOrder = async (req: Request, res: Response) => {
109111
try {
110112
const vendorId = req.params.vendorId;

Diff for: src/database/config/config.js

-6
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,3 @@ const config = {
3434
};
3535

3636
module.exports = config;
37-
<<<<<<< HEAD
38-
39-
40-
41-
=======
42-
>>>>>>> 0cff03db707fc42c5a1f30a76827dea013e4c413

Diff for: src/database/migrations/20240520142627-create-order.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
},
2323
client: {
2424
type: Sequelize.STRING,
25-
allowNull: false,
25+
allowNull: true,
2626
},
2727
paymentMethod: {
2828
type: Sequelize.STRING,

Diff for: src/database/models/order.ts

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Order extends Model {
2525
client: { type: DataTypes.STRING, allowNull: false },
2626
paymentMethod: { type: DataTypes.INTEGER, allowNull: false },
2727
status: { type: DataTypes.STRING, allowNull: false },
28-
client: { type: DataTypes.STRING, allowNull: false },
2928
products: { type: DataTypes.JSONB, allowNull: false },
3029
totalAmount: { type: DataTypes.INTEGER, allowNull: false },
3130
expectedDeliveryDate: { type: DataTypes.DATE, allowNull: true },

Diff for: src/database/seeders/20240522075149-seed-orders.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module.exports = {
1212
`);
1313

1414
const [products] = await queryInterface.sequelize.query(`
15-
SELECT "productId", "name", "vendorId"
16-
FROM "Products"
15+
SELECT "productId","name","image","price" FROM "Products"
16+
1717
LIMIT 3;
1818
`);
1919

Diff for: src/pusher.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const pusher = new Pusher({
44
appId: process.env.PUSHER_APP_ID as string,
55
key: process.env.PUSHER_KEY as string,
66
secret: process.env.PUSHER_SECRET as string,
7-
cluster: "ap2",
7+
cluster: "mt1",
88
});
99

1010
export default pusher

0 commit comments

Comments
 (0)