feat: add AccessoryResponse and TuningResponse DTOs for accessory and tuning data representation

This commit is contained in:
2026-04-23 16:10:05 +08:00
parent 353c05339e
commit 384e17e79c
3 changed files with 42 additions and 0 deletions
@@ -0,0 +1,22 @@
package com.onixbyte.deltaforceguide.domain.dto;
import com.onixbyte.deltaforceguide.domain.entity.Accessory;
import java.util.List;
public record AccessoryResponse(
String slotName,
String accessoryName,
List<TuningResponse> tunings
) {
public static AccessoryResponse from(Accessory accessory) {
return new AccessoryResponse(
accessory.getSlotName(),
accessory.getAccessoryName(),
accessory.getTunings() == null
? List.of()
: accessory.getTunings().stream().map(TuningResponse::from).toList()
);
}
}
@@ -10,6 +10,7 @@ public record ModificationResponse(
String name, String name,
String code, String code,
List<String> tags, List<String> tags,
List<AccessoryResponse> accessories,
String note, String note,
String author, String author,
String videoUrl String videoUrl
@@ -21,6 +22,9 @@ public record ModificationResponse(
modification.getName(), modification.getName(),
modification.getCode(), modification.getCode(),
modification.getTags(), modification.getTags(),
modification.getAccessories() == null
? List.of()
: modification.getAccessories().stream().map(AccessoryResponse::from).toList(),
modification.getNote(), modification.getNote(),
modification.getAuthor(), modification.getAuthor(),
modification.getVideoUrl() modification.getVideoUrl()
@@ -0,0 +1,16 @@
package com.onixbyte.deltaforceguide.domain.dto;
import com.onixbyte.deltaforceguide.domain.entity.Tuning;
public record TuningResponse(
String tuningName,
Double tuningValue
) {
public static TuningResponse from(Tuning tuning) {
return new TuningResponse(
tuning.getTuningName(),
tuning.getTuningValue()
);
}
}