Skip to content

Commit

Permalink
Merge pull request #25 from TravelMate-KU/feat/matching
Browse files Browse the repository at this point in the history
Feat: 봉사자 - requests 요청 수락 API 구현
  • Loading branch information
david-parkk authored Mar 10, 2024
2 parents 393eeb8 + 12ac2a9 commit 6a38938
Show file tree
Hide file tree
Showing 82 changed files with 392 additions and 355 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle
build/
.idea

.DS_Store
Binary file removed .gradle/8.5/checksums/checksums.lock
Binary file not shown.
Binary file removed .gradle/8.5/checksums/md5-checksums.bin
Binary file not shown.
Binary file removed .gradle/8.5/checksums/sha1-checksums.bin
Binary file not shown.
Binary file not shown.
Empty file.
Binary file removed .gradle/8.5/executionHistory/executionHistory.bin
Binary file not shown.
Binary file removed .gradle/8.5/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/8.5/fileChanges/last-build.bin
Binary file not shown.
Binary file removed .gradle/8.5/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed .gradle/8.5/fileHashes/fileHashes.lock
Binary file not shown.
Binary file removed .gradle/8.5/fileHashes/resourceHashesCache.bin
Binary file not shown.
Empty file removed .gradle/8.5/gc.properties
Empty file.
Binary file removed .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 0 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties

This file was deleted.

Binary file removed .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file removed .gradle/file-system.probe
Binary file not shown.
Empty file removed .gradle/vcs-1/gc.properties
Empty file.
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/compiler.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/gradle.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/jarRepositories.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/misc.xml

This file was deleted.

124 changes: 0 additions & 124 deletions .idea/uiDesigner.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 0 additions & 32 deletions build/resources/main/application.yml

This file was deleted.

16 changes: 0 additions & 16 deletions build/resources/main/templates/home.html

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions src/main/java/konkuk/travelmate/controller/RequestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
Expand All @@ -17,6 +19,7 @@
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Slf4j
@Controller
Expand Down Expand Up @@ -71,6 +74,22 @@ public String showRequests(@RequestParam(value = "walk", required = false) Integ
return "volunteer_matching";
}

/**
* 봉사자 -> 장애인 요청 수락
* 매칭 생성
*/
@PostMapping("/requests/{requestId}/matchings")
public String acceptDisabledRequest(@PathVariable Long requestId, @AuthenticationPrincipal OAuth2User user) {

log.info("[RequestController.acceptDisabledRequest]");

String email = Objects.requireNonNull(user.getAttribute("email")).toString();

requestService.acceptDisabledRequest(requestId, email);

return "redirect:/matchings";
}

private boolean isSearchButtonClicked(Integer walk, Integer see, Integer talk, Integer listen, Integer iq, Integer depression, Integer bipolarDisorder) {
return walk != null && see != null && talk != null && listen != null && iq != null && depression != null && bipolarDisorder != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public String gateway(@AuthenticationPrincipal OAuth2User oauth) {
} else if (user.get().getRole() == Role.DISABLED) {
return "redirect:disable";
} else if (user.get().getRole() == Role.VOLUNTEER) {
return "redirect:volunteer";
return "redirect:/requests";
}
return "/error";
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/konkuk/travelmate/domain/Matching.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
@NoArgsConstructor
public class Matching {


@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "m_id")
Expand All @@ -24,4 +23,10 @@ public class Matching {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "r_id")
private Request request;

public Matching(Integer rating, User volunteer, Request request) {
this.rating = rating;
this.volunteer = volunteer;
this.request = request;
}
}
Loading

0 comments on commit 6a38938

Please sign in to comment.