package com.sqx.modules.myCollection.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.myCollection.entity.MyCollection;
import com.sqx.modules.myCollection.service.MyCollectionService;
import com.sqx.modules.resumes.entity.PostPush;
import com.sqx.modules.resumes.entity.Resumes;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 收藏管理
 * </p>
 *
 * @author www.javacoder.top
 * @since 2023-01-17
 */
@RestController
@RequestMapping("/admin/myCollection/")
public class AdminMyCollectionController {
    @Autowired
    private MyCollectionService collectionService;


    @Login
    @GetMapping(value = "getMyCollectionListV2")
    @ApiOperation("获取用户的收藏列表")
    public Result getMyCollectionListV2(Integer page, Integer limit, Long userId, MyCollection collection, PostPush postPush) {
        collection.setUserId(userId);
        return Result.success().put("data", collectionService.getMyCollectionListV2(page, limit, collection, postPush));
    }
    @Login
    @GetMapping(value = "getCompanyCollectionList")
    @ApiOperation("企业获取我的收藏列表")
    public Result getCompanyCollectionList(@RequestAttribute("userId")Long userId, Integer page, Integer limit, MyCollection collection, Resumes resumes) {
        collection.setType(2);
        return Result.success().put("data", collectionService.getCompanyCollectionList(page, limit, collection, resumes,userId));
    }

    @Login
    @GetMapping(value = "getMyCollectionList")
    @ApiOperation("获取用户的收藏列表")
    public Result getMyCollectionList(Integer page, Integer limit, Long userId, MyCollection collection) {
        collection.setUserId(userId);
        return Result.success().put("data", collectionService.getMyCollectionList(page, limit, collection));
    }
}

