lots of work done

This commit is contained in:
2026-03-02 16:23:29 -08:00
parent be4873283d
commit ef09a76bb4
25 changed files with 644 additions and 157 deletions
@@ -0,0 +1,8 @@
namespace WinStudentGoalTracker.DataAccess;
public class AddProgressEventDto
{
public Guid GoalId { get; set; }
public string? Content { get; set; }
public bool IsSensitive { get; set; }
}
@@ -0,0 +1,12 @@
namespace WinStudentGoalTracker.DataAccess;
public class dbStudentGoalRow
{
public string? StudentIdentifier { get; set; }
public required Guid GoalId { get; set; }
public Guid? GoalParentId { get; set; }
public string? Title { get; set; }
public string? Description { get; set; }
public string? Category { get; set; }
public int ProgressEventCount { get; set; }
}
@@ -83,4 +83,48 @@ public class StudentRepository
commandType: CommandType.StoredProcedure);
return rowsAffected > 0;
}
public async Task<bool> AddProgressEventAsync(Guid userId, AddProgressEventDto dto)
{
using var db = Connection;
var rowsAffected = await db.ExecuteAsync(
"sp_ProgressEvent_Insert",
new
{
p_id_progress_event = Guid.NewGuid().ToString(),
p_id_goal = dto.GoalId.ToString(),
p_id_user_created = userId.ToString(),
p_content = dto.Content,
p_is_sensitive = dto.IsSensitive ? 1 : 0
},
commandType: CommandType.StoredProcedure);
return rowsAffected > 0;
}
public async Task<StudentGoalSummary?> GetGoalSummaryAsync(Guid idStudent)
{
using var db = Connection;
var rows = await db.QueryAsync<dbStudentGoalRow>(
"sp_Goal_GetByStudentId",
new { p_id_student = idStudent.ToString() },
commandType: CommandType.StoredProcedure);
var list = rows.ToList();
if (list.Count == 0) return null;
return new StudentGoalSummary
{
StudentIdentifier = list[0].StudentIdentifier,
Goals = list.Select(r => new StudentGoalItem
{
GoalId = r.GoalId,
GoalParentId = r.GoalParentId,
Title = r.Title,
Description = r.Description,
Category = r.Category,
ProgressEventCount = r.ProgressEventCount
}).ToList()
};
}
}