-
Notifications
You must be signed in to change notification settings - Fork 2
/
GroupParticipationController.java
47 lines (39 loc) · 1.78 KB
/
GroupParticipationController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.amorgakco.backend.groupparticipation.controller;
import com.amorgakco.backend.global.argumentresolver.AuthMember;
import com.amorgakco.backend.groupparticipation.service.GroupParticipationService;
import com.amorgakco.backend.member.domain.Member;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@RequestMapping("/groups")
public class GroupParticipationController {
private final GroupParticipationService groupParticipationService;
@PostMapping("/{groupId}/participation")
@ResponseStatus(HttpStatus.CREATED)
public void participate(@PathVariable final Long groupId, @AuthMember final Member member) {
groupParticipationService.participate(groupId, member);
}
@PostMapping("/{groupId}/participation/{memberId}")
@ResponseStatus(HttpStatus.CREATED)
public void approve(
@PathVariable final Long groupId,
@PathVariable final Long memberId,
@AuthMember final Member host) {
groupParticipationService.approve(groupId, memberId, host);
}
@PatchMapping("/{groupId}/participation/{memberId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void reject(
@PathVariable final Long groupId,
@PathVariable final Long memberId,
@AuthMember final Member host) {
groupParticipationService.reject(groupId, memberId, host);
}
}