diff --git a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventController.java b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventController.java index fbc052b..e338359 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventController.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventController.java @@ -3,6 +3,7 @@ import com.github.fge.jsonpatch.JsonPatch; import com.observatory.observationtracker.domain.celestialevent.dto.*; import com.observatory.observationtracker.domain.celestialevent.models.CelestialEventStatus; +import org.springframework.data.domain.Pageable; import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.EntityModel; import org.springframework.http.MediaType; @@ -24,8 +25,8 @@ public CelestialEventController(CelestialEventService celestialEventService) { } @GetMapping - public ResponseEntity>> getCelestialEvents() { - return celestialEventService.getAllCelestialEvents(); + public ResponseEntity>> getCelestialEvents(Pageable pageable) { + return celestialEventService.getAllCelestialEvents(pageable); } @PostMapping(consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) @@ -35,8 +36,11 @@ public ResponseEntity> createCelestialEvent(@R } @GetMapping(params = "status") - public ResponseEntity>> getCelestialEventsByStatus(@RequestParam CelestialEventStatus status) { - return celestialEventService.getCelestialEventsByStatus(status); + public ResponseEntity>> getCelestialEventsByStatus( + Pageable pageable, + @RequestParam CelestialEventStatus status + ) { + return celestialEventService.getCelestialEventsByStatus(status, pageable); } @GetMapping("/{celestialEventUuid}") diff --git a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventService.java b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventService.java index a20244a..be41a5d 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventService.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/CelestialEventService.java @@ -24,9 +24,14 @@ import com.observatory.observationtracker.domain.celestialevent.repositories.CelestialEventRepository; import com.observatory.observationtracker.domain.useraccount.UserAccount; import com.observatory.observationtracker.domain.useraccount.UserAccountRepository; +import com.observatory.observationtracker.domain.useraccount.dto.GetUserAccountDto; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PagedResourcesAssembler; import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.Link; +import org.springframework.hateoas.PagedModel; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @@ -49,20 +54,21 @@ public class CelestialEventService { private final CelestialEventSlimDtoAssembler slimDtoAssembler; private final UserAccountRepository userAccountRepository; private final CelestialEventCommentRepository celestialEventCommentRepository; + private final PagedResourcesAssembler pagedResourcesAssembler; + private final JacksonConfig jacksonConfig; private final S3Service s3Service; private final CelestialEventDtoMapper celestialEventDtoMapper; public CelestialEventService(CelestialEventRepository celestialEventRepository, - CelestialEventDtoAssembler dtoAssembler - , JacksonConfig jacksonConfig, S3Service s3Service, - CelestialEventDtoMapper celestialEventDtoMapper, + CelestialEventDtoAssembler dtoAssembler, JacksonConfig jacksonConfig, + S3Service s3Service, CelestialEventDtoMapper celestialEventDtoMapper, CelestialEventImageRepository celestialEventImageRepository, UserAccountRepository userAccountRepository, CelestialEventCommentRepository celestialEventCommentRepository, - CelestialEventSlimDtoAssembler slimDtoAssembler - ) { + CelestialEventSlimDtoAssembler slimDtoAssembler, + PagedResourcesAssembler pagedResourcesAssembler) { this.celestialEventRepository = celestialEventRepository; this.dtoAssembler = dtoAssembler; this.jacksonConfig = jacksonConfig; @@ -72,36 +78,38 @@ public CelestialEventService(CelestialEventRepository celestialEventRepository, this.userAccountRepository = userAccountRepository; this.celestialEventCommentRepository = celestialEventCommentRepository; this.slimDtoAssembler = slimDtoAssembler; + this.pagedResourcesAssembler = pagedResourcesAssembler; } - public ResponseEntity>> getAllCelestialEvents() { - List allCelestialEvents = celestialEventRepository.findAll(); - List celestialEventDtos = - celestialEventDtoMapper.celestialEventListToGetSlimDtoList(allCelestialEvents); + public ResponseEntity>> getAllCelestialEvents(Pageable pageable) { + Page pagedCelestialEvents = + celestialEventRepository.findAll(pageable).map(celestialEventDtoMapper::celestialEventToGetSlimDto); + PagedModel> pagedCelestialEvent = + pagedResourcesAssembler.toModel(pagedCelestialEvents, slimDtoAssembler); + return ResponseEntity.status(HttpStatus.OK).body( + pagedCelestialEvent + .add( + linkTo(methodOn(CelestialEventController.class).getCelestialEventsByStatus(null, + null)).withRel("filter-by-status").withType("GET") + ) + ); + } - return ResponseEntity.status(HttpStatus.OK) - .body(CollectionModel.of( - slimDtoAssembler.toCollectionModel(celestialEventDtos), - linkTo(CelestialEventController.class).withSelfRel().withType("GET, POST"), - linkTo(methodOn(CelestialEventController.class).getCelestialEventsByStatus(null)).withRel( - "filter-by-status").withType("GET") - )); + public ResponseEntity>> getCelestialEventsByStatus(CelestialEventStatus status, Pageable pageable) { + Page events = + celestialEventRepository.findPagedCelestialEventByEventStatus(status, pageable) + .orElseThrow(() -> new CelestialEventStatusNotFoundException(status)) + .map(celestialEventDtoMapper::celestialEventToGetSlimDto); - } + PagedModel> pagedEvents = pagedResourcesAssembler.toModel(events, + slimDtoAssembler); - public ResponseEntity>> getCelestialEventsByStatus(CelestialEventStatus status) { - List events = - celestialEventRepository.findCelestialEventByEventStatus(status).orElseThrow(() -> new CelestialEventStatusNotFoundException(status)); - List celestialEventDtos = - celestialEventDtoMapper.celestialEventListToGetSlimDtoList(events); - return ResponseEntity.status(HttpStatus.OK).body( - CollectionModel.of( - slimDtoAssembler.toCollectionModel(celestialEventDtos), - linkTo(methodOn(CelestialEventController.class).getCelestialEventsByStatus(null)).withSelfRel().withType("GET"), - linkTo(CelestialEventController.class).withRel("all").withType("GET, POST") - ) - ); + return ResponseEntity.status(HttpStatus.OK) + .body( + pagedEvents + .add(linkTo(CelestialEventController.class).withRel("all").withType("GET, POST")) + ); } /* @@ -114,8 +122,6 @@ public ResponseEntity updateCelestialEventStatus() { events.stream().map(this::updateEventStatus).filter(Objects::nonNull).toList(); return ResponseEntity.status(HttpStatus.OK).build(); - -// return null; } /* @@ -141,8 +147,7 @@ public ResponseEntity> getCelestialEventByUuid return ResponseEntity.status(HttpStatus.OK).body(dtoAssembler.toModel(celestialEventDto).add(rootLink)); } - public ResponseEntity> createCelestialEvent(CreateCelestialEventDto celestialEvent, - List images) { + public ResponseEntity> createCelestialEvent(CreateCelestialEventDto celestialEvent, List images) { try { List imageUrls = images.stream().map(image -> { try { @@ -163,8 +168,7 @@ public ResponseEntity> createCelestialEvent(Cr Link rootLink = linkTo(CelestialEventController.class).withRel("all").withType("GET, POST"); return ResponseEntity.status(HttpStatus.CREATED).body(dtoAssembler.toModel(createdEvent).add(rootLink)); - } catch ( - RuntimeException e) { + } catch (RuntimeException e) { throw new IncorrectCelestialEventFormatException(); } @@ -233,9 +237,7 @@ public ResponseEntity addCommentToCelestialEvent(St GetCelestialEventCommentDto returnDto = celestialEventDtoMapper.celestialEventCommentToGetDto(celestialEventComment); - return ResponseEntity.status(HttpStatus.CREATED).body( - returnDto - ); + return ResponseEntity.status(HttpStatus.CREATED).body(returnDto); } public ResponseEntity addReplyToCelestialEventComment(String celestialEventUuid, diff --git a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/dto/GetSlimCelestialEventDto.java b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/dto/GetSlimCelestialEventDto.java index d3f519f..afa63b5 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/dto/GetSlimCelestialEventDto.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/dto/GetSlimCelestialEventDto.java @@ -1,6 +1,7 @@ package com.observatory.observationtracker.domain.celestialevent.dto; import com.fasterxml.jackson.annotation.JsonFormat; +import com.observatory.observationtracker.domain.celestialevent.models.CelestialEvent; import com.observatory.observationtracker.domain.celestialevent.models.CelestialEventStatus; import java.sql.Timestamp; @@ -18,6 +19,17 @@ public class GetSlimCelestialEventDto { private Timestamp updatedTimestamp; private CelestialEventStatus eventStatus; +// public GetSlimCelestialEventDto(CelestialEvent event) { +// this.uuid = event.getUuid(); +// this.celestialEventName = event.getCelestialEventName(); +// this.celestialEventDescription = event.getCelestialEventDescription(); +// this.celestialEventDateTime = event.getCelestialEventDateTime(); +// this.createdTimestamp = event.getCreatedTimestamp(); +// this.updatedTimestamp = event.getUpdatedTimestamp(); +// this.eventStatus = event.getEventStatus(); +// +// } + public String getUuid() { return uuid; } diff --git a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/repositories/CelestialEventRepository.java b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/repositories/CelestialEventRepository.java index 0f1c004..ccdc711 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/repositories/CelestialEventRepository.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/celestialevent/repositories/CelestialEventRepository.java @@ -1,7 +1,10 @@ package com.observatory.observationtracker.domain.celestialevent.repositories; +import com.observatory.observationtracker.domain.celestialevent.CelestialEventController; import com.observatory.observationtracker.domain.celestialevent.models.CelestialEvent; import com.observatory.observationtracker.domain.celestialevent.models.CelestialEventStatus; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -12,6 +15,8 @@ public interface CelestialEventRepository extends JpaRepository { Optional> findCelestialEventByEventStatus(CelestialEventStatus status); + Optional> findPagedCelestialEventByEventStatus(CelestialEventStatus status, Pageable page); + @Query("SELECT c FROM CelestialEvent c LEFT JOIN FETCH c.comments com WHERE c.uuid = :uuid AND com.parentComment " + "IS NULL") Optional findByNullParentComment(@Param("uuid") String uuid); diff --git a/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationController.java b/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationController.java index 8006d96..2d9efde 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationController.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationController.java @@ -2,8 +2,10 @@ import com.github.fge.jsonpatch.JsonPatch; import com.observatory.observationtracker.domain.observation.dto.*; +import org.springframework.data.domain.Pageable; import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.EntityModel; +import org.springframework.hateoas.PagedModel; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -21,8 +23,8 @@ public ObservationController(ObservationService service) { } @GetMapping(params = "userUuid") - public ResponseEntity>> getAllObservationsOfUser(@RequestParam String userUuid) { - return service.getAllObservations(userUuid); + public ResponseEntity>> getAllObservationsOfUser(@RequestParam String userUuid, Pageable pageable) { + return service.getAllObservations(userUuid, pageable); } @PostMapping(params = {"userUuid", "celestialEventUuid"}, @@ -53,8 +55,8 @@ public ResponseEntity deleteObservation(@PathVariable String observationUu } @GetMapping - public ResponseEntity>> getPublishedObservations() { - return service.getPublishedCourses(); + public ResponseEntity>> getPublishedObservations(Pageable pageable) { + return service.getPublishedCourses(pageable); } @PostMapping(value = "/{observationUuid}/comments", params = "userUuid", consumes = diff --git a/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationService.java b/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationService.java index aef525a..0dcfef6 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationService.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/observation/ObservationService.java @@ -26,9 +26,13 @@ import com.observatory.observationtracker.domain.useraccount.exceptions.UserNotFoundException; import com.observatory.observationtracker.rabbitmq.notifications.CommentNotificationProducer; import com.observatory.observationtracker.rabbitmq.notifications.ReplyNotificationProducer; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PagedResourcesAssembler; import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.Link; +import org.springframework.hateoas.PagedModel; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @@ -47,6 +51,7 @@ public class ObservationService { private final ObservationDtoAssembler observationDtoAssembler; private final ObservationSlimDtoAssembler observationSlimDtoAssembler; private final ObservationCommentRepository commentRepository; + private final PagedResourcesAssembler pagedResourcesAssembler; private final S3Service s3Service; private final JacksonConfig jacksonConfig; @@ -64,7 +69,8 @@ public ObservationService(ObservationRepository observationRepository, UserAccou JacksonConfig jacksonConfig, ObservationDtoMapper dtoMapper, CommentNotificationProducer commentNotificationProducer, - ReplyNotificationProducer replyNotificationProducer) { + ReplyNotificationProducer replyNotificationProducer, + PagedResourcesAssembler pagedResourcesAssembler) { this.observationDtoAssembler = observationDtoAssembler; this.userRepository = userRepository; this.observationRepository = observationRepository; @@ -76,21 +82,19 @@ public ObservationService(ObservationRepository observationRepository, UserAccou this.observationSlimDtoAssembler = observationSlimDtoAssembler; this.commentNotificationProducer = commentNotificationProducer; this.replyNotificationProducer = replyNotificationProducer; + this.pagedResourcesAssembler = pagedResourcesAssembler; } - public ResponseEntity>> getAllObservations(String userUuid) { - List observations = - observationRepository.findByOwnerUuid(userUuid).orElseThrow(() -> new UserNotFoundException(userUuid)); + public ResponseEntity>> getAllObservations(String userUuid, + Pageable pageable) { + Page observations = + observationRepository.findByOwnerUuid(userUuid, pageable).map(dtoMapper::observationToGetSlimDto); - List observationDtos = dtoMapper.observationListToGetSlimDtoList(observations); - CollectionModel> assembledRequest = - observationSlimDtoAssembler.toCollectionModel(observationDtos); + PagedModel> pagedObservations = + pagedResourcesAssembler.toModel(observations, observationSlimDtoAssembler); return ResponseEntity.status(HttpStatus.OK).body( - CollectionModel.of( - assembledRequest, - linkTo(methodOn(ObservationController.class).getAllObservationsOfUser(userUuid)).withSelfRel().withType("GET, POST") - ) + pagedObservations ); } @@ -182,29 +186,20 @@ public ResponseEntity deleteObservation(String observationUuid) { try { observationRepository.delete(observation); -// observation.getImages().forEach(observationImage -> s3Service.deleteImage(observationImage.getUrl())); return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); } catch (RuntimeException e) { throw new RuntimeException("There was an error in deletion"); } } - public ResponseEntity>> getPublishedCourses() { - List observations = - observationRepository.findObservationsByIsPublishedIsTrue().orElseThrow(); + public ResponseEntity>> getPublishedCourses(Pageable pageable) { + Page observations = + observationRepository.findObservationsByIsPublishedIsTrue(pageable).map(dtoMapper::observationToGetSlimDto); - List observationDtos = dtoMapper.observationListToGetSlimDtoList(observations); + PagedModel> pagedObservations = + pagedResourcesAssembler.toModel(observations, observationSlimDtoAssembler); - CollectionModel> assembledRequest = - observationSlimDtoAssembler.toCollectionModel(observationDtos); - - return ResponseEntity.status(HttpStatus.OK).body( - CollectionModel.of( - assembledRequest, - linkTo(methodOn(ObservationController.class).getPublishedObservations()).withSelfRel() -// linkTo(methodOn().withSelfRel().withType("GET, POST") - ) - ); + return ResponseEntity.status(HttpStatus.OK).body(pagedObservations); } public ResponseEntity addCommentToObservation(String observationUuid, @@ -254,7 +249,7 @@ public ResponseEntity addReplyToObservation(String obs commentRepository.save(parentComment); GetObservationCommentDto returnDto = dtoMapper.observationCommentToGetDto(reply); - + replyNotificationProducer.addReplyMessage( dtoMapper.observationCommentToGetDto(parentComment).getAuthor(), dtoMapper.observationCommentToGetDto(reply).getAuthor(), diff --git a/api/src/main/java/com/observatory/observationtracker/domain/observation/repositories/ObservationRepository.java b/api/src/main/java/com/observatory/observationtracker/domain/observation/repositories/ObservationRepository.java index 3294bc9..0604998 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/observation/repositories/ObservationRepository.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/observation/repositories/ObservationRepository.java @@ -1,6 +1,8 @@ package com.observatory.observationtracker.domain.observation.repositories; import com.observatory.observationtracker.domain.observation.models.Observation; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -10,8 +12,10 @@ public interface ObservationRepository extends JpaRepository { Optional findObservationByUuid(String uuid); - Optional> findObservationsByIsPublishedIsTrue(); - Optional> findByOwnerUuid(String uuid); + Page findObservationsByIsPublishedIsTrue(Pageable pageable); + + + Page findByOwnerUuid(String uuid, Pageable pageable); @Query("SELECT o FROM Observation o LEFT JOIN FETCH o.comments com WHERE o.uuid = :uuid AND com.parentComment " + "IS NULL") diff --git a/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountController.java b/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountController.java index 9690f5f..a0d8c97 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountController.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountController.java @@ -2,8 +2,12 @@ import com.github.fge.jsonpatch.JsonPatch; import com.observatory.observationtracker.domain.useraccount.dto.GetUserAccountDto; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PageableDefault; import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.EntityModel; +import org.springframework.hateoas.PagedModel; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -32,13 +36,14 @@ public ResponseEntity> createUser(@RequestBody Us * Uses JSON Patch RFC 6902 for the patch format * */ @PatchMapping(value = "/{uuid}", consumes = "application/json-patch+json") - public ResponseEntity> patchUser(@PathVariable String uuid, @RequestBody JsonPatch patch) { + public ResponseEntity> patchUser(@PathVariable String uuid, + @RequestBody JsonPatch patch) { return service.patchUser(uuid, patch); } @GetMapping - public ResponseEntity>> getAllUsers() { - return service.getAllUsers(); + public ResponseEntity>> getAllUsers(Pageable pageable) { + return service.getAllUsers(pageable); } } diff --git a/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountService.java b/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountService.java index d152e15..edfef4f 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountService.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/useraccount/UserAccountService.java @@ -8,8 +8,12 @@ import com.observatory.observationtracker.domain.useraccount.dto.GetUserAccountDto; import com.observatory.observationtracker.domain.useraccount.dto.UserAccountDtoMapper; import com.observatory.observationtracker.domain.useraccount.exceptions.UserNotFoundException; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PagedResourcesAssembler; import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.EntityModel; +import org.springframework.hateoas.PagedModel; import org.springframework.hateoas.server.RepresentationModelAssembler; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -26,11 +30,16 @@ public class UserAccountService { private final UserAccountRepository repository; private final UserModelAssembler assembler; private final UserAccountDtoMapper userAccountDtoMapper; + private final PagedResourcesAssembler pagedResourcesAssembler; - public UserAccountService(UserAccountRepository repository, UserModelAssembler assembler, UserAccountDtoMapper userAccountDtoMapper) { + public UserAccountService(UserAccountRepository repository, UserModelAssembler assembler, + UserAccountDtoMapper userAccountDtoMapper, + PagedResourcesAssembler pagedResourcesAssembler + ) { this.repository = repository; this.assembler = assembler; this.userAccountDtoMapper = userAccountDtoMapper; + this.pagedResourcesAssembler = pagedResourcesAssembler; } public EntityModel oneUserByUuid(String uuid) { @@ -67,11 +76,14 @@ private UserAccount applyPatchToUser(JsonPatch patch, UserAccount user) throws J return mapper.treeToValue(patched, UserAccount.class); } - public ResponseEntity>> getAllUsers() { - List allUserAccounts = repository.findAll(); - List userAccountDtos = userAccountDtoMapper.userAccountListToGetDtoList(allUserAccounts); - return ResponseEntity.status(HttpStatus.OK).body(assembler.toCollectionModel(userAccountDtos)); + public ResponseEntity>> getAllUsers(Pageable pageable) { + Page users = repository.findAll(pageable).map(userAccountDtoMapper::userAccountToGetDto); + PagedModel> pagedUsers = pagedResourcesAssembler.toModel(users, assembler); + + return ResponseEntity.status(HttpStatus.OK).body(pagedUsers); } + + } diff --git a/api/src/main/java/com/observatory/observationtracker/domain/useraccount/dto/UserAccountDtoMapper.java b/api/src/main/java/com/observatory/observationtracker/domain/useraccount/dto/UserAccountDtoMapper.java index 8fb0ab9..164e6b6 100644 --- a/api/src/main/java/com/observatory/observationtracker/domain/useraccount/dto/UserAccountDtoMapper.java +++ b/api/src/main/java/com/observatory/observationtracker/domain/useraccount/dto/UserAccountDtoMapper.java @@ -2,6 +2,7 @@ import com.observatory.observationtracker.domain.useraccount.UserAccount; import org.mapstruct.Mapper; +import org.springframework.data.domain.Page; import java.util.List; diff --git a/api/src/main/resources/config/application-dev.properties b/api/src/main/resources/config/application-dev.properties index 812680e..fb52afc 100644 --- a/api/src/main/resources/config/application-dev.properties +++ b/api/src/main/resources/config/application-dev.properties @@ -1,6 +1,7 @@ logging.level.org.springframework=info # Data -spring.datasource.url=jdbc:postgresql://db:5432/observation_tracker +#spring.datasource.url=jdbc:postgresql://db:5432/observation_tracker +spring.datasource.url=jdbc:postgresql://localhost:5432/observation_tracker spring.datasource.username=compose-postgres spring.datasource.password=compose-postgres spring.datasource.driver-class-name=org.postgresql.Driver @@ -10,7 +11,8 @@ spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.database=postgresql # RabbitMQ -spring.rabbitmq.host=rabbitmq +#spring.rabbitmq.host=rabbitmq +spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest diff --git a/api/src/main/resources/config/application.properties b/api/src/main/resources/config/application.properties index d19bb59..3446a48 100644 --- a/api/src/main/resources/config/application.properties +++ b/api/src/main/resources/config/application.properties @@ -1,5 +1,5 @@ spring.application.name=observation-tracker -spring.profiles.active=prod +spring.profiles.active=dev management.endpoint.health.show-details=always # RabbitMQ rabbitmq.exchange.notification=notification-exchange @@ -7,3 +7,5 @@ rabbitmq.queue.observation.notification=observation-notification-message-queue rabbitmq.routing.key.observation.notification=observation-notification-key rabbitmq.queue.reply.notification=reply-notification-message-queue rabbitmq.routing.key.reply.notification=reply-notification-key +# Pagination defaults +spring.data.web.pageable.default-page-size=5