-
Notifications
You must be signed in to change notification settings - Fork 0
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
Payam #1
Open
payamrastogi
wants to merge
3
commits into
master
Choose a base branch
from
payam
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Payam #1
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/coddicted/school/student/model/Address.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class Address | ||
{ | ||
private AddressType type; | ||
private String address1; | ||
private String address2; | ||
private String city; | ||
private String state; | ||
private String country; | ||
private String zip; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/coddicted/school/student/model/AddressType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
public enum AddressType | ||
{ | ||
HOME("Home"), | ||
BUSINESS("Business"), | ||
MAILING("Mailing"), | ||
SCHOOL("School"); | ||
|
||
private String name; | ||
|
||
AddressType(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public String toString() | ||
{ | ||
return this.name; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/coddicted/school/student/model/Email.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class Email | ||
{ | ||
private EmailType type; | ||
private String value; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/coddicted/school/student/model/EmailType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
public enum EmailType | ||
{ | ||
HOME("Home"), | ||
WORK("Work"), | ||
SCHOOL("School"), | ||
OTHER("Other"), | ||
CUSTOM("Custom"); | ||
|
||
private String name; | ||
|
||
EmailType(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public String toString() | ||
{ | ||
return this.name; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/coddicted/school/student/model/Gender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
public enum Gender | ||
{ | ||
MALE("Male"), | ||
FEMALE("Female"), | ||
OTHER("Other"); | ||
|
||
private String name; | ||
|
||
Gender(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return this.name; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/coddicted/school/student/model/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public interface Person | ||
{ | ||
String getAadharNumber(); | ||
void setAadharNumber(String aadharNumber); | ||
|
||
Gender getGender(); | ||
void setGender(Gender gender); | ||
|
||
String getFirstName(); | ||
void setFirstName(String firstName); | ||
|
||
String getMiddleName(); | ||
void setMiddleName(String middleName); | ||
|
||
String getLastName(); | ||
void setLastName(String lastName); | ||
|
||
LocalDate getDateOfBirth(); | ||
void setDateOfBirth(LocalDate dateOfBirth); | ||
|
||
List<Email> getEmailList(); | ||
void setEmailList(List<Email> emailList); | ||
|
||
List<Phone> getPhoneList(); | ||
void setPhoneList(List<Phone> phoneList); | ||
|
||
List<Address> getAddressList(); | ||
void setAddressList(List<Address> addressList); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/coddicted/school/student/model/Phone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class Phone | ||
{ | ||
private PhoneType type; | ||
private String value; | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/coddicted/school/student/model/PhoneType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.coddicted.school.student.model; | ||
|
||
public enum PhoneType | ||
{ | ||
HOME("Home"), | ||
WORK("Work"), | ||
MAIN("Main"), | ||
WORK_FAX("Work Fax"), | ||
HOME_FAX("Home Fax"), | ||
PAGER("Pager"), | ||
OTHER("Other"), | ||
CUSTOM("Custom"), | ||
MOBILE("Mobile"); | ||
|
||
|
||
private String name; | ||
|
||
PhoneType(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public String toString() | ||
{ | ||
return this.name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,25 +9,44 @@ | |
import io.swagger.annotations.ApiModelProperty; | ||
import io.swagger.models.Swagger; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Entity // This tells Hibernate to make a table out of this class | ||
@Data | ||
public class Student { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
@ApiModelProperty(notes = SwaggerConstant.AUTO_GENERATED_STUDENT_ID) | ||
private Integer id; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this ID field removed? This is also causing compilation error. |
||
@Getter | ||
@Setter | ||
public class Student implements Person | ||
{ | ||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_AADHAR_NUMBER) | ||
private String aadharNumber; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_FIRST_NAME) | ||
private String firstName; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_MIDDLE_NAME) | ||
private String middleName; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_LAST_NAME) | ||
private String lastName; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_REGISTRATION_NUMBER) | ||
private String studentRegistrationNumber; | ||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_GENDER) | ||
private Gender gender; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_DATE_OF_BIRTH) | ||
private LocalDate dateOfBirth; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_PHONE_LIST) | ||
private List<Phone> phoneList; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_EMAIL_LIST) | ||
private List<Email> emailList; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_ADDRESS_LIST) | ||
private List<Address> addressList; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_RELIGION) | ||
private String religion; | ||
|
@@ -39,23 +58,12 @@ public class Student { | |
private String category; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_FATHER_NAME) | ||
private String fatherName; | ||
private Person father; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_MOTHER_NAME) | ||
private String motherName; | ||
private Person mother; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_GUARDIAN_NAME) | ||
private String guardianName; | ||
|
||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_AADHAR_NUMBER) | ||
private String aadharNumber; | ||
// Various date fields | ||
// TODO Need to check the data type for them | ||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_DATE_OF_BIRTH) | ||
private LocalDate dateOfBirth; | ||
private Person guardianName; | ||
|
||
// TODO Need to check placement of below field. Should it be placed in some other class? | ||
// this is because the date would change on class promotion/ school change. | ||
@ApiModelProperty(notes = SwaggerConstant.STUDENT_DATE_OF_ADMISSION) | ||
private LocalDate dateOfAdmission; | ||
} |
21 changes: 15 additions & 6 deletions
21
src/main/java/com/coddicted/school/student/repository/StudentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
package com.coddicted.school.student.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import com.coddicted.school.student.model.Student; | ||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
|
||
// This will be AUTO IMPLEMENTED by Spring into a Bean called StudentRepository | ||
// CRUD refers Create, Read, Update, Delete | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public interface StudentRepository extends JpaRepository<Student, Integer> | ||
public interface StudentRepository extends MongoRepository<Student, String> | ||
{ | ||
List<Student> findAll(); | ||
List<Student> findAllByFirstName(String firstName); | ||
List<Student> findAllByLastName(String lastName); | ||
List<Student> findAllByMiddleName(String middleName); | ||
List<Student> findAllByFirstNameAndLastName(String firstName, String lastName); | ||
List<Student> findAllByFirstNameAndMiddleNameAndLastName(String firstName, String middleName, String lastName); | ||
List<Student> findAllByDateOfBirth(LocalDate dateOfBirth); | ||
List<Student> findAllByCaste(String caste); | ||
List<Student> findAllByCategory(String category); | ||
List<Student> findAllByReligion(String religion); | ||
|
||
Student findByAadharNumber(String aadharNumber); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't have a field for student's class?