-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvitationCommandAdapter.java
39 lines (31 loc) · 1.34 KB
/
InvitationCommandAdapter.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
package treehouse.server.api.invitation.implement;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import treehouse.server.api.invitation.persistence.InvitationRepository;
import treehouse.server.global.annotations.Adapter;
import treehouse.server.global.entity.Invitation.Invitation;
import treehouse.server.global.entity.Invitation.InvitationStatus;
import treehouse.server.global.entity.User.User;
import treehouse.server.global.entity.User.UserRole;
import treehouse.server.global.entity.redis.RefreshToken;
import treehouse.server.global.redis.service.RedisService;
import treehouse.server.global.security.jwt.dto.TokenDTO;
import treehouse.server.global.security.provider.TokenProvider;
import java.util.List;
@Adapter
@Slf4j
@RequiredArgsConstructor
public class InvitationCommandAdapter {
private final InvitationRepository invitationRepository;
public Invitation saveInvitation(Invitation invitation){
return invitationRepository.save(invitation);
}
public void deleteInvitation(Invitation invitation){
invitationRepository.delete(invitation);
}
public void acceptInvitation(Invitation invitation) {
invitation.setStatus(InvitationStatus.ACCEPTED);
invitationRepository.save(invitation);
}
}