package com.upsfj.sfjprojectbackend.controller;


import com.upsfj.sfjprojectbackend.entity.Algorithm;
import com.upsfj.sfjprojectbackend.entity.Field;
import com.upsfj.sfjprojectbackend.service.impl.FieldServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/field")
public class FieldController {
    @Resource
    FieldServiceImpl fieldService;

    @PostMapping("/addField")
    public void addField(@RequestBody Field field){
        fieldService.addField(field.getField_name());
    }

    @PostMapping("/updateField")
    public void updateField(@RequestBody Field field){
        fieldService.updateField(field);
    }

    @PostMapping("/deleteField")
    public void deleteField(@RequestBody Field field){
        fieldService.deleteField(field);
    }
}
