package com.izouma.nineth.web.mobile.open.v1;


import com.izouma.nineth.domain.Activity;
import com.izouma.nineth.dto.PageQuery;
import com.izouma.nineth.service.ActivityService;
import com.izouma.nineth.service.ProjectService;
import com.izouma.nineth.web.BaseController;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/activity/v1")
@AllArgsConstructor
public class ActivityControllerOpenV1{
    private ActivityService activityService;
    private final ProjectService projectService;

    @PostMapping("/all")
    public Page<Activity> all(@RequestBody PageQuery pageQuery) {
        return activityService.all(pageQuery);
    }

    @GetMapping("/get/{id}")
    public Activity get(@PathVariable Long id) {
        return activityService.findById(id);
    }


    @GetMapping("/contraction")
    public List<Activity> contraction(){
        return activityService.contraction(projectService.getProjectId());
    }

}

