Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,18 @@ jobs:
distribution: temurin
java-version: 17

# 3) GitHub Secret으로 application.yml 생성
- name: Make application.yml from secret
shell: bash
run: |
mkdir -p ./src/main/resources
cat > ./src/main/resources/application.yml <<'EOF'
${{ secrets.APPLICATION_YML }}
EOF
sed -i 's/\r$//' ./src/main/resources/application.yml
# 3) Gradle 캐시(빌드 속도 개선)
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# 4) gradlew 실행 권한
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

# 5) 빌드
# 5) 빌드(테스트 포함)
# 테스트는 src/test/resources/application.yml(H2) 설정으로 자동 실행됨
- name: Build with Gradle
run: ./gradlew clean build
run: ./gradlew clean build --no-daemon

# 6) 테스트 리포트 업로드
- name: Upload Test Reports
Expand Down
Binary file added docs/Chapter4/워크북4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
244 changes: 244 additions & 0 deletions docs/Chapter4/테이블 DDL
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@

create table event_notice
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
content varchar(255) not null,
title varchar(150) not null
);

create table food_category
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
category_name varchar(10) not null
);

create table inquiry_notice
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
content varchar(255) not null,
title varchar(150) not null
);

create table region
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
region_name varchar(50) not null
);

create table restaurant
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
owner_number bigint null,
rating double not null,
restaurant_category varchar(50) not null,
restaurant_name varchar(50) not null,
region_id bigint null,
constraint FKa42f32i7rvo56cb6laomg565s
foreign key (region_id) references region (id)
);

create table mission
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
deadline date not null,
mission_name varchar(50) not null,
mission_point int not null,
restaurant_id bigint null,
constraint FKgae6qenatvwyoxwh163hm1sp
foreign key (restaurant_id) references restaurant (id)
);

create table review_notice
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
content varchar(255) not null,
title varchar(150) not null
);

create table term
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
term_name enum ('AGE', 'LOCATION', 'MARKETING', 'PRIVACY', 'SERVICE') not null
);

create table user
(
id bigint auto_increment
primary key,
address varchar(125) not null,
birth date not null,
gender enum ('FEMALE', 'MALE', 'NONE') not null,
is_active bit not null,
name varchar(10) not null,
phone_num varchar(15) not null,
phone_verification_status enum ('UNVERIFIED', 'VERIFIED') not null,
point int not null,
social_type enum ('APPLE', 'GOOGLE', 'KAKAO', 'NAVER') null
);

create table inquiry
(
id bigint auto_increment
primary key,
inquiry_content varchar(255) not null,
inquiry_title varchar(150) not null,
inquiry_type enum ('ACCOUNT', 'EVENT', 'GENERAL', 'OTHER', 'REVIEW') not null,
user_id bigint not null,
constraint FKff1ylwlwujmed7diqs8ykf6pv
foreign key (user_id) references user (id)
);

create table inquiry_photo
(
id bigint auto_increment
primary key,
inquiry_photo_url varchar(255) null,
inquiry_id bigint not null,
constraint FK9m88uysxflyu2jdoehj473bs
foreign key (inquiry_id) references inquiry (id)
);

create table inquiry_reply
(
id bigint auto_increment
primary key,
inquiry_content varchar(255) not null,
inquiry_id bigint not null,
constraint FKlswrro8h5dy5y2ba8q9useih7
foreign key (inquiry_id) references inquiry (id)
);

create table notice
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
is_confirmed bit not null,
event_notice_id bigint not null,
inquiry_notice_id bigint not null,
review_notice_id bigint not null,
user_id bigint not null,
constraint UK4k97mbcsgk6w6dh6xjuma9n29
unique (event_notice_id),
constraint UK76earbdvxb80rb530qcq2cpbx
unique (inquiry_notice_id),
constraint UKg0b3vrsrje34nvekb1l3cbc7o
unique (review_notice_id),
constraint FK6vmstvjnqtftlrk5yobu8xk4j
foreign key (review_notice_id) references review_notice (id),
constraint FKbhhoinw4ffgwdn2pps37nmqqs
foreign key (event_notice_id) references event_notice (id),
constraint FKcvf4mh5se36inrxn7xlh2brfv
foreign key (user_id) references user (id),
constraint FKns7lmqww3hp3tf5xd03o6ev1
foreign key (inquiry_notice_id) references inquiry_notice (id)
);

