Skip to content
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

Review Backend - Sunny #3

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Review Backend - Sunny #3

wants to merge 6 commits into from

Conversation

sunnytulakorn
Copy link
Collaborator

@sunnytulakorn sunnytulakorn commented Apr 28, 2023

Data

-> In the Candidate table have data CandidateId, FirstName, LastName, Email, PhoneNumber, Rating, Position, Gender, Attitude, Experience, Skills, Personality, cInputDate and cAppointment

-> In the Commentinfo table have CommentId, cComment, cCommentDate, CandidateId

-> In the User table have Id, Name, UserName, Password

Schemas

  • Candidate
  • Commentinfo
  • User

Controller

-> CandidateController have Method

  • [Post] api/Candidate : to Create Candidate
  • [Get] api/Candidate : to get data from Candidate table
  • [Put] api/Candidate/{id} : to update Candidate data
  • [Delete] api/Candidate/{id} : to delete Candidate data

-> CommentController have Method

  • [Post] api/Comment : to Create candidate comment
  • [Get] api/Comment/get/{CandidateId} : to get data from commentinfo table by CandidateId

-> User have Method

  • [Post] /register : to Register
  • [Post] /login : to Login

Services/Interfaces

-> CandidateServices connect with ICandidateServices
-> CommentServices connect with ICommentServices
-> UserService connect with IUserService

[HttpGet]
public async Task<ActionResult<IEnumerable<Candidate>>> GetAllCandidate()
{
var a = await _candidateService.GetAllCandidate();

Choose a reason for hiding this comment

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

rename a to candidates

_commentService = commentService;
}

[HttpGet("get/{CandidateId}")]

Choose a reason for hiding this comment

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

rename CandidateId to camel case

}

#region table
public DbSet<Candidate> Candidate { get; set; }

Choose a reason for hiding this comment

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

change to plural word for data list variable

public string Experience { get; set; }
public string Skills { get; set; }
public string Personality { get; set; }
public string cInputDate { get; set; }

Choose a reason for hiding this comment

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

rename to Pascal case

public int CommentId { get; set; }
public string cComment { get; set; }

public string cCommentDate { get; set; }

Choose a reason for hiding this comment

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

Pascal case

{
[Key]
public int CommentId { get; set; }
public string cComment { get; set; }

Choose a reason for hiding this comment

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

Pascal case and rename to more details or add the comment


namespace ToDoAPI.Data
{
public class Commentinfo

Choose a reason for hiding this comment

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

CommentInfo


public DbSet<User> Users { get; set; }

public DbSet<Commentinfo> Commentinfo { get; set; }

Choose a reason for hiding this comment

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

rename to CommentInfos

public string Password { get; set; }
}

public class LoginResponse

Choose a reason for hiding this comment

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

create new folder to separate Model and Contract class

{
//return await _context.Candidate.Where(ci => ci.CandidateId == CandidateId).ToListAsync();

var candidates = await _context.Commentinfo.Where(c => c.CandidateId == CandidateId).ToListAsync();

Choose a reason for hiding this comment

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

rename to more related to variable

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.

2 participants