-
Notifications
You must be signed in to change notification settings - Fork 16
Trx #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Trx #8
Conversation
…l product, update totalprice pada tabel order
|
@zexoverz sir minta reviewnya sir |
zexoverz
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
| 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, | ||
| }; |
There was a problem hiding this comment.
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
zexoverz
left a comment
There was a problem hiding this 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
|
@zexoverz sir minta review unit testingnya sir. |
| 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', ()=>{ |
There was a problem hiding this comment.
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
|
Swaggernya kalo bisa di tambahin untuk API yang lain |
zexoverz
left a comment
There was a problem hiding this 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
zexoverz
left a comment
There was a problem hiding this 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
There was a problem hiding this 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
|
Congrats Trx (peter), selamat atas kelulusannya di phase 1 🔥 🔥 🔥 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: Review: untuk open gate phase 2 nanti di umumin jadwalnya, standby aja. bisa explore backend lagi kalau tertarik mau jadi backend developer : |
No description provided.