Skip to content

Commit

Permalink
fix: conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
yhames committed Aug 14, 2024
2 parents 6afa0e8 + 362e142 commit 8e1e2fe
Show file tree
Hide file tree
Showing 57 changed files with 989 additions and 193 deletions.
3 changes: 3 additions & 0 deletions gg-admin-repo/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ info:
image:
defaultUrl: 'https://42gg-public-test-image.s3.ap-northeast-2.amazonaws.com/images/small_default.jpeg'
itemNotFoundUrl: 'https://42gg-public-test-image.s3.ap-northeast-2.amazonaws.com/images/not_found.svg'
web:
coalitionUrl: 'https://api.intra.42.fr/v2/users/{id}/coalitions'
pointHistoryUrl: 'https://api.intra.42.fr/v2/users/{id}/correction_point_historics?sort=-id'

constant:
allowedMinimalStartDays: 2
Expand Down
3 changes: 3 additions & 0 deletions gg-agenda-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ dependencies {
/* StringUtils */
implementation 'org.apache.commons:commons-lang3:3.12.0'

implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testImplementation testFixtures(project(':gg-utils'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import gg.agenda.api.admin.agenda.controller.request.AgendaAdminUpdateReqDto;
import gg.agenda.api.admin.agenda.controller.response.AgendaAdminResDto;
import gg.agenda.api.admin.agenda.controller.response.AgendaAdminSimpleResDto;
import gg.agenda.api.admin.agenda.service.AgendaAdminService;
import gg.utils.dto.PageRequestDto;
import gg.utils.exception.custom.InvalidParameterException;
Expand All @@ -41,7 +41,7 @@ public class AgendaAdminController {

@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Agenda 요청 리스트 조회 성공")})
@GetMapping("/request/list")
public ResponseEntity<List<AgendaAdminResDto>> agendaList(@RequestBody @Valid PageRequestDto pageDto) {
public ResponseEntity<List<AgendaAdminResDto>> agendaList(@ModelAttribute @Valid PageRequestDto pageDto) {
int page = pageDto.getPage();
int size = pageDto.getSize();
Pageable pageable = PageRequest.of(page - 1, size, Sort.by("id").descending());
Expand All @@ -51,6 +51,12 @@ public ResponseEntity<List<AgendaAdminResDto>> agendaList(@RequestBody @Valid Pa
return ResponseEntity.ok(agendaDtos);
}

@GetMapping("/list")
public ResponseEntity<List<AgendaAdminSimpleResDto>> agendaSimpleList() {
List<AgendaAdminSimpleResDto> agendas = agendaAdminService.getAgendaSimpleList();
return ResponseEntity.status(HttpStatus.OK).body(agendas);
}

@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Agenda 수정 성공"),
@ApiResponse(responseCode = "400", description = "Agenda 수정 요청이 잘못됨"),
@ApiResponse(responseCode = "404", description = "Agenda를 찾을 수 없음"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package gg.agenda.api.admin.agenda.controller.response;

import java.net.URL;
import java.util.UUID;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

import gg.data.agenda.Agenda;
Expand All @@ -18,6 +22,8 @@ public class AgendaAdminResDto {

private Long agendaId;

private UUID agendaKey;

private String agendaTitle;

private String agendaDeadLine;
Expand All @@ -42,11 +48,15 @@ public class AgendaAdminResDto {

private AgendaStatus agendaStatus;

private String agendaPosterUrl;

@Builder
public AgendaAdminResDto(Long agendaId, String agendaTitle, String agendaDeadLine, String agendaStartTime,
String agendaEndTime, int agendaCurrentTeam, int agendaMaxTeam, int agendaMinPeople, int agendaMaxPeople,
Location agendaLocation, Boolean isRanking, Boolean isOfficial, AgendaStatus agendaStatus) {
public AgendaAdminResDto(Long agendaId, UUID agendaKey, String agendaTitle, String agendaDeadLine,
String agendaStartTime, String agendaEndTime, int agendaCurrentTeam, int agendaMaxTeam, int agendaMinPeople,
int agendaMaxPeople, Location agendaLocation, Boolean isRanking, Boolean isOfficial,
AgendaStatus agendaStatus, String agendaPosterUrl) {
this.agendaId = agendaId;
this.agendaKey = agendaKey;
this.agendaTitle = agendaTitle;
this.agendaDeadLine = agendaDeadLine;
this.agendaStartTime = agendaStartTime;
Expand All @@ -59,6 +69,7 @@ public AgendaAdminResDto(Long agendaId, String agendaTitle, String agendaDeadLin
this.isRanking = isRanking;
this.isOfficial = isOfficial;
this.agendaStatus = agendaStatus;
this.agendaPosterUrl = agendaPosterUrl;
}

@Mapper
Expand All @@ -67,6 +78,7 @@ public interface MapStruct {
AgendaAdminResDto.MapStruct INSTANCE = Mappers.getMapper(AgendaAdminResDto.MapStruct.class);

@Mapping(target = "agendaId", source = "id")
@Mapping(target = "agendaKey", source = "agendaKey")
@Mapping(target = "agendaTitle", source = "title")
@Mapping(target = "agendaDeadLine", source = "deadline")
@Mapping(target = "agendaStartTime", source = "startTime")
Expand All @@ -79,6 +91,7 @@ public interface MapStruct {
@Mapping(target = "isRanking", source = "isRanking")
@Mapping(target = "isOfficial", source = "isOfficial")
@Mapping(target = "agendaStatus", source = "status")
@Mapping(target = "agendaPosterUrl", source = "posterUri")
AgendaAdminResDto toAgendaAdminResDto(Agenda agenda);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package gg.agenda.api.admin.agenda.controller.response;

import java.util.UUID;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import gg.data.agenda.Agenda;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class AgendaAdminSimpleResDto {

UUID agendaKey;

String agendaTitle;

@Builder
public AgendaAdminSimpleResDto(UUID agendaKey, String agendaTitle) {
this.agendaKey = agendaKey;
this.agendaTitle = agendaTitle;
}

@Mapper
public interface MapStruct {

AgendaAdminSimpleResDto.MapStruct INSTANCE = Mappers.getMapper(AgendaAdminSimpleResDto.MapStruct.class);

@Mapping(target = "agendaKey", source = "agendaKey")
@Mapping(target = "agendaTitle", source = "title")
AgendaAdminSimpleResDto toDto(Agenda agenda);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Pageable;
Expand All @@ -17,6 +18,7 @@
import gg.admin.repo.agenda.AgendaAdminRepository;
import gg.admin.repo.agenda.AgendaTeamAdminRepository;
import gg.agenda.api.admin.agenda.controller.request.AgendaAdminUpdateReqDto;
import gg.agenda.api.admin.agenda.controller.response.AgendaAdminSimpleResDto;
import gg.data.agenda.Agenda;
import gg.data.agenda.AgendaTeam;
import gg.utils.exception.custom.BusinessException;
Expand Down Expand Up @@ -70,4 +72,11 @@ public void updateAgenda(UUID agendaKey, AgendaAdminUpdateReqDto agendaDto, Mult
agenda.updateAgendaCapacity(agendaDto.getAgendaMinTeam(), agendaDto.getAgendaMaxTeam(), teams);
agenda.updateAgendaTeamCapacity(agendaDto.getAgendaMinPeople(), agendaDto.getAgendaMaxPeople(), teams);
}

@Transactional(readOnly = true)
public List<AgendaAdminSimpleResDto> getAgendaSimpleList() {
return agendaAdminRepository.findAll().stream()
.map(AgendaAdminSimpleResDto.MapStruct.INSTANCE::toDto)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.data.domain.Sort;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -33,7 +34,7 @@ public class AgendaAnnouncementAdminController {

@GetMapping()
public ResponseEntity<List<AgendaAnnouncementAdminResDto>> agendaAnnouncementList(
@RequestParam("agenda_key") UUID agendaKey, @RequestBody @Valid PageRequestDto pageRequest) {
@RequestParam("agenda_key") UUID agendaKey, @ModelAttribute @Valid PageRequestDto pageRequest) {
int page = pageRequest.getPage();
int size = pageRequest.getSize();
Pageable pageable = PageRequest.of(page - 1, size, Sort.by("id").descending());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import gg.agenda.api.admin.agendateam.controller.request.AgendaTeamKeyReqDto;
import gg.agenda.api.admin.agendateam.controller.request.AgendaTeamUpdateDto;
import gg.agenda.api.admin.agendateam.controller.response.AgendaTeamDetailResDto;
import gg.agenda.api.admin.agendateam.controller.response.AgendaTeamResDto;
Expand All @@ -37,7 +37,7 @@ public class AgendaTeamAdminController {

@GetMapping("/list")
public ResponseEntity<List<AgendaTeamResDto>> agendaTeamList(@RequestParam("agenda_key") UUID agendaKey,
@RequestBody @Valid PageRequestDto pageRequestDto) {
@ModelAttribute @Valid PageRequestDto pageRequestDto) {
int page = pageRequestDto.getPage();
int size = pageRequestDto.getSize();
Pageable pageable = PageRequest.of(page - 1, size, Sort.by("id").descending());
Expand All @@ -49,9 +49,8 @@ public ResponseEntity<List<AgendaTeamResDto>> agendaTeamList(@RequestParam("agen
}

@GetMapping
public ResponseEntity<AgendaTeamDetailResDto> agendaTeamDetail(
@RequestBody @Valid AgendaTeamKeyReqDto agendaTeamKeyReqDto) {
AgendaTeam agendaTeam = agendaTeamAdminService.getAgendaTeamByTeamKey(agendaTeamKeyReqDto.getTeamKey());
public ResponseEntity<AgendaTeamDetailResDto> agendaTeamDetail(@RequestParam("team_key") UUID agendaTeamKey) {
AgendaTeam agendaTeam = agendaTeamAdminService.getAgendaTeamByTeamKey(agendaTeamKey);
List<AgendaProfile> participants = agendaTeamAdminService.getAgendaProfileListByAgendaTeam(agendaTeam);
AgendaTeamDetailResDto agendaTeamDetailResDto = AgendaTeamDetailResDto.MapStruct.INSTANCE
.toDto(agendaTeam, participants);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.UUID;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import gg.data.agenda.AgendaTeam;
Expand All @@ -19,8 +20,6 @@ public class AgendaTeamResDto {

private String teamStatus;

private int teamScore;

private boolean teamIsPrivate;

private String teamLeaderIntraId;
Expand All @@ -29,23 +28,36 @@ public class AgendaTeamResDto {

private UUID teamKey;

private String teamAward;

private Integer teamAwardPriority;

@Builder
public AgendaTeamResDto(String teamName, String teamStatus, int teamScore, boolean teamIsPrivate,
String teamLeaderIntraId, int teamMateCount, UUID teamKey) {
public AgendaTeamResDto(String teamName, String teamStatus, boolean teamIsPrivate, String teamLeaderIntraId,
int teamMateCount, UUID teamKey, String teamAward, Integer teamAwardPriority) {
this.teamName = teamName;
this.teamStatus = teamStatus;
this.teamScore = teamScore;
this.teamIsPrivate = teamIsPrivate;
this.teamLeaderIntraId = teamLeaderIntraId;
this.teamMateCount = teamMateCount;
this.teamKey = teamKey;
this.teamAward = teamAward;
this.teamAwardPriority = teamAwardPriority;
}

@Mapper
public interface MapStruct {

AgendaTeamResDto.MapStruct INSTANCE = Mappers.getMapper(AgendaTeamResDto.MapStruct.class);

@Mapping(target = "teamName", source = "name")
@Mapping(target = "teamStatus", source = "status")
@Mapping(target = "teamIsPrivate", source = "isPrivate")
@Mapping(target = "teamLeaderIntraId", source = "leaderIntraId")
@Mapping(target = "teamMateCount", source = "mateCount")
@Mapping(target = "teamKey", source = "teamKey")
@Mapping(target = "teamAward", source = "award", defaultValue = "AgendaTeam.DEFAULT_AWARD")
@Mapping(target = "teamAwardPriority", source = "awardPriority", defaultValue = "0")
AgendaTeamResDto toDto(AgendaTeam agendaTeam);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gg.agenda.api.user.agenda.controller.response;

import java.net.URL;
import java.time.LocalDateTime;

import org.mapstruct.Mapper;
Expand Down Expand Up @@ -38,7 +39,7 @@ public class AgendaResDto {

private int agendaMaxPeople;

private String agendaPoster;
private String agendaPosterUrl;

private String agendaHost;

Expand All @@ -57,7 +58,7 @@ public class AgendaResDto {
@Builder
public AgendaResDto(String agendaTitle, String agendaContents, LocalDateTime agendaDeadLine,
LocalDateTime agendaStartTime, LocalDateTime agendaEndTime, int agendaMinTeam, int agendaMaxTeam,
int agendaCurrentTeam, int agendaMinPeople, int agendaMaxPeople, String agendaPoster, String agendaHost,
int agendaCurrentTeam, int agendaMinPeople, int agendaMaxPeople, String agendaPosterUrl, String agendaHost,
Location agendaLocation, AgendaStatus agendaStatus, LocalDateTime createdAt, String announcementTitle,
Boolean isOfficial, Boolean isRanking) {
this.agendaTitle = agendaTitle;
Expand All @@ -70,7 +71,7 @@ public AgendaResDto(String agendaTitle, String agendaContents, LocalDateTime age
this.agendaCurrentTeam = agendaCurrentTeam;
this.agendaMinPeople = agendaMinPeople;
this.agendaMaxPeople = agendaMaxPeople;
this.agendaPoster = agendaPoster;
this.agendaPosterUrl = agendaPosterUrl;
this.agendaHost = agendaHost;
this.agendaLocation = agendaLocation;
this.agendaStatus = agendaStatus;
Expand All @@ -95,7 +96,7 @@ public interface MapStruct {
@Mapping(target = "agendaCurrentTeam", source = "agenda.currentTeam")
@Mapping(target = "agendaMinPeople", source = "agenda.minPeople")
@Mapping(target = "agendaMaxPeople", source = "agenda.maxPeople")
@Mapping(target = "agendaPoster", source = "agenda.posterUri")
@Mapping(target = "agendaPosterUrl", source = "agenda.posterUri")
@Mapping(target = "agendaHost", source = "agenda.hostIntraId")
@Mapping(target = "agendaLocation", source = "agenda.location")
@Mapping(target = "agendaStatus", source = "agenda.status")
Expand Down
Loading

0 comments on commit 8e1e2fe

Please sign in to comment.