organized types into one place

This commit is contained in:
2026-03-02 14:08:01 -08:00
parent 15b82360bf
commit 328a44043f
15 changed files with 67 additions and 40 deletions
@@ -10,7 +10,7 @@ import {
SelectProgramRequest,
SelectProgramResponse,
TokenRefreshResponse,
} from '../models/auth.models';
} from '../classes/auth.models';
@Injectable({
providedIn: 'root',
@@ -8,7 +8,7 @@ import {
SelectProgramResponse,
TokenRefreshResponse,
UserProgramSummary,
} from '../models/auth.models';
} from '../classes/auth.models';
import { Api } from './api';
const STORAGE_KEYS = {
@@ -1,17 +1,12 @@
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { ApiResult } from '../classes/api-result';
import { MobileHomeMeta } from '../classes/mobile-home-meta';
// *****************************************************************
// TODO: This dummy service should be replaced by MobileHomeMeta,
// which will fetch real data from the API.
// *****************************************************************
export interface MobileHomeMeta {
programName: string; // program.name — varchar(255)
userName: string; // user.name — varchar(255)
}
@Injectable({
providedIn: 'root',
})
@@ -1,24 +1,12 @@
import { Injectable } from '@angular/core';
import { ApiResult } from '../classes/api-result';
import { StudentGoalSummary } from '../classes/student-goal';
// *****************************************************************
// TODO: This dummy service should be replaced by StudentGoalService,
// which will fetch real data from the API.
// *****************************************************************
export interface StudentGoalSummary {
studentIdentifier: string; // student.identifier — varchar(50)
goals: StudentGoalItem[];
}
export interface StudentGoalItem {
goalId: string; // goal.id_goal — char(36)
title: string; // goal.title — varchar(255)
description: string; // goal.description — text
category: string; // goal.category — varchar(100)
progressEventCount: number; // count of progress_event rows for this goal
}
@Injectable({
providedIn: 'root',
})
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { StudentCardDto } from '../models/dto/student-card.dto';
import { StudentCardDto } from '../classes/student-card.dto';
import { ApiResult } from '../classes/api-result';
@Injectable({
providedIn: 'root',
@@ -19,8 +20,8 @@ export class StudentService {
// Returns student card summaries. Currently returns dummy data
// until the API endpoint is available.
// *****************************************************************
getStudentCards(): Observable<StudentCardDto[]> {
return of([
async getStudentCards(): Promise<ApiResult<StudentCardDto[]>> {
var payload = [
{
studentId: '1',
identifier: 'J.B',
@@ -45,7 +46,9 @@ export class StudentService {
goalCount: 2,
progressEventCount: 0,
},
]);
];
return ApiResult.ok(payload);
}
// *****************************************************************
@@ -54,14 +57,16 @@ export class StudentService {
// Returns students assigned to the current user with their
// identifier, age, goal count, and progress event count.
// *****************************************************************
getDummyStudentsForUser(): Observable<StudentCardDto[]> {
return of([
async getDummyStudentsForUser(): Promise<ApiResult<StudentCardDto[]>> {
var payload = [
{ studentId: '1', identifier: 'J.B', age: 21, lastEntryDate: '2026-02-21', goalCount: 3, progressEventCount: 5 },
{ studentId: '2', identifier: 'M.K', age: 19, lastEntryDate: '2026-02-25', goalCount: 4, progressEventCount: 8 },
{ studentId: '3', identifier: 'A.R', age: 22, lastEntryDate: null, goalCount: 2, progressEventCount: 0 },
{ studentId: '4', identifier: 'T.W', age: 20, lastEntryDate: '2026-02-18', goalCount: 5, progressEventCount: 12 },
{ studentId: '5', identifier: 'L.C', age: 18, lastEntryDate: '2026-02-27', goalCount: 1, progressEventCount: 2 },
]);
];
return ApiResult.ok(payload);
}
// ************************ Event Handlers *************************