Skip to content

Commit

Permalink
intergarting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sevelinCa committed Jul 21, 2024
2 parents cd22003 + 9509fc9 commit 1db009c
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/controllers/cart.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const getCart = async (req: Request, res: Response) => {
as: "Product"
} });


return res.status(200).json({ cartitem });
} catch (error: any) {
console.log(error);
Expand Down
1 change: 1 addition & 0 deletions src/controllers/checkout.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const createOrder = async (req: Request, res: Response) => {
}));

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

const order = await Order.create({
orderId: uuidv4(),
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/orderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export const getOrder = async (req: Request, res: Response) => {
}
};



export const getSellerOrder = async (req: Request, res: Response) => {
try {
const vendorId = req.params.vendorId;
Expand Down
6 changes: 0 additions & 6 deletions src/database/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,3 @@ const config = {
};

module.exports = config;
<<<<<<< HEAD



=======
>>>>>>> 0cff03db707fc42c5a1f30a76827dea013e4c413
2 changes: 1 addition & 1 deletion src/database/migrations/20240520142627-create-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
},
client: {
type: Sequelize.STRING,
allowNull: false,
allowNull: true,
},
paymentMethod: {
type: Sequelize.STRING,
Expand Down
1 change: 0 additions & 1 deletion src/database/models/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Order extends Model {
client: { type: DataTypes.STRING, allowNull: false },
paymentMethod: { type: DataTypes.INTEGER, allowNull: false },
status: { type: DataTypes.STRING, allowNull: false },
client: { type: DataTypes.STRING, allowNull: false },
products: { type: DataTypes.JSONB, allowNull: false },
totalAmount: { type: DataTypes.INTEGER, allowNull: false },
expectedDeliveryDate: { type: DataTypes.DATE, allowNull: true },
Expand Down
4 changes: 2 additions & 2 deletions src/database/seeders/20240522075149-seed-orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = {
`);

const [products] = await queryInterface.sequelize.query(`
SELECT "productId", "name", "vendorId"
FROM "Products"
SELECT "productId","name","image","price" FROM "Products"
LIMIT 3;
`);

Expand Down
2 changes: 1 addition & 1 deletion src/pusher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const pusher = new Pusher({
appId: process.env.PUSHER_APP_ID as string,
key: process.env.PUSHER_KEY as string,
secret: process.env.PUSHER_SECRET as string,
cluster: "ap2",
cluster: "mt1",
});

export default pusher

0 comments on commit 1db009c

Please sign in to comment.