Skip to content
Merged

Arun #37

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.innovature.Library.controller;

import java.io.IOException;
import java.util.Collection;
import java.util.List;

import javax.validation.Valid;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -23,15 +20,13 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.innovature.Library.entity.Books;
import com.innovature.Library.form.BooksForm;
import com.innovature.Library.repository.BooksRepository;
import com.innovature.Library.service.BooksService;
import com.innovature.Library.util.FileUtil;
import com.innovature.Library.view.BooksDetailView;


@RestController
@RequestMapping("/books")
public class BooksController {
Expand All @@ -42,8 +37,6 @@ public class BooksController {
@Autowired
private BooksRepository booksRepository;



@PostMapping
public BooksDetailView add(@Valid @RequestBody BooksForm form) {
return service.add(form);
Expand All @@ -60,7 +53,6 @@ public Collection<Books> listByCategory(
{
return service.listByCategory(categoryId);
}


@GetMapping("/{booksId}")
public BooksDetailView list(
Expand All @@ -70,7 +62,6 @@ public BooksDetailView list(
return service.list(booksId);
}


@DeleteMapping("/{booksId}")
public void deletes(
@PathVariable("booksId") Integer booksId) {
Expand All @@ -85,8 +76,6 @@ public BooksDetailView update(
return service.updates(booksId, form);
}



@GetMapping("admin/pagenated/")
public ResponseEntity<Page<Books>>getAllBooks(
@RequestParam(defaultValue = "1") Integer pageNo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



import org.supercsv.io.CsvBeanWriter;
import org.supercsv.io.ICsvBeanWriter;
import org.supercsv.prefs.CsvPreference;


import com.innovature.Library.entity.Borrow;
import com.innovature.Library.form.BorrowForm;
import com.innovature.Library.service.BorrowService;
Expand Down Expand Up @@ -104,13 +99,8 @@ public Collection<Borrow> list() {

}






//load results of issuedate filter at User BorrowHistory
@GetMapping("user/loadByIssueDate/{date1}/{date2}")
@GetMapping("/user/loadByIssueDate/{date1}/{date2}")
public ResponseEntity<List<Borrow>> loadByIssueDateUser(
@PathVariable("date1") Date date1,
@PathVariable("date2") Date date2)
Expand All @@ -134,11 +124,6 @@ public ResponseEntity<List<Borrow>> loadByIssueDateUser(
HttpStatus.OK);

}





@PostMapping
public BorrowDetailView add(@Valid @RequestBody BorrowForm form) {
return bService.add(form);
Expand All @@ -158,7 +143,6 @@ public Collection<Borrow> listUserNotification(Principal p) {
return bService.listNotification();
}



@GetMapping("user/due")
public Collection<Borrow> listDue() {
Expand Down
114 changes: 2 additions & 112 deletions BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ private Status(byte value) {
private String booksName;
private String publication;
private String auther;
// private String status;
private Integer booksCopies;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
private Category category;
Expand All @@ -45,14 +44,13 @@ public Books(Integer booksId){
this.booksId=booksId;
}


public Books(BooksForm form,Category category){
this.booksName=form.getBooksName();
this.publication= form.getPublication();
this.auther = form.getAuther();
this.booksCopies= form.getBooksCopies();
this.category = category;
//this.categoryName = new Category(Category);

}


Expand All @@ -63,8 +61,6 @@ public String getPhotosImagePath() {
return "/items - photos/" + booksId + image;
}



public Integer getBooksId() {
return booksId;
}
Expand Down Expand Up @@ -113,8 +109,6 @@ public void setCategory(Category category) {
this.category = category;
}



public String getImage() {
return image;
}
Expand All @@ -131,114 +125,10 @@ public Books(int booksId, String booksName,String publication,String auther,Stri
this.booksName = booksName;
this.publication = publication;
this.auther = auther;
//this.status = status;

this.booksCopies = booksCopies;
this.category = category;
}




















// public Integer getBooksId() {
// return booksId;
// }
// public void setBooks(Integer booksId) {
// this.booksId = booksId;
// }


// ////////////category//////////////////




// // public String getCategoryName() {
// // return categoryName;
// // }

// //////////////////////////////////



// public String getBooksName() {
// return booksName;
// }

// public void setBooksId(Integer booksId) {
// this.booksId = booksId;
// }

// public Category getCategory() {
// return category;
// }

// public void setCategory(Category category) {
// this.category = category;
// }

// public void setBooksName(String booksName) {
// this.booksName = booksName;
// }

// public String getPublication() {
// return publication;
// }

// public void setPublication(String publication) {
// this.publication = publication;
// }

// public String getAuther() {
// return auther;
// }

// public void setAuther(String auther) {
// this.auther = auther;
// }
// // public String getStatus() {
// // return status;
// // }

// // public void setStatus(String status) {
// // this.status = status;
// // }
// public String getBooksCopies() {
// return booksCopies;
// }

// public void setBooksCopies(String bookscopies) {
// this.booksCopies = bookscopies;
// }

// public String getBooksName(int booksId2) {
// return null;
// }












}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
public interface BooksService {

BooksDetailView add(BooksForm form);

// Collection<BooksListView> listAll();

// BooksDetailView listAll();

Collection<Books> listAll();

Collection<Books> listByCategory(Integer categoryId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public interface UserService {

LoginView refresh(String refreshToken) throws BadRequestException;

// Collection<User> list();

// UserView edit(UserForm form);

UserView updates(Integer userId, UserForm form);

void deletes(Integer userId);
Expand All @@ -48,12 +44,10 @@ public interface UserService {

Collection<User> listAll();

// Collection<User> list();

UserView edit(Integer userId, UserForm form);

Collection<User> viewProfile(Integer userId);

Page<User> getAllUser(Integer pageNo, Integer pageSize, String sortBy,Integer direction);
Page<User> getAllUser(Integer pageNo, Integer pageSize, String sortBy, Integer direction);

}
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ public BorrowDetailView updatereject(Integer borrowId, BorrowForm form) {
@Override
@Transactional
public BorrowDetailView updateReturn(Integer borrowId, BorrowForm form) {

Borrow borrow = borrowRepository.findByBorrowId(borrowId);
Books books = booksRepository.findbyBorrowId(borrowId);

borrow.setBookReturnedDate(LocalDateTime.now());
borrow.setIssueDate(borrow.getIssueDate());
borrow.setReturnDate(borrow.getReturnDate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import java.util.Collection;
import javax.transaction.Transactional;
//import javax.validation.Valid;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
Expand All @@ -19,7 +18,6 @@
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.validation.Errors;

import com.innovature.Library.entity.User;
import com.innovature.Library.exception.BadRequestException;
import com.innovature.Library.exception.NotFoundException;
Expand All @@ -30,8 +28,6 @@
import com.innovature.Library.security.util.InvalidTokenException;
import com.innovature.Library.security.util.SecurityUtil;
import com.innovature.Library.security.util.TokenExpiredException;


import com.innovature.Library.security.util.TokenGenerator;
import com.innovature.Library.security.util.TokenGenerator.Status;
import com.innovature.Library.security.util.TokenGenerator.Token;
Expand Down
Loading