Skip to content

Conversation

@Docartes
Copy link

No description provided.

@Docartes
Copy link
Author

Mohon direview @zexoverz, jika ada kurang maupun tidak sesuai akan saya perbaiki. Terimakasih

Comment on lines 6 to 17
const queryOrderItems = catchAsync(async (req, res) => {
const { page, size } = req.query;
const orderItem = await orderItemService.getOrderItems(parseInt(page), parseInt(size));

if (!orderItem) throw new ApiError(httpStatus.NOT_FOUND, 'Order Items not found');

res.status(httpStatus.OK).send({
status: httpStatus.OK,
message: 'Get All Order Item Success',
data: orderItem,
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice pagination, tetep ingat terus ya konsep pagination nya. bakal kepake banget pas kerja jadi BE nanti

Comment on lines 20 to 85
const createOrderItem = async (reqBody) => {
const orderItem = await prisma.orderItem.create({
data: reqBody,
});

const totalPrice = await prisma.order.update({
where: {
id: reqBody.orderId,
},
data: {
totalPrice: reqBody.unitPrice * reqBody.quantity,
},
});

const jumlahBarang = await prisma.product.findUnique({
where: {
id: reqBody.productId,
},
});

const updateQuantiyProudct = await prisma.product.update({
where: {
id: reqBody.productId,
},
data: {
quantityInStock: jumlahBarang.quantityInStock - reqBody.quantity,
},
});

return orderItem;
};

const updateOrderItem = async (orderItemId, updateBody) => {
const orderItem = prisma.orderItem.update({
where: {
id: orderItemId,
},
data: updateBody,
});

const totalPrice = await prisma.order.update({
where: {
id: updateBody.orderId,
},
data: {
totalPrice: updateBody.unitPrice * updateBody.quantity,
},
});

const jumlahBarang = await prisma.product.findUnique({
where: {
id: updateBody.productId,
},
});

const updateQuantiyProudct = await prisma.product.update({
where: {
id: updateBody.productId,
},
data: {
quantityInStock: jumlahBarang.quantityInStock - updateBody.quantity,
},
});

return orderItem;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice OrderItem Logic, Challange Success. ini Core nya IS. ngatur product quantity ketika order.

Comment on lines +22 to +33
const authAdmin = () => async (req, res, next) => {
return new Promise((resolve, reject) => {
passport.authenticate('jwt', { session: false }, verifyCallback(req, resolve, reject))(req, res, next);
})
.then(() => {
if (req.user.role === 'admin') {
return next();
}
throw new ApiError(httpStatus.FORBIDDEN, 'Access Denied');
})
.catch((err) => next(err));
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Authorization, udah tau kan berarti cara bedain Authenticate sama Authorization.
Progress skill backend lu jadi level up kalo udh bisa bedain ini.

Copy link
Contributor

@zexoverz zexoverz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Week4 done ya Husein, gokil banget progress nya. lanjut week 5 ke testing sama deployment. kalau ada problem bisa tanya gua ya di channel DC. gua udh mulai aktif lagi

@zexoverz
Copy link
Contributor

Congrats Husein, selamat atas kelulusannya di phase 1 🔥 🔥 🔥
lu termasuk devil, soalnya bantai 5 week tepat waktu. Progress belajar juga lumayan cepet, keliatan antusias lu buat explore sesuatu. sayang aja final project kurang lancar jadi ngaruh juga di final report lu.

overall nilai lu di phase 1 ada di angka 80%, penilaian ini base on:
-Logic Handling
-Explore
-Question Ask
-Learn Speed
-Task Submit

Review:
untuk handling backend lu udah bagus, explore juga lumayan cepet progressnya.
Task submit aman semua, paling final projectnya aja sih kurang lancar. banyak kesalahan teknis diawal.
next time kalau group project fokus MVP dlu ya, baru additional feature yang lain. soalnya yang gua nilai flow app nya.
oiya sama tingkatin lagi komunikasi nya husein, pas lu presentate masih aga kurang kenceng ngomongnya. mungkin dri sekarang udah mulai nyicil skill public speaking. soalnya phase 2 bakal sering presentasi.
buat nambah wawasan lagi, di banyakin porto backend nya ya Husein. cobain template prisma gua, explore backend" complex kayak e-commerce atau ticketing online. dan jangan lupa logic jangan sampe lepas, kalo bisa setiap minggu ngerjain 3-5 soal logic.

open gate phase 2 nanti di umumin jadwalnya, standby aja.
untuk mengisi liburan , bisa explore backend lagi kalau tertarik mau jadi backend developer :
-Explore Payment Gateway (Stripe)
-Explore Cache (redis)
-Explore Microservice Architecture

@Docartes
Copy link
Author

Docartes commented May 1, 2024

Sir saya kayaknya gak bakal bisa ngikutin phase 2, karena bakalan banyak presentasikan, laptop saya itu kalau buat presentasi ngelag parah karena ramnya cuma ddr3 dan saya belinya seken sir, yang mungkin udah dari 2015-an laptopnya, tahun rilisnya aja 2010-an Masi pake win7 juga(udah dualboot Linux sih). Maaf sir kayaknya gak bisa ngikutin phase 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants