package com.playlet.web.controller.app;

import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PublicStarRecord;
import com.playlet.web.service.app.PublicStarRecordAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Api(tags = "公众号*用户点赞记录")
@RestController
@RequestMapping(value = "/app/public/star")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PublicStarRecordAppController {

    private final PublicStarRecordAppService publicStarRecordAppService;

    @ResponseBody
    @PostMapping("/add")
    @ApiOperation(value = "新增用户点赞记录")
    public Result<String> addRecord(@RequestBody PublicStarRecord publicStarRecord) {
        publicStarRecordAppService.addRecord(publicStarRecord);
        return Result.success();
    }

    @ResponseBody
    @PostMapping("/query")
    @ApiOperation(value = "查询用户点赞记录")
    public Result<PublicStarRecord> queryRecord(@RequestBody PublicStarRecord publicStarRecord) {
        return Result.success(publicStarRecordAppService.queryRecord(publicStarRecord));
    }

    @ResponseBody
    @PostMapping("/delete")
    @ApiOperation(value = "删除用户点赞记录")
    public Result<String> deleteRecord(@RequestBody PublicStarRecord publicStarRecord) {
        publicStarRecordAppService.deleteRecord(publicStarRecord);
        return Result.success();
    }

}
