Skip to content

Added Employee detail component, Request component integration with employee and request services, styling, and refactoring #13

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

Merged
merged 13 commits into from
Oct 8, 2018
Merged
15 changes: 14 additions & 1 deletion src/main/java/com/sba6/srm/controller/RequestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -55,7 +56,19 @@ public List<Request> getRequestsForManager(@PathVariable Long mgrId){
}

//2. Update Request Status PUT/request/{reqId}
@RequestMapping(value="/api/request", method=RequestMethod.PUT)
// @RequestMapping(value="/api/request", method=RequestMethod.PUT)
Copy link
Owner

Choose a reason for hiding this comment

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

Removed commented out code unless you need it.

// public ResponseEntity updateRequestStatus(@RequestBody Request updateRequest){
// Request req = requestService.getRequestById(updateRequest.getId());
// req.setRequestStatus(updateRequest.getRequestStatus());
// if(updateRequest.getComment()!=null && updateRequest.getComment()!="")
// {
// req.setRequestDescription(updateRequest.getComment());
// }
// requestService.updateRequest(req);
// return new ResponseEntity(HttpStatus.OK);
// }

@RequestMapping(value="/api/request", method=RequestMethod.PUT,produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateRequestStatus(@RequestBody Request updateRequest){
Request req = requestService.getRequestById(updateRequest.getId());
req.setRequestStatus(updateRequest.getRequestStatus());
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/sba6/srm/entity/Employee.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import lombok.*;

@Entity
@Table(name="employee")
@JsonIgnoreProperties
public @Data class Employee {

@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/sba6/srm/entity/LoginDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.sba6.srm.enumsconstants.LoginDetailRole;

Expand All @@ -21,6 +22,7 @@
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
@Entity
@JsonIgnoreProperties
@Table(name="login_detail")
public @Data class LoginDetail {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<app-employee-detail></app-employee-detail>
<mat-divider></mat-divider>
<nav mat-tab-nav-bar>
<nav mat-tab-nav-bar color="primary" backgroundColor="primary">
<a mat-tab-link
*ngFor="let link of navLinks"
[routerLink]="link.path"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export class ManagerDashboardComponent implements OnInit {
if(result){
console.log(this.comment);
request.requestStatus=action;
//this.requestService.updateRequest(request.id,request.requestStatus,this.comment);
this.requestService.updateRequest(request).subscribe();

}
});
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/web-app/src/app/services/request.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ export class RequestService{
// request.requestStatus=reqStatus;
// if(reqComment!=null)
// request.requestDescription = reqComment;
return this.http.put<RequestData>(this.requestUrl,request)
.pipe(
tap(result=>console.log("inside updateRequest"+result)),
return this.http.put<RequestData>(this.requestUrl,request,httpOptions).
pipe(
catchError(this.handleError('updateRequest', request))
);
}
Expand Down