mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 12:17:35 +00:00
Edit button locate, delete, group header
This commit is contained in:
@@ -145,6 +145,23 @@ export class StudentService {
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Deletes a goal and all its child entities (benchmarks, progress
|
||||
// events, event-benchmark links).
|
||||
// *****************************************************************
|
||||
async deleteGoal(studentId: string, goalId: string): Promise<ApiResult> {
|
||||
try {
|
||||
const result = await firstValueFrom(
|
||||
this.http.delete<ResponseResult<void>>(`${this.base}/api/Student/${studentId}/goals/${goalId}`)
|
||||
);
|
||||
return result.success
|
||||
? ApiResult.empty()
|
||||
: ApiResult.fail(result.message);
|
||||
} catch (error) {
|
||||
return ApiResult.fail(describeHttpError(error as HttpErrorResponse));
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Creates a new progress event, optionally with benchmark
|
||||
// associations. Returns the new progress event ID on success.
|
||||
@@ -178,6 +195,22 @@ export class StudentService {
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Deletes a progress event and its benchmark associations.
|
||||
// *****************************************************************
|
||||
async deleteProgressEvent(studentId: string, progressEventId: string): Promise<ApiResult> {
|
||||
try {
|
||||
const result = await firstValueFrom(
|
||||
this.http.delete<ResponseResult<void>>(`${this.base}/api/Student/${studentId}/progress-events/${progressEventId}`)
|
||||
);
|
||||
return result.success
|
||||
? ApiResult.empty()
|
||||
: ApiResult.fail(result.message);
|
||||
} catch (error) {
|
||||
return ApiResult.fail(describeHttpError(error as HttpErrorResponse));
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Returns a full progress report for a student within a date
|
||||
// range, including goals, events, and benchmark associations.
|
||||
@@ -221,6 +254,22 @@ export class StudentService {
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Deletes a student and all associated data.
|
||||
// *****************************************************************
|
||||
async deleteStudent(studentId: string): Promise<ApiResult> {
|
||||
try {
|
||||
const result = await firstValueFrom(
|
||||
this.http.delete<ResponseResult<void>>(`${this.base}/api/Student/${studentId}`)
|
||||
);
|
||||
return result.success
|
||||
? ApiResult.empty()
|
||||
: ApiResult.fail(result.message);
|
||||
} catch (error) {
|
||||
return ApiResult.fail(describeHttpError(error as HttpErrorResponse));
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Returns benchmarks for a given student.
|
||||
// *****************************************************************
|
||||
@@ -269,6 +318,22 @@ export class StudentService {
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Deletes a benchmark and its progress-event associations.
|
||||
// *****************************************************************
|
||||
async deleteBenchmark(studentId: string, benchmarkId: string): Promise<ApiResult> {
|
||||
try {
|
||||
const result = await firstValueFrom(
|
||||
this.http.delete<ResponseResult<void>>(`${this.base}/api/Student/${studentId}/benchmarks/${benchmarkId}`)
|
||||
);
|
||||
return result.success
|
||||
? ApiResult.empty()
|
||||
: ApiResult.fail(result.message);
|
||||
} catch (error) {
|
||||
return ApiResult.fail(describeHttpError(error as HttpErrorResponse));
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************
|
||||
// Requests an AI-generated benchmark recommendation for a goal.
|
||||
// *****************************************************************
|
||||
|
||||
Reference in New Issue
Block a user