samedi 26 mars 2022

Should I separate transferred data in DTO and options changing method's behavior?

I have a classic DTO interface (Typescript):

interface GetCurrencyDto {
   id?: string
   ticker?: string
   name?: string
}

But what if I want to add options that will change the flow of my service method? Would it be better to create another interface GetCurrencyOptions for service-method paramter named options containing something like: throwError?: boolean, useCache?: boolean, useRelations?: string[], etc.? Or all of them must be part of dto?

Aucun commentaire:

Enregistrer un commentaire