-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
性能可能有潜在问题,内存中分页不如,请求过滤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well:
- baby step commit
- name uniqueness check added
- use Patch update information
- Input check convers
capacity: 10, | ||
location: "hh" | ||
} | ||
""" |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well: capacity input checked
No description provided.