0:00:01
cool welcome back guys
0:00:03
another day another episode of bill
0:00:07
if you're new here um we are roller
0:00:09
coasters we stream
0:00:10
every night from 9 30 to 10 30 and 2
0:00:15
and you can watch us on twitch and
0:00:18
um so yeah we had a lot of
0:00:25
surprises yesterday when we thought our
0:00:28
code was working our api was working
0:00:30
with dynamodb but turns out it was only
0:00:34
first element but turns out our
0:00:38
really um smart coder zen has figured it
0:00:42
and today we promised that it is working
0:00:45
and today we'll go over
0:00:47
what happened and how you can
0:00:50
avoid it if you are developing an api as
0:00:53
what do we have in store today then
0:00:56
in store at the moment are two beans
0:01:00
that i can i'm trying to get rid of
0:01:03
that are we i don't really want them to
0:01:08
here because it's just obstructing
0:01:13
i think yeah that should work for now
0:01:17
anyway um yeah thanks a lot for the
0:01:20
introduction okay um always
0:01:23
precise sport on and
0:01:30
before i begin to tell the viewers i
0:01:35
today just want to do a quick shout out
0:01:39
streamyard who's the sponsor of this
0:01:42
and basically it's an online streaming
0:01:46
software in which you can um add your
0:01:50
destination to the
0:01:54
famous social media which is huge
0:01:57
or well i wouldn't really call youtubers
0:02:00
social media about
0:02:01
video playing format um so it would be
0:02:06
twitch facebook linkedin as you can
0:02:11
and you can also record the videos and
0:02:14
make it available for your viewers
0:02:16
um off to us if for some reason
0:02:20
they can't they can't catch on live
0:02:25
so now that's the part done all right
0:02:28
so today i'm gonna be taking
0:02:37
how i managed to fix the get a
0:02:41
um and then we're gonna be covering
0:02:45
two functionality which is
0:02:48
deleting a note and updating your note
0:02:53
right okay right fantastic
0:02:56
so i'll just quickly go through um
0:03:00
the code that what i did so
0:03:05
basically i changed the beautiful logic
0:03:21
simply created an object
0:03:25
and then um signed
0:03:29
them the the proper properties of that
0:03:33
particular note and then um
0:03:37
the part that we were missing was i
0:03:41
looping through the array itself as in
0:03:44
the borders called
0:03:52
this part here and i know
0:03:58
you point it okay that um
0:04:02
you want to use the hard coded value and
0:04:05
i think um we should although i
0:04:09
said there's a bad bad practice but i
0:04:11
don't know any other
0:04:13
way we can achieve this logic
0:04:17
as in in a variable
0:04:21
kind of thing yeah i could do
0:04:24
let counter equals zero
0:04:28
and then pull counter here but there
0:04:33
one additional line of code that's true
0:04:40
i was just kind of wondering we can use
0:04:42
the there's one function called find
0:04:45
we can do that as well if you don't want
0:04:50
find um do you know how to use that
0:04:53
i'm just googling it so in find if you
0:04:57
any um what do you call it any index
0:05:01
then it'll just give you the first index
0:05:06
if you really really want to avoid
0:05:08
putting zero there then
0:05:10
we can use something like that i'm just
0:05:20
you mean this one isn't it
0:05:27
find and then yeah check hey
0:05:31
let me make sure if it's if it's a fine
0:05:34
function or maybe it is can you check if
0:05:36
it's the find function
0:05:37
i'll just guess the value of the first
0:05:40
in the array that's uh that has a value
0:05:44
okay you just should be the first
0:05:48
element it says it here
0:05:58
all right so i'll just put this one here
0:06:02
see yours um i'm just
0:06:05
trying to think this is an array
0:06:09
so i would want to do probably board
0:06:25
all right excuse me
0:06:29
if you heard that that was my fault
0:06:48
it's like a hard fix kind of a thing
0:06:51
item dot length minus one
0:06:56
in place of where you wrote zero
0:07:03
if that makes sense this board items
0:07:14
items dot import items or length
0:07:19
minus one yeah do length as well
0:07:22
you didn't do length yeah
0:07:31
uh but this will give us
0:07:34
minus one then and that will result in
0:07:41
invalid index because
0:07:44
the length function gives you the actual
0:07:48
uh not the it's not a function it's a js
0:07:51
yeah uh-huh i know that it gives you
0:07:55
one in our case it gives us one
0:07:59
uh in our case okay
0:08:03
right zero but length functions always
0:08:07
true number of um elements
0:08:14
okay i see what you mean there's a
0:08:18
basically in the items
0:08:21
we're gonna have one item
0:08:25
anyway so we're just saying
0:08:28
one minus one which is yeah zero then
0:08:32
yeah kind of like well just trying to
0:08:43
this on this as well
0:08:51
this is more code now
0:08:56
isn't it making a bit difficult
0:08:59
to read i'm just assigned to a variable
0:09:05
but that's more additional
0:09:09
additional line of code then yeah but
0:09:12
then again you're not calling the length
0:09:14
constant every time
0:09:30
item first index i guess
0:09:41
first index is equal to
0:09:54
no that this is not gonna work
0:09:58
ah my bad i should have done it over
0:10:25
are you busy um i'm kind of googling
0:10:30
okay yeah i'm going on my phone
0:10:33
so that i can see what's happening here
0:10:38
yeah yeah does it work
0:10:42
board items that one and then
0:10:46
we can use this one over here
0:11:08
i don't really want to spend too much
0:11:12
time on this again so
0:11:15
we will see if this works if this
0:11:18
does i'm pretty sure it would ah
0:11:23
forgot to add that as well
0:11:28
okay hang on a minute you should go to
0:12:01
see this line of code then um i paste
0:12:06
oh sure actually i should do it in the
0:12:13
let first direct left first equals a
0:12:35
yeah this should work but let's just
0:12:39
leave it then i guess
0:12:44
or you yeah just change the um
0:12:47
where we wrote item length minus one
0:12:59
so you know how where we have item
0:13:07
item length minus one yeah
0:13:11
just change that to uh item
0:13:27
yes and so what's the boolean then
0:13:41
so you're saying that except
0:13:53
if it finds the item then
0:14:12
just gonna try and decode
0:14:22
i found it on a stack overflow thingy
0:14:26
sending it to you on vs code
0:15:03
how do you get the first element from an
0:15:07
like this okay yeah that's our one so
0:15:13
like this he's using our one
0:15:17
as in hard coding here sorry
0:15:20
i can't see the screen he's hard
0:15:28
which we have already done but
0:15:31
that's that question huh
0:15:35
that's the question if you go down
0:15:40
see that's the answer here
0:15:47
did i send you the wrong link um
0:16:15
comment with 56 upwards
0:16:23
let go down one more
0:16:29
find boolean you can just use
0:16:33
find or if you want the first
0:16:37
element even if it's a full say
0:16:44
okay i see so that
0:16:48
is how we can just use this
0:16:51
yeah you can use find and put true there
0:16:59
let's try i'm gonna just
0:17:05
actually i'll keep this boolean
0:17:12
yeah just leave it like boolean don't
0:17:24
why don't i do this then
0:17:31
why don't i do this instead
0:17:39
find boolean and then go into notes
0:17:44
yeah does your look
0:17:59
we don't want to call a function like a
0:18:11
you want me do it yeah
0:18:14
you check control yeah i do have control
0:18:21
right um which light number are you
0:18:24
uh three two two okay
0:19:06
um so this is giving it a
0:19:11
um yep element in the array
0:19:17
that's fine yeah that looks fine
0:19:26
okay i will run this
0:19:29
i'm just gonna run this locally
0:19:54
oh what am i doing
0:20:00
what am i doing here local
0:20:06
they test okay and then
0:20:17
to run dynamodb yeah
0:20:22
there you go this is gonna run that and
0:20:26
to run then list command
0:20:30
to check if the table is still there
0:20:36
yeah there you go the tables are still
0:20:52
the table is still there i'm gonna
0:20:56
the table name yeah
0:21:04
boom and then what we're gonna do is
0:21:09
put breakpoint actually
0:21:13
let's check if it runs successfully if
0:21:16
it doesn't then upward break point
0:21:22
did i do anything there no i didn't
0:21:26
do you uncommon deport yeah i did
0:21:44
i was looking for that as in
0:21:51
that's high pin all right
0:21:54
um this open postman
0:22:06
there you are regular viewers alexa
0:22:14
it must be busy some midweek now
0:22:17
and i don't believe yeah
0:22:23
but we have to keep forging on yeah
0:22:36
literally our group has just been like
0:22:37
since the past three days this is like
0:22:39
streamlining stream link
0:22:51
um is it possible if you can um um
0:22:54
has your phone gold vibration mode in
0:22:59
yeah just put it on there okay cool
0:23:21
zoom in a bit yeah that looks fine
0:23:34
board right i already
0:23:42
lagging coming into action now
0:23:47
have i already go the boards yep
0:23:51
no i don't ah really all right
0:23:58
i'm misspelled too all right
0:24:06
if i do this board one
0:24:20
oh no no no this is the one
0:24:25
last note let's see what this
0:24:28
gives us you should
0:24:32
give us that if you worked perfectly
0:24:34
fine all right cool
0:24:39
brilliant so we can actually move on
0:24:53
that works finally after three days
0:24:56
so that's pretty good
0:25:01
all right i'm gonna do this okay cool
0:25:04
so now that that's working
0:25:08
um we're gonna move on to
0:25:16
you pick which one first this is delete
0:25:20
call let's go to delete i've already got
0:25:23
the code pretty much
0:25:25
but let's see if the code even works
0:25:28
in the first place
0:25:31
okay here we go this is the code here
0:25:38
okay cool so i need
0:25:41
this one to be uncommented
0:25:46
and then i need this one to be
0:25:55
uh no no no not really
0:26:03
yeah yeah that has to be uncle that's
0:26:06
commented and then i need to uncommand
0:26:13
and if it works i'll go
0:26:16
for the code afterwards all right
0:26:22
update this up there with delete
0:26:33
okay that one's there don't
0:26:36
try catches there why is that gearing
0:27:01
right that's not gonna work
0:27:06
really why because hey i'm getting all
0:27:10
the balls but i'm not
0:27:12
flipping through the boards at the
0:27:13
moment so i'll probably have to
0:27:16
i think that's the same um code which we
0:27:26
yeah yeah so i can do what i can do
0:27:30
actually create no gengar no
0:27:36
guess specific note
0:27:48
okay so we can probably
0:27:51
um get rid of the scan
0:27:55
because it will consume a lot of
0:28:02
because now that we know that
0:28:05
this is working it will be a lot easier
0:28:11
this one has to come there
0:28:34
update delete okay
0:28:37
cool this goes here
0:28:42
we don't have this scan everything now
0:28:50
and then we can specifically say
0:29:14
and then this can be
0:29:22
and in this way yeah
0:29:31
if okay so this is where it all
0:29:34
comes down to we don't need this
0:29:40
so what you do till now you got the
0:29:43
we're inside and we we're in the board
0:29:47
right so if the current
0:29:51
notes id it matches the id that will be
0:29:55
passed in then all we are doing
0:30:01
is removing that note
0:30:10
lies the surprise is that
0:30:14
yeah this place start
0:30:18
which would be this one
0:30:27
yeah and then all we returning
0:30:30
back i don't really care what we
0:30:33
return back as long as we can return
0:30:38
so do you want to check if it's deleted
0:30:43
yes that's what i'm gonna do now
0:30:54
uh let's just return items first index
0:30:59
not the board and see what we get
0:31:03
good idea all right
0:31:08
i don't know for some reason i've got a
0:31:10
vague idea that it won't work
0:31:17
this is the code um which is used to
0:31:21
um i guess item from a table or
0:31:27
um item from the array
0:31:30
okay all right delete note
0:31:37
actually you know what
0:31:48
let's try this and if that doesn't work
0:32:11
don't worry don't worry don't worry
0:32:39
okay cool let's see if
0:32:42
this does the trick although
0:33:02
okay we'll get this
0:33:24
dc that's the second one or the third
0:33:44
seafood apparently it's done here
0:33:48
yeah that is pretty apparent
0:33:52
i mean i kind of want to do it want to
0:33:55
as well exactly my point so i'm
0:33:59
gonna actually post as in
0:34:02
deployed this code to sam and
0:34:06
try there as well yeah yeah
0:34:09
i mean that works it's kind of
0:34:13
deleting it from the array but not sure
0:34:15
if it's doing it on the table
0:34:18
so we can we can check that
0:34:31
okay and check all the ports
0:34:35
uh uh why did i get rid of that
0:34:42
it's on your victory not to worry
0:34:46
yeah let's go there and get
0:35:12
scrum the same api oh also again happy
0:35:16
it right was it today um
0:35:25
yesterday yeah but it lasts for
0:35:30
four days three or four days yeah
0:35:33
did you guys make that um that
0:35:36
milk sweet like dessert kind of a thing
0:35:41
um i want to bomb really bad
0:35:45
all right yeah yeah it's nice
0:35:48
i think it's called a care yes yes
0:35:51
something like that nice yeah i
0:35:55
wanted to bob didn't want to put in the
0:35:59
because fair enough
0:36:03
it does take long yeah
0:36:14
but you don't have config here and you
0:36:16
have it in your code
0:36:17
oh that's that's for that yeah
0:36:21
that's for just local testing oh yeah
0:36:25
type in this one comment
0:36:44
and i'll type in here as well on
0:36:58
oh and the poi is there
0:37:02
yeah i can't comment this one as well
0:37:07
let's try this and see what happens
0:37:13
have i already built it or yesterday yes
0:37:18
i need to delete that
0:37:34
should look really bored
0:37:41
damn it's already like sorry
0:37:46
how about i'm thinking cause i don't
0:37:50
want to bore you um by just
0:37:54
asking you to watch how about if we
0:37:57
go say from now on half and half
0:38:00
as in i code for half
0:38:18
i think there was a abs programming
0:38:21
tools meet up as well today was it
0:38:24
yeah i got um the text from
0:38:27
uh paul but um i couldn't
0:38:32
attend that because it actually clashed
0:38:36
with some other thing that i already had
0:38:48
i think i just saw it it was a canberra
0:38:52
user group it was in the
0:38:55
yeah it was see what's going on on aws
0:39:22
no there is no upcoming events no mind
0:39:47
i'm thinking to get on my solutions
0:39:52
okay yeah shouldn't
0:39:56
take you too long as in
0:39:59
you already have done the hardest one
0:40:08
yeah um i think like
0:40:12
the initial part of the semester is not
0:40:15
stressful so i just like get it out of
0:40:24
good girl to kick as in
0:40:27
before the year ends
0:40:31
and maybe like i could stream on my i
0:40:35
a youtube channel on stream on that
0:40:38
i'm studying or something like that so
0:40:42
yeah i've done the essay sir i'm
0:40:45
thinking that i might
0:40:46
go into the dev one
0:40:50
do you have any recommendations did you
0:40:51
write a blog or something like that on
0:40:54
on the solutions architects one yeah
0:40:58
i don't think i did no do you have any
0:41:01
um comments on that
0:41:04
i will share basically just
0:41:08
build build build okay
0:41:12
as in build with the
0:41:15
services that they
0:41:18
tell you they are in included and that
0:41:23
you're going to be tested in the sir
0:41:27
because there are some questions
0:41:31
as in more than alfred that just that
0:41:34
you only know the answer to um
0:41:38
based on your experience with
0:41:42
working with it and um
0:41:45
from my experience the only thing i
0:41:49
tell you is that the it's
0:41:52
really important you understand the
0:41:56
of what they're asking in the
0:41:59
question because they they try to
0:42:02
throw you off with a few
0:42:06
details that are not needed but they are
0:42:10
okay i got what you mean yeah
0:42:13
so that would be my only suggestion for
0:42:24
let you know if i need any help
0:42:28
yeah do that i mean
0:42:31
i'll be more than happy to help you in
0:42:35
any way i can yeah let me know as well
0:42:38
if i could be of any help
0:42:52
okay that one's there
0:42:56
i'll be really surprised if it works
0:43:02
yeah me too hopefully to be honest i
0:43:06
it might work because we've already
0:43:10
dynamodb locally and it works yeah
0:43:20
i'd be disappointed if it works and if
0:43:22
it doesn't work because
0:43:23
like in both cases i'm gonna be
0:43:32
if it works it doesn't like i don't
0:43:35
wanna like kind of do that i know db
0:43:38
and if it doesn't work it'll be like
0:43:40
well we can't even do that
0:43:42
ah okay right i'll go to me now
0:43:45
also if it doesn't work like it will be
0:43:47
kind of inconsistent that it's working
0:43:49
on local and not working on
0:43:55
through that actually have i got a hair
0:43:58
i already have a hair yes copy that why
0:44:03
use this yeah but we have to
0:44:06
call it as well so yeah
0:44:09
so do get everything
0:44:25
there we go and let me take the second
0:44:30
right ah no it's the board id
0:44:36
it really confuses me to be honest yeah
0:44:40
the window is small so like i'm never
0:44:47
uh actually let's take the
0:44:50
third one this time
0:44:54
all right have a guess who will it work
0:45:00
i don't know really do 863 a63 boom
0:45:05
let's see apparently it works
0:45:15
why are you not happy it works
0:45:18
i'll be disappointed as well you know
0:45:26
working based on my understanding we are
0:45:29
dealing with the array only
0:45:32
that's true for like it's not the
0:45:36
way of removing um objects
0:45:45
um it might not be from the table but
0:45:48
you've got to remember that we're
0:45:50
dealing with the array now
0:45:52
yeah that's deleting it
0:45:55
from the array yeah
0:46:00
but i feel like um we might have to
0:46:02
revisit this code a bit
0:46:04
just to make it look a bit like
0:46:07
yeah um we can do it afterwards
0:46:11
all right said deleting is
0:46:20
right now we need to update the note so
0:46:24
i think this is a little bit quicker
0:46:27
yeah you want to do this one
0:46:31
cool i'll give you you have the control
0:46:44
let's see which line number is it
0:46:50
it it is it starts from 245
0:47:00
okay it outlook patch that's fine now
0:47:03
we get the board id and
0:47:10
radio um text for note
0:47:14
we got from the body that's right let go
0:47:17
and that note um okay
0:47:24
right so this score isn't
0:47:27
really worth anything
0:47:39
i'll uncomment this all first and then
0:47:46
uh we probably want to do
0:47:50
query then as scan
0:47:56
okay uh have you done this somewhere
0:48:00
okay yes in the previous
0:48:03
one which was deleting i know it should
0:48:07
at the top ah here we go that's fine
0:48:10
yeah so for bowdoin board items
0:48:14
we want to name it um
0:48:19
titles.fine boolean
0:48:27
oh no nevermind that's bored that's
0:48:30
bored we need the ball so
0:48:32
we don't want to move through the
0:48:35
items we already have the board so
0:48:38
yeah i think you can apply the same
0:48:47
deleting the board um not deleting the
0:48:52
finding the the note and then just
0:48:58
topic property of the note and the time
0:49:02
query the note as well
0:49:06
query we don't really um
0:49:09
query the notes we can't do that
0:49:13
we don't have to do we don't have to
0:49:16
the node we just have to as in
0:49:20
check if then now is that one
0:49:23
then just update the topic property of
0:49:52
um you probably want to change the
0:49:56
because it's a single board okay
0:50:00
that's true thanks for that
0:50:20
right so you mean to say that
0:50:24
um the topic property will update right
0:50:29
which is text for note
0:50:33
yes so how do we update that like here
0:50:38
no no no no so i don't think
0:50:42
we need this update notes code
0:50:51
should i comment it or should i delete
0:50:54
um comment first please
0:50:58
um the square one more
0:51:05
actually add add the curly braces but
0:51:08
comment it out i don't want to
0:51:11
confuse myself yeah
0:51:15
okay so now basically what we're
0:51:23
so if the note id is
0:51:33
probably creates um
0:51:37
create a new node board
0:51:41
board notes and then and then note
0:51:44
and then dot topic equals
0:52:05
the reason vs could give me suggestions
0:52:16
is it topic only and we probably want to
0:52:24
shall we update that they created as
0:52:28
days and time or no no
0:52:34
the date created is the first stamp of
0:52:38
initially created yeah yeah so
0:52:41
we don't have to do that we can just do
0:52:44
going forward i think they would be a
0:52:46
good idea to add an
0:52:48
additional property when we update
0:52:55
this date and time
0:52:59
okay cool so this is
0:53:02
done if you if you can go down
0:53:06
i'm done oh oh yeah thank you
0:53:11
all right so this is if is here
0:53:19
update yeah we don't need that we just
0:53:22
need we don't need
0:53:26
update either as in the doc client
0:53:29
we're not using the doc
0:53:34
doc client here so all we need to do is
0:53:37
send the response back
0:53:41
it's icons or item again items
0:53:54
let's try this there's one extra curly
0:54:00
hmm it's fine this is fine
0:54:07
can i put it outside the for loop yeah
0:54:14
i don't know what this is for then
0:54:18
yeah that's an extra
0:54:33
yeah that looks fine just one second
0:54:38
loop is ending there yeah
0:54:41
cool let's um are we going to do it
0:54:46
are we going to deploy let's look
0:54:49
clay is a lot a lot quicker
0:54:58
all right what i'll do is i'll
0:55:03
take the name of the table and i'll
0:55:07
yeah that'll be helpful
0:55:13
let's try and finish this and
0:55:16
see if it works or not in four minutes
0:55:26
um i did this that's all i need to do
0:55:37
and this line as well
0:55:52
um i'll just deploy it as in
0:55:57
locally because i'm not gonna deploy it
0:56:00
on the aws at the moment until
0:56:04
i know it's working
0:56:09
so this was updating i know isn't it
0:56:15
hang on did we do that
0:56:18
do you set the property text for
0:56:21
note here yeah yes here cool perfect
0:56:27
all right so let's
0:56:33
which notes don't want all the notes
0:56:36
just want this one and check
0:56:42
can you make this screen a bit bigger
0:56:44
like this not this
0:56:46
not the screen but like the lower
0:56:49
portion of the body
0:56:53
um then you won't be able to see it
0:56:56
properly yeah it's fine
0:57:05
how about now that's perfect
0:57:10
okay board border ids that already got
0:57:16
so let's say this one
0:57:23
one new forward slash
0:57:26
and yeah and we want to update this one
0:57:47
that's fine that's all
0:58:03
yeah my fault that's fine
0:58:14
we got an error in vs code so you might
0:58:16
want to restart it
0:58:27
no it's the time when you did get that's
0:58:34
that would make sense
0:58:44
okay the moment of truth
0:58:54
never mind i think it was because of the
0:58:57
we have to use that your
0:59:00
favorite method now which is
0:59:09
cool all right do you want to do
0:59:13
yeah i'm gonna do it tomorrow
0:59:18
no this is my function
0:59:21
yeah yeah that's your function
0:59:24
you can have it tomorrow all right guys
0:59:28
thanks a lot for um joining in this is
0:59:31
we have made some good progress we have
0:59:39
yeah it was a bit of an unusual way
0:59:42
i wasn't thinking it would work but
0:59:48
okay was a bit disappointed because he
0:59:57
logic so the best part is about to come
1:00:02
tomorrow when kay gets to
1:00:05
fulfill his desire so
1:00:09
make sure you tune in tomorrow as well
1:00:13
same time and um thanks for
1:00:16
joining kay and to all the viewers
1:00:19
yeah for sure cool um thanks guys for
1:00:23
um and thanks in for having me again um
1:00:26
i'll see you guys tomorrow and