Skip to content

Commit

Permalink
Prepare a final release
Browse files Browse the repository at this point in the history
  • Loading branch information
wysockif committed Jun 6, 2021
1 parent 1075f14 commit 81a130d
Show file tree
Hide file tree
Showing 21 changed files with 610 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.cors.CorsConfiguration;

import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.HttpMethod.PATCH;
Expand Down Expand Up @@ -48,6 +47,7 @@ protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers(POST, API_URL + "/login").authenticated()
.antMatchers(PATCH, API_URL + "/users/{id:[0-9]+}").authenticated()
.antMatchers(PATCH, API_URL + "/users/{id:[0-9]+}/password").authenticated()
.antMatchers(DELETE, API_URL + "/users/{id:[0-9]+}").authenticated()
.antMatchers(POST, API_URL + "/notices").authenticated()
.antMatchers(DELETE, API_URL + "/notices/{id:[0-9]+}").authenticated()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package pl.wysockif.noticeboard.constraints.user.username;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

@Constraint(validatedBy = UniqueUsernameValidator.class)
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
Expand All @@ -18,5 +17,5 @@
Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
public class ChangePasswordRequest {

@NotNull
@Size(min = 8, max = 60)
private String oldPassword;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
public class DeleteAccountRequest {

@NotNull
@Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*$",
message = "{noticeboard.constraints.Pattern.Password.message}")
private String password;

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class Notice implements Serializable {

private BigDecimal price;

@Column(length = 360)
private String keywords;

@ManyToOne
@JoinColumn(name = "creator_id")
private AppUser creator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.springframework.web.bind.annotation.ResponseStatus;

import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.UNAUTHORIZED;

@ResponseStatus(BAD_REQUEST)
public class SameNewPasswordException extends RuntimeException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import pl.wysockif.noticeboard.params.GettingNoticesParams;
import pl.wysockif.noticeboard.dto.notice.requests.PostNoticeRequest;
import pl.wysockif.noticeboard.dto.notice.requests.PutNoticeRequest;
import pl.wysockif.noticeboard.dto.notice.snapshots.NoticeSnapshot;
Expand All @@ -14,6 +13,7 @@
import pl.wysockif.noticeboard.errors.notice.NoPermissionException;
import pl.wysockif.noticeboard.errors.notice.NoticeNotFoundException;
import pl.wysockif.noticeboard.mappers.notice.NoticeMapper;
import pl.wysockif.noticeboard.params.GettingNoticesParams;
import pl.wysockif.noticeboard.repositories.notice.NoticeRepository;
import pl.wysockif.noticeboard.services.file.StaticFileService;

Expand Down Expand Up @@ -143,7 +143,7 @@ private Page<Notice> getNoticePage(Pageable pageable, GettingNoticesParams getti
noticePage = noticeRepository.findAllByCreatorUsername(pageable, username);
} else {
BigDecimal minPriceValue = minPriceParam == null ? new BigDecimal("0") : new BigDecimal(minPriceParam);
BigDecimal maxPriceValue = maxPriceParam == null ? new BigDecimal("100000000") : new BigDecimal(maxPriceParam);
BigDecimal maxPriceValue = maxPriceParam == null ? new BigDecimal("10000000000") : new BigDecimal(maxPriceParam);
noticePage = getNoticeFilteredPage(pageable, searched, location, minPriceValue, maxPriceValue);
}
return noticePage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class AppUserService {


public AppUserService(AppUserRepository userRepository, PasswordEncoder passwordEncoder, StaticFileService staticFileService,
NoticeService noticeService) {
NoticeService noticeService) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
this.staticFileService = staticFileService;
Expand Down
Loading

0 comments on commit 81a130d

Please sign in to comment.