create table review
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
rating double not null,
review_content varchar(255) not null,
restaurant_id bigint not null,
user_id bigint not null,
constraint FK70ry7cuti298yxet366rynxch
foreign key (restaurant_id) references restaurant (id),
constraint FKiyf57dy48lyiftdrf7y87rnxi
foreign key (user_id) references user (id)
);

create table reply
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
reply_content varchar(255) null,
review_id bigint not null,
constraint UK4uh4vegunuxj6p9ilmeyy6gm2
unique (review_id),
constraint FKd5ckwt38d4ibe84wlfc3o8jw8
foreign key (review_id) references review (id)
);

create table review_photo
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
photo_url varchar(255) null,
review_id bigint not null,
constraint FK80ti8nek4uv8vn4vjhpre6mwg
foreign key (review_id) references review (id)
);

create table user_mission
(
id bigint auto_increment
primary key,
is_completed bit not null,
mission_id bigint not null,
user_id bigint not null,
constraint FKdlc6c9h0rifeykrviy3fgmygv
foreign key (mission_id) references mission (id),
constraint FKfsmo8ipks83kcuqtky39hxyvc
foreign key (user_id) references user (id)
);

create table user_preferrence_food
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
food_id bigint not null,
user_id bigint not null,
constraint FK9oxejgu6kw58dbywwjiee06w4
foreign key (user_id) references user (id),
constraint FKld36amxnmtmkupbhf7kcaeaec
foreign key (food_id) references food_category (id)
);

create table user_term
(
id bigint auto_increment
primary key,
created_at datetime(6) not null,
updated_at datetime(6) not null,
term_id bigint not null,
user_id bigint not null,
constraint FK1q9gmsebfsty95vmb262jers
foreign key (term_id) references term (id),
constraint FK3wbl3i7dlc7ctj7ris8vtbhd1
foreign key (user_id) references user (id)
);

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.example.umc9th.domain.inquiry.entity;

import com.example.umc9th.domain.inquiry.enums.InquiryType;
import com.example.umc9th.domain.member.entity.Member;
import jakarta.persistence.*;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@Table(name = "inquiry")
public class Inquiry {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "inquiry_title", length = 150, nullable = false)
private String inquiryTitle;

@Column(name = "inquiry_content", nullable = false)
private String inquiryContent;

@Column(name = "inquiry_type", length = 20, nullable = false)
@Enumerated(EnumType.STRING)
private InquiryType inquiryType;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id", nullable = false)
private Member member;

@OneToMany(mappedBy = "inquiry", cascade = CascadeType.REMOVE)
private List<InquiryPhoto> photos = new ArrayList<>();

@OneToMany(mappedBy = "inquiry", cascade = CascadeType.REMOVE)
private List<InquiryReply> replies = new ArrayList<>();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.umc9th.domain.inquiry.entity;

import jakarta.persistence.*;
import lombok.*;

@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@Table(name = "inquiry_photo")
public class InquiryPhoto {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "inquiry_photo_url")
private String inquiryPhotoUrl;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "inquiry_id", nullable = false)
private Inquiry inquiry;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.umc9th.domain.inquiry.entity;

import jakarta.persistence.*;
import lombok.*;

@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@Table(name = "inquiry_reply")
public class InquiryReply {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "inquiry_content", nullable = false)
private String inquiryContent;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "inquiry_id", nullable = false)
private Inquiry inquiry;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.umc9th.domain.inquiry.enums;

public enum InquiryType {
GENERAL, ACCOUNT, REVIEW, EVENT, OTHER
}
27 changes: 27 additions & 0 deletions src/main/java/com/example/umc9th/domain/member/entity/Food.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example.umc9th.domain.member.entity;

import com.example.umc9th.domain.member.entity.mapping.MemberFood;
import com.example.umc9th.global.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@Table(name = "food_category")
public class Food extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "category_name", length = 10, nullable = false)
private String categoryName; // 음식 카테고리

@OneToMany(mappedBy = "food", cascade = CascadeType.REMOVE)
private List<MemberFood> memberFoodList = new ArrayList<>();
}
Loading