@adocasts.com/dto
Version:
Easily make and generate DTOs from Lucid Models
32 lines (31 loc) • 785 B
TypeScript
import type { ModelInfo, ModelPropertyType } from './model_service.js';
import { ApplicationService } from '@adonisjs/core/types';
export type DtoInfo = {
entity: {
path: string;
name: string;
};
variable: string;
className: string;
fileName: string;
exportPath: string;
properties: DtoProperty[];
};
export type DtoProperty = {
name: string;
type: string;
typeRaw: ModelPropertyType[];
declaration: string;
valueSetter: string;
};
export default class DtoService {
#private;
protected app: ApplicationService;
constructor(app: ApplicationService);
/**
* Get DTO file, class, and property info
* @param name
* @param model
*/
getDtoInfo(name: string, model: ModelInfo): DtoInfo;
}