Skip to content
Merged
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
Expand Up @@ -24,6 +24,7 @@ public class SecurityConfig {

// Public APIs
"/book-service/api/books/**",
"/book-service/api/book/images/**",
"/book-service/api/authors/**",
"/book-service/api/publishers/**",
"/book-service/api/genres/**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers("/actuator/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/books/**").permitAll()
.requestMatchers("/api/books/**").hasRole("ADMIN")
.requestMatchers(HttpMethod.GET, "/api/book/images/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/authors/**").permitAll()
.requestMatchers("/api/authors/**").hasRole("ADMIN")
.requestMatchers(HttpMethod.GET, "/api/publishers/**").permitAll()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.library.bookservice.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

@Value("${data.book.images.location}")
private String imagesLocation;

@Value("${data.book.images.path}")
private String imagesPath;

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler(imagesPath + "**")
.addResourceLocations("file:" + imagesLocation);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.library.bookservice.datagen;

import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

@Data
public class BookSeedDto {
private String title;
private String isbn;
private String description;
private LocalDate releaseDate;
private BigDecimal price;
private String imageKey;

private String category;
private String publisher;
private String author;
private List<String> genres;
}
Loading