Skip to content

Commit

Permalink
Implemented data wizard routes on backend + minor frontend patches
Browse files Browse the repository at this point in the history
  • Loading branch information
allomanta committed Oct 7, 2024
1 parent 7322f63 commit 7745d32
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 190 deletions.
22 changes: 22 additions & 0 deletions IguideME.Web/Controllers/Apps/TileController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using IguideME.Web.Models;
using IguideME.Web.Models.App;
Expand Down Expand Up @@ -715,6 +716,27 @@ public ActionResult GetExternalAssignments()
return Ok(_databaseManager.GetExternalAssignments(GetCourseID()));
}

[Authorize(Policy = "IsInstructor")]
[HttpPatch]
[Route("/external-assignments/{assignmentID}")]
public ActionResult PatchAssignment([FromBody] AppAssignment assignment)
{
assignment.CourseID = this.GetCourseID();
_databaseManager.UpdateExternalAssignment(assignment);
return Ok();
}

[Authorize(Policy = "IsInstructor")]
[HttpPatch]
[Route("/external-assignments/{assignmentID}/title")]
public ActionResult PatchAssignmentTitle(int assignmentID)
{
int courseID = this.GetCourseID();
var body = new StreamReader(Request.Body).ReadToEnd();
_databaseManager.UpdateExternalAssignmentTitle(assignmentID, courseID, (string)JObject.Parse(body)["title"]);
return Ok();
}

[Authorize(Policy = "IsInstructor")]
[HttpPost]
[Route("/external-assignments")]
Expand Down
8 changes: 6 additions & 2 deletions IguideME.Web/Frontend/src/api/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export async function deleteRequirement(id: number): Promise<void> {
return await apiClient.delete(`learning-goals/requirements/${id}`);
}

export async function patchExternalAssignment({ id, title }: { id: number; title: string }): Promise<void> {
return await apiClient.patch(`external-assignments/${id}`, { title });
export async function patchExternalAssignment(assignment: Assignment): Promise<void> {
return await apiClient.patch(`external-assignments/${assignment.id}`, assignment);
}

export async function patchExternalAssignmentTitle({ id, title }: { id: number; title: string }): Promise<void> {
return await apiClient.patch(`external-assignments/${id}/title`, { title });
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const AssignmentSettingsForm: FC<AssignmentSettingsFormProps> = ({ assignment })
}}
onFinish={() => updateAssignment({ ...assignment, ...form.getFieldsValue() })}
>
<div className='flex w-full max-w-xs flex-wrap items-center justify-center gap-4'>
<div className='flex flex-wrap items-center justify-center gap-4 md:justify-start'>
<Form.Item
label='Max Grade'
name='max_grade'
Expand Down
Loading

0 comments on commit 7745d32

Please sign in to comment.