Skip to content

Commit d6697f2

Browse files
committed
1 parent 856a960 commit d6697f2

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

src/main/java/gt/app/DataCreator.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import gt.app.modules.note.NoteService;
1010
import gt.app.modules.user.AuthorityService;
1111
import gt.app.modules.user.UserService;
12-
import jakarta.persistence.EntityManager;
1312
import lombok.RequiredArgsConstructor;
1413
import lombok.extern.slf4j.Slf4j;
1514
import org.springframework.context.annotation.Profile;
1615
import org.springframework.context.event.ContextRefreshedEvent;
1716
import org.springframework.context.event.EventListener;
1817
import org.springframework.stereotype.Component;
1918

19+
import jakarta.persistence.EntityManager;
2020
import java.io.File;
2121

2222
@Component
@@ -38,10 +38,10 @@ public void ctxRefreshed(ContextRefreshedEvent evt) {
3838
initData();
3939
}
4040

41-
public void initData() {
41+
public void initData(){
4242
log.info("Context Refreshed !!, Initializing Data... ");
4343

44-
new File(appProperties.fileStorage().uploadFolder() + File.separator + "attachments").mkdirs();
44+
new File(appProperties.fileStorage().uploadFolder() + File.separator +"attachments").mkdirs();
4545

4646
Authority adminAuthority = new Authority();
4747
adminAuthority.setName(Constants.ROLE_ADMIN);

src/main/java/gt/app/config/AuditorResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@RequiredArgsConstructor
1414
public class AuditorResolver implements AuditorAware<LiteUser> {
1515

16-
private final EntityManager entityManager;
16+
private final EntityManager entityManager;
1717

1818
@Override
1919
public Optional<LiteUser> getCurrentAuditor() {

src/main/java/gt/app/modules/note/NoteService.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,22 @@ public Note update(NoteEditDto dto) {
5656
}
5757

5858
public NoteReadDto read(Long id) {
59-
return noteRepository.findById(id).map(noteMapper::mapForRead).orElseThrow();
59+
return noteRepository.findById(id)
60+
.map(noteMapper::mapForRead).orElseThrow();
6061
}
6162

6263
public Note save(Note note) {
6364
return noteRepository.save(note);
6465
}
6566

6667
public Page<NoteReadDto> readAll(Pageable pageable) {
67-
return noteRepository.findAll(pageable).map(noteMapper::mapForRead);
68+
return noteRepository.findAll(pageable)
69+
.map(noteMapper::mapForRead);
6870
}
6971

7072
public Page<NoteReadDto> readAllByUser(Pageable pageable, Long userId) {
71-
return noteRepository.findByCreatedByUserIdOrderByCreatedDateDesc(pageable, userId).map(noteMapper::mapForRead);
73+
return noteRepository.findByCreatedByUserIdOrderByCreatedDateDesc(pageable, userId)
74+
.map(noteMapper::mapForRead);
7275
}
7376

7477
public void delete(Long id) {

src/main/java/gt/app/modules/note/dto/NoteReadDto.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
public record NoteReadDto(Long id, String title, String content, Long userId, String username, Instant createdDate,
88
List<FileInfo> files) {
99

10+
//SpelEvaluationException: EL1004E: Method call: Method size() cannot be found on type java.util.ArrayList
11+
//Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "note.files.size()>0" (template: "note/_notes" - line 43, col 18)
1012
public int getFileSize() {
1113
if (files == null) {
1214
return 0;

0 commit comments

Comments
 (0)