I, as a learner and student, whose goals shift, timelines shift etc. should be able to edit any schedules I create.
Acceptance Criteria
NOTE: This does not include adding and removing classes from schedules, this will be covered in a separate ticket.
Endpoint URL: \schedule{id}
WHEN a user selects on an affordance on the front end, they should be directed to the same form mentioned in #8 , where they can edit pre-existing details of an already existing schedule which will be selected by its ID.
Dependencies
All test data must be created in order for this API call to be fully tested.
Dev Notes
EDITING A POST EXAMPLE, backendnetflixrare
app.MapPatch("/api/posts/{postId}", (RareDbContext db, int postId, Post editedPost) =>
{
var postToEdit = db.Posts.FirstOrDefault(p => p.Id == postId);
if (postToEdit == null)
{
return Results.NotFound();
}
if (editedPost.Category_Id != null)
{
postToEdit.Category_Id = editedPost.Category_Id;
}
if (editedPost.Title != null)
{
postToEdit.Title = editedPost.Title;
}
if (editedPost.Publication_Date != null)
{
postToEdit.Publication_Date = editedPost.Publication_Date;
}
if (editedPost.Image_Url != null)
{
postToEdit.Image_Url = editedPost.Image_Url;
}
if (editedPost.Content != null)
{
postToEdit.Content = editedPost.Content;
}
if (editedPost.Approved != null)
{
postToEdit.Approved = editedPost.Approved;
}
db.SaveChanges();
return Results.Ok(postToEdit);
});
User Story
I, as a learner and student, whose goals shift, timelines shift etc. should be able to edit any schedules I create.
Acceptance Criteria
NOTE: This does not include adding and removing classes from schedules, this will be covered in a separate ticket.
Dependencies
Dev Notes
EDITING A POST EXAMPLE, backendnetflixrare