Closed AbeEveland closed 4 years ago
My Migration files are not in a folder, they are right above my program.cs on the main page of my repository.
Your homework 04 - 04 - The Rise of the Tamagotchi was marked: Needs Improvement
“Just a little further!”
You need to remove the migrations in the main folder of the project. They don't belong there.
This method here: https://github.com/AbeEveland/Tamagotchi/blob/master/Controllers/PetController.cs#L73
needs to be: HttpPost(["/pets/{id}/scoldings"])
according to the requirements.
This method here: https://github.com/AbeEveland/Tamagotchi/blob/master/Controllers/PetController.cs#L86 needs an HTTP type
This method here also needs a different type: https://github.com/AbeEveland/Tamagotchi/blob/master/Controllers/PetController.cs#L55
I cannot accept this assignment even though it is very close.
I would like you to schedule an hour with either myself or Jordan to clean up this assignment. I think we can quickly get this in shape.
To start your journey you will be creating an API that allows a user to create and care for a virtual pet, reminiscent of a Tamagotchi. The basic functionality will walk you through the four basic parts of a web API, create, read, update and delete.
Objectives
Explorer Mode
Create and new
sdg-api
that has the following featuresCreate a database with one table named
Pets
.Pet
with the following columns:Your API should have the following endpoints
GET /pets
, should return all pets in your database.GET /pets/{id}
, should return the pet with the corresponding id.POST /pets
, should create a new pet. The body of the request should contain a JSON object with a key of "name" and a value of the pet's name. The petsBirthday
should default to the current datetime,HungerLevel
defaults to 0 andHappinessLevel
defaults to 0.POST /pets/{id}/playtimes
, should find the pet by id and add 5 to its happiness level and 3 to its hungry level.POST /pets/{id}/feedings
, should find the pet by id and subtract 5 from its hungry level and 3 from its happiness level.POST /pets/{id}/scoldings
, should find the pet by id and subtract 5 from its happiness level.DELETE /pets/{id}
, should delete a pet from the database by IdAdventure Mode
Add the following features to your API
LastInteractedWithDate
(DateTime). Every time a pet us updated in the database, set theLastInteractedWithDate
to the current time. Add a property namedIsDead
to yourPets
that has logic such that if theLastInteractedWithDate
is over 3 days old, the property returnstrue
otherwisefalse
.GET /pets
that only returns Pets that are alive.Epic mode
Create a console app that interacts with your API that:
Resources