Skip to content

Shuhan Jin #5

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

Shuhan Jin #5

wants to merge 7 commits into from

Conversation

sjin9
Copy link

@sjin9 sjin9 commented Nov 6, 2023

No description provided.

if (pageSize != null && pageIndex != null)
{
var startIndex = (pageIndex - 1) * pageSize;
var companiesPage = companies.Skip((int)startIndex).Take((int)pageSize).ToList();

Choose a reason for hiding this comment

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

WangKe:
Great using of the Linq syntax 👍

//employee.Id = Guid.NewGuid().ToString();
company.Employees.Add(employee);

return Ok(employee);

Choose a reason for hiding this comment

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

As we add new employee here, maybe [return Created(employee)] could be better

@slb-bgc-wk
Copy link

WangKe:
Goods

  1. All test cases passed
  2. Commit messages are short but clear

Improves:
1.[feat(AC2and AC3): obtain company from pageindex and pagesize] is a little misleading as pagination should be accomplished by AC4

Content-Type: application/json; charset=utf-8

Company:

Choose a reason for hiding this comment

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

suggestion: not need this json for company, we find related company by companyID in the URL

### Case1: success, 204 no content
### Case2: 404 Company NOT Found
### Case3: 404 emloyee NOT Found

Choose a reason for hiding this comment

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

to be improved: we also need to design api for AC 8-10

var company = companies.Find(c => c.Id == companyId);
if (company == null)
{
return NotFound();

Choose a reason for hiding this comment

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

well: use 404 if company can not be found👍

if (pageSize != null && pageIndex != null)
{
var startIndex = (pageIndex - 1) * pageSize;
var companiesPage = companies.Skip((int)startIndex).Take((int)pageSize).ToList();

Choose a reason for hiding this comment

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

well: nice to use Skip and Take

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