5.3: Updating Interfaces
Now that we've update the User entity on the backend and added DTOs, let's update our SPA client to match.
Updating User
We'll match our User.ts interface to match our UserForDetail DTO.
export interface User {
id: number;
username: string;
specialty: string;
age: number;
knownAs: string;
created: Date;
lastActive: Date;
photoUrl: string;
city: string;
state: string;
interests?: string;
introduction?: string;
lookingFor?: string;
photos?: Photo[];
}Adding Photo
Next, in your models folder, create another interface called Photo.ts and add the properties in the PhotoForDetail DTO
export interface Photo {
id: number;
url: string;
description: string;
dateAdded: string;
isMain: boolean;
}Make sure you go back to the User interface and import the Photo interface
Last updated