I, as a self-learner, who may not be associated with an educational institution, should be able to create classes that are custom to the skills and topics I am learning and not rigidly defined by a degree.
Acceptance Criteria
Endpoint URL: '/class'
WHEN I, as an authenticated user, select a button/affordance on the frontend, I am directed to a form component which will also serve as the same form component utilized to edit classes. When I fill out this form utilizing the information asked of me, upon submission a POST request is sent to the backend which posts the provided information within the CLASS table on the entity page.
Dependencies
All setup issue tickets must be created before work on this ticket can be done.
Dev Notes
POST, creating a post
app.MapPost("/api/posts/new", (RareDbContext db, Post userPost) =>
{
Post newPost = new Post();
newPost.Title = userPost.Title;
newPost.Content = userPost.Content;
newPost.Approved = userPost.Approved;
newPost.User_Id = userPost.User_Id;
newPost.Category_Id = userPost.Category_Id;
newPost.Publication_Date = userPost.Publication_Date;
newPost.Image_Url = userPost.Image_Url;
newPost.Tags = new List<Tag>();
foreach (var tag in userPost.Tags)
{
Tag selectedTag = db.Tags.SingleOrDefault(t => t.Id == tag.Id);
newPost.Tags.Add(selectedTag);
}
db.Posts.Add(newPost);
db.SaveChanges();
return Results.Created($"/api/posts/{newPost.Id}", newPost);
});
User Story
I, as a self-learner, who may not be associated with an educational institution, should be able to create classes that are custom to the skills and topics I am learning and not rigidly defined by a degree.
Acceptance Criteria
Dependencies
Dev Notes
POST, creating a post