-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into fix/be-540-remove-selected-role
- Loading branch information
Showing
95 changed files
with
2,970 additions
and
929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# ResQ | ||
|
||
ResQ is REST based web service for the Disaster Response Application ResQ developed by CMPE451-GroupA1 | ||
|
||
## Getting Started | ||
|
||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. | ||
|
||
### Prerequisites | ||
|
||
- Docker and Docker-Compose | ||
|
||
### Config Directory Structure | ||
|
||
The backend application gets the actual path from `resq.appdir` property and checks for **resq** directory under that path. | ||
|
||
Under main directory structure is: | ||
- **conf** | ||
- **appparam.txt**: application configuration items are located under this file (web service url, username and pass etc.) | ||
- **logConf.xml**: log configuration file. | ||
- **log**: Application writes all logs under this directory | ||
|
||
### Installing with Docker | ||
|
||
First clone all files into local repo. | ||
|
||
Place the config folder named as project_env under the directory bounswe2023group1\resq\backend\resq. | ||
Then, run the following commands: | ||
|
||
docker-compose up | ||
|
||
## Project Specific Information | ||
|
||
The local buld of the frontend application is available on http://localhost:3000 | ||
|
||
Production frontend URL: https://resq.org.tr | ||
|
||
|
||
Backend application context root is /resq/api/v1/. You can reach the backend application via | ||
https://localhost:8081/resq/api/v1/. | ||
To reach the API documentation: | ||
https://localhost:8081/resq/api/v1/swagger-ui.html | ||
|
||
|
||
Production backend URL: https://api.resq.org.tr/resq/api/v1 | ||
|
||
Production backend API Documentation: | ||
https://api.resq.org.tr/resq/api/v1/swagger-ui/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
resq/backend/resq/src/main/java/com/groupa1/resq/controller/EventController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.groupa1.resq.controller; | ||
|
||
|
||
import com.groupa1.resq.request.CreateEventRequest; | ||
import com.groupa1.resq.service.EventService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import com.groupa1.resq.response.EventResponse; | ||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/event") | ||
public class EventController { | ||
|
||
@Autowired | ||
private EventService eventService; | ||
|
||
@PreAuthorize("hasRole('RESPONDER') or hasRole('COORDINATOR') or hasRole('FACILITATOR') or hasRole('VICTIM')") | ||
@PostMapping("/createEvent") | ||
public ResponseEntity<String> createEvent(@RequestBody CreateEventRequest createEventRequest){ | ||
return eventService.createEvent(createEventRequest); | ||
} | ||
|
||
@PreAuthorize("hasRole('RESPONDER') or hasRole('COORDINATOR') or hasRole('FACILITATOR') or hasRole('VICTIM')") | ||
@GetMapping("/viewEvents") | ||
public ResponseEntity<List<EventResponse>> viewEvents(@RequestParam Long reporterId) { | ||
return eventService.viewEvents( reporterId); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
resq/backend/resq/src/main/java/com/groupa1/resq/dto/EventDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.groupa1.resq.dto; | ||
|
||
|
||
import com.groupa1.resq.entity.User; | ||
import lombok.Data; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDateTime; | ||
|
||
@Data | ||
public class EventDto { | ||
|
||
private Long reporterId; | ||
|
||
private String description; | ||
|
||
private LocalDateTime reportDate; | ||
|
||
private boolean isVerified; | ||
|
||
private BigDecimal eventLatitude; | ||
private BigDecimal eventLongitude; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
resq/backend/resq/src/main/java/com/groupa1/resq/entity/Event.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.groupa1.resq.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDateTime; | ||
|
||
@NoArgsConstructor | ||
@Entity | ||
@Table( name = "EVENT") | ||
@Data | ||
@EqualsAndHashCode(callSuper = true, exclude = {"reporter"}) | ||
@ToString(callSuper = true, exclude = {"reporter"}) | ||
public class Event extends BaseEntity { | ||
|
||
//@Enumerated(EnumType.STRING) | ||
//private EEventType eventType; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "reporter_id") | ||
private User reporter; | ||
|
||
@Column(length = 2048) | ||
private String description; | ||
|
||
private LocalDateTime reportDate; | ||
|
||
private boolean isVerified; | ||
|
||
private BigDecimal eventLatitude; | ||
private BigDecimal eventLongitude; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.