Skip to content

Commit

Permalink
#281 Implemented Dockerfile and deployed the backend on render.com.
Browse files Browse the repository at this point in the history
  • Loading branch information
alitpc25 committed Oct 29, 2023
1 parent f19e675 commit ea21738
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 9 deletions.
6 changes: 6 additions & 0 deletions resq/backend/resq/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM openjdk:17-jdk
WORKDIR /app
COPY target/resq-0.0.1-SNAPSHOT.jar /app/app.jar
COPY target/project_env /app/config
ENV resq.appdir=/app/config
ENTRYPOINT ["java","-jar","/app/app.jar"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.groupa1.resq.config;

import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springdoc.core.customizers.OperationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {
@Bean
public OperationCustomizer customGlobalHeaders() {
return (operation, handlerMethod) -> {

// Add role to all endpoints
Parameter missingParam2 = new Parameter().in(ParameterIn.HEADER.toString())
.name("X-Selected-Role")
.schema(new StringSchema())
.description("ROLE");

operation.addParametersItem(missingParam2);

return operation;
};
}

@Bean
public OpenAPI customizeOpenAPI() {
final String securitySchemeName = "bearerAuth";
// Add JWT token to all endpoints
return new OpenAPI()
.addSecurityItem(new SecurityRequirement()
.addList(securitySchemeName))
.components(new Components()
.addSecuritySchemes(securitySchemeName, new SecurityScheme()
.name(securitySchemeName)
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")));
}
}

Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
package com.groupa1.resq.request;


import com.fasterxml.jackson.annotation.JsonInclude;
import com.groupa1.resq.entity.enums.EGender;
import com.groupa1.resq.entity.enums.EStatus;
import com.groupa1.resq.entity.enums.EUrgency;
import lombok.Data;

import javax.annotation.Nullable;

import java.math.BigDecimal;
import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class CreateTaskRequest {
private Long assignerId;

@Nullable
private Long assigneeId;
private String description;

@Nullable
private List<Action> actions;

@Nullable
private List<Resource> resources;
private EUrgency urgency;
private EStatus status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth ->
auth.requestMatchers("/auth/**").permitAll()
.requestMatchers("/test/**").permitAll()
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll()
.anyRequest().authenticated()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class NeedService {

@Autowired
NeedRepository needRepository;

@Autowired
UserRepository userRepository;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class RequestService {

@Autowired
RequestRepository requestRepository;

@Autowired
UserRepository userRepository;

public List<Request> viewRequestsByUser(Long userId) {
Expand Down

0 comments on commit ea21738

Please sign in to comment.