UNPKG

@upv/ushi-shared

Version:

Shared DTOs, types, and utilities for the USHI platform (LMS, Trials, Social, Wallet).

47 lines (46 loc) 1.25 kB
"use strict"; // src/core/dtos/base/BaseDto.ts Object.defineProperty(exports, "__esModule", { value: true }); /** * BaseDto<T> * * Abstract base class for all Data Transfer Objects (DTOs) in the USHI platform. * Provides common properties and a consistent serialization structure. * * @template T - Raw input type extending IBaseDtoInput */ class BaseDto { /** * Initializes shared properties from raw DTO input. * @param data - Raw DTO input conforming to IBaseDtoInput */ constructor(data) { this._id = data.id; this._createdAt = data.createdAt; this._updatedAt = data.updatedAt; } /** Getter for the unique ID */ get id() { return this._id; } /** Getter for the creation timestamp */ get createdAt() { return this._createdAt; } /** Getter for the last updated timestamp */ get updatedAt() { return this._updatedAt; } /** * Serializes common fields of the DTO. * Can be used by child `serialize()` implementations. */ serializeBase() { return { id: this._id, createdAt: this._createdAt, updatedAt: this._updatedAt, }; } } exports.default = BaseDto;