So, I had to remove quite a bit of code because of that lack of knowledge about my code base
and that's why I will now switch to this other chat here where I can add the workspace
reference so that it hopefully will analyze my entire code.
And I'll say edit the, and then I'll point at a file, the events.js routes file here,
edit the file to reach out to the database I want to say but actually for that I'll create
a controller file, event or events controller.js and I'll add a models file here, event.js.
So more manual coding here now with GitHub Copilot and I'll start in the models file
now that I think about it.
And here I now want to add some code to reach out to a database to store event data, find
an event by ID, update an event or delete an event.
So again we can actually use the inline code here or what I'll do, use the chat and edit
the event.js file in the models folder to contain and export functions that will create
a new event with title, description, address and date, I'll take care of the image later,
edit an event, delete an event or get all or a single event by ID.
So that's the features I want to add to this event.js file.
With that let's see what we get, takes a look at my workspace, hopefully understands how
the code looks in the other files, hopefully understands which kind of database I'm using
but it's not.
It's again creating this events array here which is not helpful.
So I'll explicitly tell it I'm using a SQLite database, update the and now I want to update
the database.js file to also contain a fitting events table.
Use this database from this file and then I'll point at this event.js file in the models
folder again to perform the tasks mentioned before.
So now it's trying to tweak the database.js file by also creating an events table in there
and it then tries to tweak the event.js file in the models folder to use that database
to insert events, edit events and so on.
So that looks a bit better.
So I'll actually apply these changes to the database.js file.
Here we go, no that's the wrong file, don't save.
Database.js, apply, okay that looks better and it only changes this part where it adds
the events database which makes sense which is what it should do and it adds an ID, title,
description, address, date, that looks good, we'll add the image later so that works and
then it should update the events.js file in the model folder, the event.js file, sorry,
it should update this so let's apply that here, yeah, did not do that so I'll insert
that cursor instead since the file was empty anyways.
With that this code is added here.