-
Notifications
You must be signed in to change notification settings - Fork 3
/
ShortFormController.java
43 lines (36 loc) · 1.83 KB
/
ShortFormController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.daggle.animory.domain.shortform.controller;
import com.daggle.animory.common.Response;
import com.daggle.animory.domain.shortform.ShortFormService;
import com.daggle.animory.domain.shortform.dto.request.ShortFormSearchCondition;
import com.daggle.animory.domain.shortform.dto.response.CategoryShortFormPage;
import com.daggle.animory.domain.shortform.dto.response.HomeShortFormPage;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@Validated
@RestController
@RequiredArgsConstructor
public class ShortFormController implements ShortFormControllerApi {
private final ShortFormService shortFormService;
/**
* 다양한 검색 조건 변화에 대응할 수 있는 목적으로 사용할 숏폼 영상 조회 API 입니다.
*/
@Override
@GetMapping("/short-forms")
public Response<CategoryShortFormPage> getShortForms(@ModelAttribute @Valid final ShortFormSearchCondition searchCondition,
@PageableDefault(page = 1, size = 10) final Pageable pageable) {
return Response.success(shortFormService.getCategoryShortFormPage(searchCondition, pageable));
}
/**
* 홈 화면에서 보여 줄 숏폼 영상들을 조회합니다.
*/
@GetMapping("/short-forms/home")
public Response<HomeShortFormPage> getHomeShortForms(@PageableDefault(page = 1, size = 10) final Pageable pageable) {
return Response.success(shortFormService.getHomeShortFormPage(pageable));
}
}