Skip to content

upload parking lot controller implement #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

LucasCyw
Copy link

@LucasCyw LucasCyw commented Nov 8, 2023

No description provided.

Copy link

@JCLTW JCLTW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一些反馈

@@ -0,0 +1,26 @@
URL: parkinglots
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

很好,将API文档单独编写,虽然没写全

{
[ApiController]
[Route("[controller]")]
public class ParkingLotController : ControllerBase
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

少了一个S

}

[HttpGet]
public async Task<ActionResult<List<ParkingLot>>> GetPartialAsync(int? pageSize = 10, int? pageIndex = 0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageSize 需求为固定值,此处可以定义常量复用

}

[HttpPatch("{id}")]
public async Task<ActionResult<ParkingLot>> UpdatebyIdAsync(string id, [FromBody] JsonPatchDocument<ParkingLotDto> patchDoc)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

给同学介绍一下这个文档的使用

public partial class Program { }

public static class MyJPIF
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

介绍一下如何使用


public async Task<ParkingLot> AddAsync(ParkingLotDto data)
{
if (data.Capacity < 10)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

定义常量


public async Task<ParkingLot> UpdateByIdAsync(string id, ParkingLotDto parkingLotDto)
{
if (parkingLotDto.Capacity < 10) throw new InvalidCapacityException();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

定义常量


public async Task<List<ParkingLot>> GetParkingLotPartial(int pageSize, int pageIndex)
{
var parkingLots = _parkingLotCollection.Find(_ => true).ToList();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

性能可能有潜在问题,内存中分页不如,请求过滤

Copy link

@XDL27 XDL27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well:

  1. baby step commit
  2. name uniqueness check added
  3. use Patch update information
  4. Input check convers

capacity: 10,
location: "hh"
}
"""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well: Api Doc included

{
if (data.Capacity < 10) throw new InvalidCapacityException();

var checkName = _parkingLotRepository.GetParkingLotByName(data.Name);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well: name checked


public async Task<ParkingLot> UpdateByIdAsync(string id, ParkingLotDto parkingLotDto)
{
if (parkingLotDto.Capacity != 0 && parkingLotDto.Capacity < 10) throw new InvalidCapacityException();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well: capacity input checked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants