Questions tagged [dto]

DTO is an acronym for Data Transfer Object, a design pattern used in data transfer.

DTO is an acronym for Data Transfer Object, a design pattern used in transferring data through internal or external interfaces. A DTO protects the application's internal data by acting as dummy storages, the whole logic is implemented only in actual Domain Objects (DO).

Pros:

  • Fewer remote calls (typically one, getDto() vs. individual getId(), getName(), etc.)
  • Improved data capsulation (Remote systems need only to know the details of the DTO, not DO internals)

Cons:

  • class explosion
  • conversions needed between DTOs and DOs
2100 questions
0
votes
1 answer

How to handle users pictures (avatars) vs DTO structure

I'm developing Flutter app with my own backend in Spring, but question is rather more general. Let's say I have forum functionality in my app, where I want to display posts, comments etc. Each post / comment was of course posted by somebody and…
invisus
  • 43
  • 3
0
votes
1 answer

Change httpresponse with DTO

I run in container fake smtp and it has own api, but it's not readable and i dont need like 80% of response, so how i can use DTO to make response more readable and less verbose? HttpRequest request = HttpRequest.newBuilder() …
Max
  • 253
  • 2
  • 16
0
votes
1 answer

Spring Boot REST API DTO method

I am creating simple rest api using springboot. I am modifing my methods because I need them to be build using DTO. Here's code: private final UserService userService; private final UserMapper userMapper; @GetMapping public Page
0
votes
1 answer

Ignore DTO field using MapStruct (Spring boot)

I created a couple of DTO's and a MapStruct interface for getting the User data: public class UserDto { private Long id; private CountryDto country; } public class CountryDto { private Long id; private String name; …
txemix
  • 45
  • 9
0
votes
1 answer

Gilead and RequestFactory alternatives

I began to develop a fairly large GWT-project, which naturally have a data model. And I want to comfortably work with entity-classes on client side. I really liked Gilead, but this thread is not good news for me. I do not want to use RequestFactory,…
Sergey Vedernikov
  • 7,609
  • 2
  • 25
  • 27
0
votes
3 answers

Map Query result to dto

I have these 3 independent table i.e Student, Teacher and Subject. Independent here refers that there is no relation in these tables. I want the count of all these tables . SQL query looks like - SELECT (SELECT COUNT(*) FROM Student as ST, …
Bhumika
  • 45
  • 2
  • 10
0
votes
0 answers

Cannot deserialize instance of out of START_ARRAY token

I tried to map the json below to Dto but was getting the error: Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of com.cd.example.api.dtos.PersonDto out of START_ARRAY token. How can I fixed…
bittersour
  • 937
  • 2
  • 11
  • 32
0
votes
1 answer

Laravel post request pass class with property with type of another class

I have controller in Laravel: public function save(Request $request, ClientOrderDTO $clientOrderDTO){ } Definition of above DTO looks like: use App\DTO\ClientDTO; class ClientOrderDTO { public $id; public $userId; public…
Jonson
  • 53
  • 1
  • 8
0
votes
1 answer

Ado.Net Api Query DTO

I want to return a DTO from a query and it does not return anything. I don't know if I have done it right but the where condition exists. public class ServiciosComandasController : ApiController { private TPVRestauranteEntities db =…
0
votes
3 answers

Best Practice for returning multiple objects/dtos in RestController

While looking at tons of articles about Rest APIs in Spring Boot, I've noticed that most of them use just one type of object per method in their controllers. So it will be something like this: @GetMapping("/posts") public…
wolfhunter
  • 33
  • 7
0
votes
1 answer

How to upload Files and Other fields with Request Body in Nestjs

I want to upload three fields like: Example Data: partner_id: 3638, review: [{'product_id': 155, 'order_sku_id': 155, 'review_title': 'Orange Review','rating': 5 }], review_images[0][0]: ImageFile00 review_images[0][1]:…
Aspile Inc
  • 119
  • 2
  • 10
0
votes
0 answers

Can I return DTO and domain entities from services?

I have a spring-boot application and I use DTO like that: Service @Service public class UnitOfMeasureServiceImpl implements IUnitOfMeasureService { private final IUnitsOfMeasureRepository unitOfMeasureRepository; @Autowired public…
Davide
  • 75
  • 1
  • 2
  • 11
0
votes
1 answer

How to create Dto using Json object C# with multiple data types array

Need to create Dto class supporting multiple data types in an array JSON object, due to it has Integer, string values in the array, have declared dynamic object declaration but getting an error, do I need to create a custom JsonConvert class to…
Mohan K
  • 45
  • 2
0
votes
1 answer

Where it is necessary to keep the DTO object when interacting with several services

A little background of my problem. I have a set of the following services: AdapterService - intended for loading certain products from an external system ApiGateway - accepts requests from UI. In particular, now there is only one request that…
Yury
  • 3
  • 4
0
votes
0 answers

how to properly create a rest method using dto

I need to send a request to a third-party service, then get an object from the response and display it on the browser. package com.statusinfonew.springboot.controller; import java.util.Collections; import java.util.List; import lombok.Data; import…
Daniel Vai
  • 71
  • 8
1 2 3
99
100