diff --git a/src/main/java/com/climingo/climingoApi/gym/domain/Address.java b/src/main/java/com/climingo/climingoApi/gym/domain/Address.java index 6d3490b..ac8da85 100644 --- a/src/main/java/com/climingo/climingoApi/gym/domain/Address.java +++ b/src/main/java/com/climingo/climingoApi/gym/domain/Address.java @@ -1,10 +1,14 @@ package com.climingo.climingoApi.gym.domain; +import jakarta.persistence.Column; import jakarta.persistence.Embeddable; @Embeddable public class Address { + @Column(nullable = false, length = 50) private String address; + + @Column(nullable = true, length = 50) private String zipCode; } diff --git a/src/main/java/com/climingo/climingoApi/gym/domain/Gym.java b/src/main/java/com/climingo/climingoApi/gym/domain/Gym.java index 15ce1f2..ba9c526 100644 --- a/src/main/java/com/climingo/climingoApi/gym/domain/Gym.java +++ b/src/main/java/com/climingo/climingoApi/gym/domain/Gym.java @@ -1,6 +1,7 @@ package com.climingo.climingoApi.gym.domain; import com.climingo.climingoApi.level.domain.Level; +import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; @@ -18,6 +19,7 @@ public class Gym { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + @Column(nullable = false, length = 50) private String name; @Embedded diff --git a/src/main/java/com/climingo/climingoApi/level/domain/Level.java b/src/main/java/com/climingo/climingoApi/level/domain/Level.java index ffff322..a790d14 100644 --- a/src/main/java/com/climingo/climingoApi/level/domain/Level.java +++ b/src/main/java/com/climingo/climingoApi/level/domain/Level.java @@ -1,6 +1,7 @@ package com.climingo.climingoApi.level.domain; import com.climingo.climingoApi.gym.domain.Gym; +import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; @@ -19,12 +20,15 @@ public class Level { private Long id; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "GYM_ID") + @JoinColumn(name = "GYM_ID", nullable = false) private Gym gym; + @Column(nullable = false, length = 10) private String colorNameKo; + @Column(nullable = false, length = 10) private String colorNameEn; + @Column(nullable = false) private Integer orderNum; } diff --git a/src/main/java/com/climingo/climingoApi/member/domain/Member.java b/src/main/java/com/climingo/climingoApi/member/domain/Member.java index ffecfc1..095317a 100644 --- a/src/main/java/com/climingo/climingoApi/member/domain/Member.java +++ b/src/main/java/com/climingo/climingoApi/member/domain/Member.java @@ -23,7 +23,7 @@ @Entity @Getter -@Table(name = "Member", uniqueConstraints = {@UniqueConstraint(columnNames = {"authId", "providerType"})}) +@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"auth_id", "provider_type"})}) @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Member { @@ -41,10 +41,10 @@ public class Member { @Size(min = 2, max = 10) private String nickname; - @Column(nullable = false, length = 255) + @Column(nullable = true, length = 255) private String profileUrl; - @Column(nullable = false, length = 50) + @Column(nullable = true, length = 50) private String email; @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/climingo/climingoApi/record/api/request/RecordCreateRequest.java b/src/main/java/com/climingo/climingoApi/record/api/request/RecordCreateRequest.java index 95049f5..348ca86 100644 --- a/src/main/java/com/climingo/climingoApi/record/api/request/RecordCreateRequest.java +++ b/src/main/java/com/climingo/climingoApi/record/api/request/RecordCreateRequest.java @@ -1,5 +1,6 @@ package com.climingo.climingoApi.record.api.request; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -10,8 +11,13 @@ @NoArgsConstructor public class RecordCreateRequest { + @NotNull private Long gymId; + + @NotNull private Long levelId; + + @NotNull private MultipartFile video; public RecordCreateRequest(Long gymId, Long levelId, MultipartFile video) { diff --git a/src/main/java/com/climingo/climingoApi/record/api/request/RecordUpdateRequest.java b/src/main/java/com/climingo/climingoApi/record/api/request/RecordUpdateRequest.java index e7e61db..3e9a0e3 100644 --- a/src/main/java/com/climingo/climingoApi/record/api/request/RecordUpdateRequest.java +++ b/src/main/java/com/climingo/climingoApi/record/api/request/RecordUpdateRequest.java @@ -1,5 +1,6 @@ package com.climingo.climingoApi.record.api.request; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -10,8 +11,13 @@ @NoArgsConstructor public class RecordUpdateRequest { + @NotNull private Long gymId; + + @NotNull private Long levelId; + + @NotNull private MultipartFile video; public RecordUpdateRequest(Long gymId, Long levelId, MultipartFile video) { diff --git a/src/main/java/com/climingo/climingoApi/record/domain/Record.java b/src/main/java/com/climingo/climingoApi/record/domain/Record.java index ac7b808..2136745 100644 --- a/src/main/java/com/climingo/climingoApi/record/domain/Record.java +++ b/src/main/java/com/climingo/climingoApi/record/domain/Record.java @@ -28,21 +28,21 @@ public class Record extends BaseTimeEntity { private Long id; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "MEMBER_ID") + @JoinColumn(name = "MEMBER_ID", nullable = false) private Member member; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "LEVEL_ID") + @JoinColumn(name = "LEVEL_ID", nullable = false) private Level level; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "GYM_ID") + @JoinColumn(name = "GYM_ID", nullable = false) private Gym gym; - @Column(length = 400) + @Column(nullable = false, length = 400) private String videoUrl; - @Column(length = 400) + @Column(nullable = false, length = 400) private String thumbnailUrl; private String content; diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index b888b37..455cb02 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -38,7 +38,7 @@ insert into level (id, order_num, gym_id, color_name_ko, color_name_en) values ( insert into level (id, order_num, gym_id, color_name_ko, color_name_en) values (28, 10, 3, '검정', 'black'); -insert into member (id, auth_id, provider_type, nickname, profile_url, email, home_gym_id, arm_span, height, weight) values(9999, 'test_auth_id_9999', 'kakao', 'test_nickname', 'http://k.kakaocdn.net/dn/dTDso6/btsECljbpYi/JqJl8DHkrVbuwYlBlVGEkK/img_110x110.jpg', null, null, null, null, null); +insert into member (id, auth_id, provider_type, nickname, profile_url, email, home_gym_id, arm_span, height, weight) values(9999, 'test_auth_id_9999', 'kakao', 'testMember', 'http://k.kakaocdn.net/dn/dTDso6/btsECljbpYi/JqJl8DHkrVbuwYlBlVGEkK/img_110x110.jpg', null, null, null, null, null); insert into record(id, member_id, level_id, gym_id, video_url, thumbnail_url, content, created_date, modified_date) values(1, 9999, 1, 1, 'https://climingo-api.s3.ap-northeast-2.amazonaws.com/%EB%B9%84%EB%94%94%EC%98%A4_2024-05-16T12%3A40%3A26.647632061.MOV', 'https://climingo-api.s3.ap-northeast-2.amazonaws.com/%EC%8D%B8%EB%84%A4%EC%9D%BC_2024-05-16T21%3A35%3A57.247394.jpg', 'test_content', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP());