Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
리팩토링;
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Feb 17, 2024
1 parent 92a64bf commit 250cf96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.example.daemawiki.domain.revision.api;

import com.example.daemawiki.domain.revision.dto.request.GetRevisionPageRequest;
import com.example.daemawiki.domain.revision.component.service.RevisionService;
import com.example.daemawiki.domain.revision.dto.response.RevisionDocumentDetailResponse;
import com.example.daemawiki.domain.revision.model.RevisionHistory;
import com.example.daemawiki.domain.revision.component.service.RevisionService;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

Expand All @@ -23,13 +21,13 @@ public Flux<RevisionDocumentDetailResponse> getRevisionTop10ByUpdatedDate() {
}

@GetMapping("/page")
public Flux<RevisionHistory> getRevisionToPage(@Valid @RequestBody GetRevisionPageRequest request) {
return revisionService.getAllRevisionPaging(request);
public Flux<RevisionHistory> getRevisionToPage(@RequestParam String lastRevisionId) {
return revisionService.getAllRevisionPaging(lastRevisionId);
}

@GetMapping("/{documentId}")
public Flux<RevisionHistory> getRevisionByDocument(@PathVariable String documentId, @Valid @RequestBody GetRevisionPageRequest request) {
return revisionService.getAllRevisionByDocument(documentId, request);
public Flux<RevisionHistory> getRevisionByDocument(@PathVariable String documentId, @RequestParam String lastRevisionId) {
return revisionService.getAllRevisionByDocument(documentId, lastRevisionId);
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.example.daemawiki.domain.revision.component.service;

import com.example.daemawiki.domain.revision.model.mapper.RevisionMapper;
import com.example.daemawiki.domain.revision.dto.request.GetRevisionPageRequest;
import com.example.daemawiki.domain.revision.dto.response.RevisionDocumentDetailResponse;
import com.example.daemawiki.domain.revision.model.RevisionHistory;
import com.example.daemawiki.domain.revision.model.mapper.RevisionMapper;
import com.example.daemawiki.domain.revision.model.type.RevisionType;
import com.example.daemawiki.domain.revision.repository.RevisionHistoryRepository;
import org.bson.types.ObjectId;
Expand Down Expand Up @@ -40,16 +39,14 @@ public Flux<RevisionHistory> getFilteredRevisions(Flux<RevisionHistory> revision
.take(20);
}

public Flux<RevisionHistory> getAllRevisionPaging(GetRevisionPageRequest request) {
String lastRevisionId = request.lastRevisionId();
public Flux<RevisionHistory> getAllRevisionPaging(String lastRevisionId) {
return getFilteredRevisions(
revisionHistoryRepository.findAllByOrderByCreatedDateTimeDesc(),
lastRevisionId
).subscribeOn(scheduler);
}

public Flux<RevisionHistory> getAllRevisionByDocument(String documentId, GetRevisionPageRequest request) {
String lastRevisionId = request.lastRevisionId();
public Flux<RevisionHistory> getAllRevisionByDocument(String documentId, String lastRevisionId) {
return getFilteredRevisions(
revisionHistoryRepository.findAllByDocumentId(documentId),
lastRevisionId
Expand Down

This file was deleted.

0 comments on commit 250cf96

Please sign in to comment.