Skip to content

Conversation

@ptrjs
Copy link

@ptrjs ptrjs commented Dec 7, 2023

No description provided.

@ptrjs
Copy link
Author

ptrjs commented Jan 5, 2024

@zexoverz sir minta reviewnya sir

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.

Gokill sir, pengurangan quantity ini logic challange nya. lu udah notice aja udah keitung level up skill backend lu


const getCategorys = catchAsync(async (req, res) => {
const result = await categoryService.queryCategorys();
const {skip,take} = req.query
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, pertahankan kek gini. logic pagination bakal sama aja kek gini terus. sampe lu kerja nanti konsep nya bakal kepake banget

Comment on lines 23 to 41
const adminAuth = () => 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'){
next();
}else{
throw new ApiError(httpStatus.FORBIDDEN, 'You Are Not Admin');
}
})
.catch((err) => next(err));
};

module.exports = {
auth,
adminAuth,
};
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, udh tau kan berarti bedanya authenticate sama authorization.
fungsi nya Authorization ini limitasi akses role untuk fitur fitur backendnya

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.

Overall udah OK Trx week4 nya. challange juga udah kelar semua. bisa di lanjutin ke week5 ke Testing dan deployment. kalo ada problem bisa chat gua aja di DC. gua udh mulai aktif lagi

@ptrjs
Copy link
Author

ptrjs commented Feb 2, 2024

@zexoverz sir minta review unit testingnya sir.
Di "user.test.js" di POST hasil expected dan received hashing passwordnya selalu beda dengan yang sudah ditentukan. Akhirnya ane komen aja kodingan expected(userData)-nya.

Comment on lines 21 to 50
describe('User routes', ()=>{
/*
describe('GET /v1/user', ()=>{
beforeEach(async ()=>{
await insertUsers([admin]);
await insertUsers([userOne]);
})
test('should return 200 and successfully get all users if user role is admin', async ()=>{
const res = await request(app)
.get('/v1/user')
.set('Authorization', `Bearer ${adminAccessToken}`)
.expect(httpStatus.OK);
});
test('should return 401 unauthorized if token not set', async () => {
const res = await request(app)
.get('/v1/user')
.expect(httpStatus.UNAUTHORIZED);
});
test('should return 403 forbidden if user role not admin', async ()=>{
const res = await request(app)
.get('/v1/user')
.set('Authorization', `Bearer ${userOneAccessToken}`)
.expect(httpStatus.FORBIDDEN);
});
})
*/
describe('POST /v1/user', ()=>{
Copy link
Contributor

Choose a reason for hiding this comment

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

coba di cocokin reponse dari user controller lu trx, soalnya response OBJ IS dari gua keknya beda sama punya lu.

ini uncomment trus cocokin sama response di user controller lu

@zexoverz
Copy link
Contributor

zexoverz commented Feb 7, 2024

Swaggernya kalo bisa di tambahin untuk API yang lain

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.

Nice EJS, tinggal testing nya aja trx di rapihin. kalo masih struggle kita bisa live class aja langsung di DC

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.

Nice Swagger sir , semoga kepake ilmunya pas kerja di BE.
Swagger salah satu tools documentation paling umum di dunia kerja

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.

week5 nya udah oke, tinggal di deploy aja sir IS nya. dan lu juga udah bole ikut group project. gua include di waiting list grou project phase 1.

btw EJS nya keren, explore nya kejauhan pak wkwkw sampe buat frontendnya IS gokill

@zexoverz
Copy link
Contributor

Congrats Trx (peter), selamat atas kelulusannya di phase 1 🔥 🔥 🔥
Gua suka Progress belajar lu yang konsisten, keliatan antusias lu buat explore sesuatu. Walaupun rada lama kelarin phase 1 tpi lu tetep ngumpulin tugas dan minta review , padahal gua tau lu masih sibuk yang lain.

Nilai lu disini kebantu banget sama perfom group project, itu final project lu gila banget wkwk. Reservation App termasuk top project di GP phase 1.

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

Review:
untuk handling backend lu udah bagus, paling lu harus sering" buat unit testing sih haha. gua liat lu rada struggle disitu.
Task submit aman semua, final project terlalu perfect menurut gua. Paling dari lu kurangnya di manage waktu aja sih Trx, next phase 2 kalo bisa ngumpulin tugasnya tepat waktu aja . takutnya kalo jeda kelamaan jadi lupa lupa nanti materi yang lu pelajarin, trus nanti harus adaptasi lagi.

untuk open gate phase 2 nanti di umumin jadwalnya, standby aja.

bisa explore backend lagi kalau tertarik mau jadi backend developer :
-Explore Payment Gateway (Stripe)
-Explore Cache (redis)
-Explore Microservice Architecture

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