Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tedsoftj1123 committed Mar 11, 2024
2 parents 135e9e3 + 0543e5f commit 8d6d660
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static Company of(RegisterCompanyRequest request, String businessArea) {
.build()
)
.workersCount(request.workerNumber())
.representativePhoneNo(request.representativePhoneNo())
.email(request.email())
.fax(request.fax())
.isMou(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AttachmentResponse {

public static AttachmentResponse of(NoticeAttachment noticeAttachment) {
return new AttachmentResponse(
noticeAttachment.getAttachmentUrl(),
noticeAttachment.getUrl(),
noticeAttachment.getType()
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package team.retum.jobis.domain.notice.dto.response;

import lombok.Builder;
import lombok.Getter;
import team.retum.jobis.domain.notice.model.Notice;
import team.retum.jobis.domain.notice.model.NoticeAttachment;

import java.time.LocalDateTime;
import java.util.List;

@Getter
@Builder
public class QueryNoticeDetailResponse {

private final String title;
private final String content;
private final LocalDateTime createdAt;
private final List<NoticeAttachment> attachments;

public static QueryNoticeDetailResponse from(Notice notice) {
return QueryNoticeDetailResponse.builder()
.title(notice.getTitle())
.content(notice.getContent())
.createdAt(notice.getCreatedAt())
.attachments(notice.getAttachments())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@AllArgsConstructor
public class NoticeAttachment {

private final String attachmentUrl;
private final String url;

private final AttachmentType type;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package team.retum.jobis.domain.notice.usecase;


import lombok.RequiredArgsConstructor;
import team.retum.jobis.common.annotation.ReadOnlyUseCase;
import team.retum.jobis.domain.notice.dto.response.QueryNoticeDetailResponse;
import team.retum.jobis.domain.notice.exception.NoticeNotFoundException;
import team.retum.jobis.domain.notice.model.Notice;
import team.retum.jobis.domain.notice.spi.QueryNoticePort;

@RequiredArgsConstructor
@ReadOnlyUseCase
public class QueryNoticeDetailUseCase {

private final QueryNoticePort queryNoticePort;
public QueryNoticeDetailResponse execute(Long noticeId) {

Notice notice = queryNoticePort.queryNoticeById(noticeId)
.orElseThrow(() -> NoticeNotFoundException.EXCEPTION);

return QueryNoticeDetailResponse.from(notice);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public List<ApplicationVO> queryApplicationByConditions(ApplicationFilter applic
.grade(application.getGrade())
.number(application.getNumber())
.classNumber(application.getClassNumber())
.companyLogoUrl(application.getCompanyLogoUrl())
.profileImageUrl(application.getProfileImageUrl())
.companyName(application.getCompanyName())
.createdAt(application.getCreatedAt())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand All @@ -14,7 +13,6 @@
@Embeddable
public class BugAttachmentEntity {

@NotNull
@Column(columnDefinition = "VARCHAR(300)")
private String attachmentUrl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import team.retum.jobis.domain.bug.dto.request.CreateBugReportRequest;
import team.retum.jobis.domain.bug.model.DevelopmentArea;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

@Getter
@NoArgsConstructor
Expand All @@ -32,7 +34,7 @@ public CreateBugReportRequest toDomainRequest() {
.title(this.title)
.content(this.content)
.developmentArea(this.developmentArea)
.attachmentUrls(this.attachmentUrls)
.attachmentUrls(Objects.requireNonNullElse(attachmentUrls, Collections.emptyList()))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public CompanyEntity toEntity(Company domain) {
.subManagerName(domain.getManagerInfo().subManagerName())
.subManagerPhoneNo(domain.getManagerInfo().subManagerPhoneNo())
.representative(domain.getRepresentative())
.representativePhoneNo(domain.getRepresentativePhoneNo())
.serviceName(domain.getServiceName())
.take(domain.getTake())
.isMou(domain.isMou())
Expand Down Expand Up @@ -79,6 +80,7 @@ public Company toDomain(CompanyEntity entity) {
.build()
)
.representative(entity.getRepresentative())
.representativePhoneNo(entity.getRepresentative())
.serviceName(entity.getServiceName())
.take(entity.getTake())
.workersCount(entity.getWorkersCount())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public NoticeEntity toEntity(Notice domain) {
.orElseThrow(() -> NotificationNotFoundException.EXCEPTION);

List<NoticeAttachmentEntity> attachments = domain.getAttachments().stream()
.map(attachment -> new NoticeAttachmentEntity(attachment.getAttachmentUrl(), attachment.getType()))
.map(attachment -> new NoticeAttachmentEntity(attachment.getUrl(), attachment.getType()))
.toList();

return NoticeEntity.builder()
Expand All @@ -50,4 +50,4 @@ public Notice toDomain(NoticeEntity entity) {
.attachments(attachments)
.build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -11,10 +12,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import team.retum.jobis.domain.notice.dto.response.QueryNoticeDetailResponse;
import team.retum.jobis.domain.notice.presentation.dto.CreateNoticeWebRequest;
import team.retum.jobis.domain.notice.presentation.dto.UpdateNoticeWebRequest;
import team.retum.jobis.domain.notice.usecase.CreateNoticeUseCase;
import team.retum.jobis.domain.notice.usecase.DeleteNoticeUseCase;
import team.retum.jobis.domain.notice.usecase.QueryNoticeDetailUseCase;
import team.retum.jobis.domain.notice.usecase.UpdateNoticeUseCase;

@RequiredArgsConstructor
Expand All @@ -25,6 +28,7 @@ public class NoticeWebAdapter {
private final CreateNoticeUseCase createNoticeUseCase;
private final UpdateNoticeUseCase updateNoticeUseCase;
private final DeleteNoticeUseCase deleteNoticeUseCase;
private final QueryNoticeDetailUseCase queryNoticeDetailsUseCase;

@ResponseStatus(HttpStatus.CREATED)
@PostMapping
Expand All @@ -46,4 +50,11 @@ public void updateNotice(
public void deleteNotice(@PathVariable("notice-id") Long noticeId) {
deleteNoticeUseCase.execute(noticeId);
}

@GetMapping("/{notice-id}")
public QueryNoticeDetailResponse queryNoticeDetails(
@PathVariable("notice-id") Long noticeId
) {
return queryNoticeDetailsUseCase.execute(noticeId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers(HttpMethod.POST, "/notices").hasAuthority(TEACHER.name())
.requestMatchers(HttpMethod.PATCH, "/notices/{notice-id}").hasAuthority(TEACHER.name())
.requestMatchers(HttpMethod.DELETE, "/notices/{notice-id}").hasAuthority(TEACHER.name())
.requestMatchers(HttpMethod.GET, "/notices/{notice-id}").permitAll()

// notification
.requestMatchers(HttpMethod.GET, "/notifications").authenticated()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package team.retum.jobis.thirdparty.fcm;

import com.google.firebase.messaging.AndroidConfig;
import com.google.firebase.messaging.ApnsConfig;
import com.google.firebase.messaging.Aps;
import com.google.firebase.messaging.FirebaseMessaging;
Expand All @@ -23,13 +24,19 @@ public void sendMessages(Notification notification, List<String> tokens) {
.setBody(notification.getContent())
.build()
)
.putData("detail_id", notification.getDetailId().toString())
.putData("topic", notification.getTopic().toString())
.setAndroidConfig(
AndroidConfig.builder()
.putData("detail_id", notification.getDetailId().toString())
.putData("topic", notification.getTopic().toString())
.build()
)
.setApnsConfig(
ApnsConfig.builder()
.setAps(
Aps.builder()
.setSound("default")
.putCustomData("detail_id", notification.getDetailId().toString())
.putCustomData("topic", notification.getTopic().toString())
.build()
).build()
)
Expand Down

0 comments on commit 8d6d660

Please sign in to comment.