Skip to content

kailin parking lot api #2

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 11 commits into
base: main
Choose a base branch
from

Conversation

lklgithub
Copy link

No description provided.


if (pageIndex < 0)
{
throw new PageInfoInvalidException();
Copy link

Choose a reason for hiding this comment

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

good:throw exception in service

@sjin9
Copy link

sjin9 commented Nov 9, 2023

well:

  • baby step commit
  • meet all ACs
  • 3 layer-archticture

@sjin9
Copy link

sjin9 commented Nov 9, 2023

To be improved:

  • AC1: name should be unique
  • AC5: should only increase capacity

[HttpPost]
public async Task<ActionResult<ParkingLotDto>> CreateParkingLotAsync([FromBody] ParkingLotDto parkingLotDto)
{
//try

Choose a reason for hiding this comment

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

suggestion: remove dead code

@@ -0,0 +1,6 @@
namespace ParkingLotApi.Exceptions

Choose a reason for hiding this comment

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

well: nice to define customized exception


namespace ParkingLotApi.Filters
{
public class PageInfoInvalidExceptionFilter : IActionFilter, IOrderedFilter

Choose a reason for hiding this comment

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

well: nice to add more than one exception filter

{
public class PageInfoInvalidExceptionFilter : IActionFilter, IOrderedFilter
{
int IOrderedFilter.Order => int.MaxValue - 10;

Choose a reason for hiding this comment

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

suggestion: this value might need to be different for each filter

public Task<ParkingLot> GetParkingLotById(string id);
public Task DeleteParkingLotById(string id);
public Task<List<ParkingLot>> GetParkingLotByPageInfo(int pageIndex, int pageSize);
public Task<List<ParkingLot>> GetAllParkingLot();

Choose a reason for hiding this comment

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

suggestion: there is no requirement for getting all data


public async Task<List<ParkingLot>> GetParkingLotByPageInfo(int pageIndex)
{
int pageSize = 15;

Choose a reason for hiding this comment

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

suggestion: this variable can be extracted as constant

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