post author link

This commit is contained in:
Stepan Usatiuk
2023-12-17 14:22:50 +01:00
parent 92f3bebede
commit f69c33358b
6 changed files with 27 additions and 5 deletions

View File

@@ -1,6 +1,4 @@
package com.usatiuk.tjv.y.server.dto;
import com.usatiuk.tjv.y.server.entity.Post;
public record PostTo(Long id, String authorUuid, String text, Long createdAt) {
public record PostTo(Long id, String authorUuid, String authorUsername, String text, Long createdAt) {
}

View File

@@ -5,6 +5,6 @@ import com.usatiuk.tjv.y.server.entity.Post;
public class PostMapper {
public static PostTo makeDto(Post post) {
return new PostTo(post.getId(), post.getAuthor().getUuid(), post.getText(), post.getCreatedAt().getEpochSecond());
return new PostTo(post.getId(), post.getAuthor().getUuid(), post.getAuthor().getUsername(), post.getText(), post.getCreatedAt().getEpochSecond());
}
}