Model
Last updated
A model (document / DTO) is the persistence shape of your data — how a record looks in the database. It's kept separate from the domain Entity so storage concerns never leak into your business model; a Mapper converts between them. Write it by hand in the feature's data/ folder:
// data/character.dto.ts — the MongoDB document shape
export interface CharacterDocument {
_id: string;
name: string;
universe: string;
alignment: string;
createdAt: Date;
updatedAt: Date;
}Layer
domain/
data/
Purpose
business rules + behavior
storage shape
Knows the DB?
no
yes (e.g. _id)
Defined as
class
interface / type
Last updated