-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…etail Feat/#18 get program detail
- Loading branch information
Showing
11 changed files
with
182 additions
and
10 deletions.
There are no files selected for viewing
4 changes: 0 additions & 4 deletions
4
src/main/java/org/sopt/sopkerton/common/exception/ProgramError.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/org/sopt/sopkerton/program/domain/exception/ProgramError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.sopt.sopkerton.program.domain.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.sopt.sopkerton.common.exception.base.ErrorBase; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@AllArgsConstructor | ||
public enum ProgramError implements ErrorBase { | ||
PROGRAM_NOT_FOUND(HttpStatus.NOT_FOUND, "Can not found Program."), | ||
|
||
; | ||
|
||
private final HttpStatus status; | ||
private final String errorMessage; | ||
@Override | ||
public int getHttpStatusCode() { | ||
return this.status.value(); | ||
} | ||
|
||
@Override | ||
public HttpStatus getHttpStatus() { | ||
return this.status; | ||
} | ||
|
||
@Override | ||
public String getErrorMessage() { | ||
return this.errorMessage; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/sopt/sopkerton/program/domain/exception/ProgramException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.sopt.sopkerton.program.domain.exception; | ||
|
||
import org.sopt.sopkerton.common.exception.base.ExceptionBase; | ||
|
||
public class ProgramException extends ExceptionBase { | ||
public ProgramException(ProgramError errorBase) { | ||
super(errorBase); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...rton/common/exception/ProgramSuccess.java → ...gram/domain/exception/ProgramSuccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/org/sopt/sopkerton/program/dto/response/ProgramDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.sopt.sopkerton.program.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public abstract class ProgramDetailResponse { | ||
|
||
public record VolunteerDetail( | ||
@JsonProperty("imageUrl") | ||
String imageUrl, | ||
@JsonProperty("content") | ||
String content, | ||
@JsonProperty("organizationName") | ||
String organizationName, | ||
@JsonProperty("registerAt") | ||
String registerAt, | ||
@JsonProperty("hour") | ||
int hour, | ||
@JsonProperty("isApply") | ||
boolean isApply | ||
) { | ||
} | ||
|
||
public record EmploymentDetail( | ||
@JsonProperty("imageUrl") | ||
String imageUrl, | ||
@JsonProperty("content") | ||
String content, | ||
@JsonProperty("organizationName") | ||
String organizationName, | ||
@JsonProperty("registerAt") | ||
String registerAt, | ||
@JsonProperty("salary") | ||
int salary, | ||
@JsonProperty("isApply") | ||
boolean isApply | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.sopt.sopkerton.user.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.sopt.sopkerton.common.domain.BaseEntity; | ||
import org.sopt.sopkerton.user.domain.enums.ApplyStatus; | ||
|
||
@Getter | ||
@Entity | ||
@Table(schema = "skt-t1-app", name = "applies") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder | ||
public class Apply extends BaseEntity { | ||
@Id | ||
@Column(name = "id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
Long id; | ||
|
||
@Column(name = "user_id", nullable = false) | ||
Long userId; | ||
|
||
@Column(name = "program_id", nullable = false) | ||
Long programId; | ||
|
||
@Column(name = "is_apply", nullable = false) | ||
@Enumerated(value = EnumType.STRING) | ||
ApplyStatus isApply; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/sopt/sopkerton/user/domain/enums/ApplyStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.sopt.sopkerton.user.domain.enums; | ||
|
||
public enum ApplyStatus { | ||
|
||
APPLY, UNAPPLY | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/org/sopt/sopkerton/user/infrastructure/ApplyRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.sopt.sopkerton.user.infrastructure; | ||
|
||
import org.sopt.sopkerton.user.domain.Apply; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface ApplyRepository extends JpaRepository<Apply, Long> { | ||
|
||
Optional<Apply> findByUserIdAndProgramId(Long userId, Long programId); | ||
} |