All language subtitles for 019 Finishing the Bookings API_Downloadly.ir_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

And now to finish the section, let's now very quickly

finish the bookings API.

And once more, I actually want you to practice your skills

at this point,

and so basically implement all the missing endpoints

completely on your own here.

So, really adding adding all the CRUD operations.

So, creating, getting, reading and updating bookings.

So pause the video now and I see you in a second.

Okay, so let me start here by using the factory

that we already have in order to create

all these five handlers.

So, create booking is done using

factory.createOne

and passing in the booking.

And now, let me duplicate this five times.

So, get booking,

getAllBookings,

updateBooking,

and

deleteBooking.

And now here the same.

Get all, or actually get one.

Then here it's getAll.

Here it's updateOne.

And deleteOne.

So, very easy.

Now, moving on to the routes.

So router.route,

and so without the booking's id, we have as always

getting all and creating a new one,

right.

Now, all of these will actually be protected

and also only restricted to administrators and lead guides.

And so actually let me do that outside here of this handler.

And so here, all we will have

is really bookingController.getAllBookings.

And so just like before, I will actually use

the protect middleware completely outside.

So router.use(authController.protect).

Then I can remove it from here,

and then the next routes and all of them

will only be accessible to administrator and lead guides.

Now right,

so for a lead guide to basically know which tourists

have been booked, and for an admin, well,

to kind of update or delete tourists if necessary.

All right.

So that's authController.restrictTo

admin

and lead guide.

So .get

and .post

as well,

and that one is then createBooking.

Now right.

And now the routes with the id.

So, as always, in all our other resources,

we did exactly the same.

So that's bookingController.getBooking,

then we have patch, which is for updating,

so updateBooking.

And finally, we have .delete

for bookingController.deleteBooking.

So, very easy that's our bookings API.

And so just to test, let's actually just add

the getAllBookings and getBooking to Postman.

All right, so I'm not really interested

in adding all these endpoints here.

That takes a bit too much time.

All right.

So let me just try with this one.

So that's bookings,

and so that should actually already be enough.

Or no, we need the authorization as well.

And so let's quickly login as an admin.

So that's I believe

admin@natours.io.

Yep, that's correct.

And so, let's see.

And here we actually have our booking.

And right now it's only one,

but that works.

And you see that actually the tour gets populated here

which in turn gets populated with the guides,

but as we said earlier that's not a big deal in this case,

because the square here is not going to be done

so many times.

Now right, also the user is populated,

and then of course the prize.

Now right, let's quickly save this here

and actually not into a new collection,

but here I want to create a new folder for bookings.

So get all

bookings.

Let's just copy it here.

Now, and of course we need to login here as well.

And so that is get one booking.

Right into,

huh where is that?

I thought I had just created a new folder.

But apparently not.

Okay, so this one is out here.

All right, now again I will not create

these other endpoints here in Postman

because that's not really the point.

You already know how to do that.

Anyway, with this, our API is now actually really finished,

and so all I have now for you is a couple of,

let's say, final considerations and challenges

that you should complete in order to take this project,

and also your skills, even further.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.