Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 remove birthday code #130

Merged
merged 1 commit into from
Jul 31, 2024
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
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package net.pengcook.authentication.dto;

import com.google.firebase.database.annotations.NotNull;
import jakarta.validation.constraints.NotBlank;
import java.time.LocalDate;

public record GoogleSignUpRequest(
@NotBlank String idToken,
@NotBlank String username,
@NotBlank String nickname,
@NotNull LocalDate birthday,
@NotBlank String country
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public record GoogleSignUpResponse(
String username,
String nickname,
String image,
String birthday,
String country,
String accessToken,
String refreshToken
Expand All @@ -20,7 +19,6 @@ public GoogleSignUpResponse(User user, String accessToken, String refreshToken)
user.getUsername(),
user.getNickname(),
user.getImage(),
user.getBirth().toString(),
user.getRegion(),
accessToken,
refreshToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ private User createUser(GoogleSignUpRequest googleSignUpRequest) {
googleSignUpRequest.username(),
googleSignUpRequest.nickname(),
decodedToken.getPicture(),
googleSignUpRequest.birthday(),
googleSignUpRequest.country()
);
}
Expand Down
8 changes: 2 additions & 6 deletions backend/src/main/java/net/pengcook/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.time.LocalDate;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down Expand Up @@ -35,13 +34,10 @@ public class User {
@Column(nullable = false)
private String image;

@Column(nullable = false)
private LocalDate birth;

@Column(nullable = false)
private String region;

public User(String email, String username, String nickname, String image, LocalDate birth, String region) {
this(0L, email, username, nickname, image, birth, region);
public User(String email, String username, String nickname, String image, String region) {
this(0L, email, username, nickname, image, region);
}
}
3 changes: 0 additions & 3 deletions backend/src/main/java/net/pengcook/user/dto/UserResponse.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.pengcook.user.dto;

import java.time.LocalDate;
import net.pengcook.user.domain.User;

public record UserResponse(
Expand All @@ -9,7 +8,6 @@ public record UserResponse(
String username,
String nickname,
String image,
LocalDate birth,
String region
) {

Expand All @@ -20,7 +18,6 @@ public UserResponse(User user) {
user.getUsername(),
user.getNickname(),
user.getImage(),
user.getBirth(),
user.getRegion()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@

String image() default "tester.jpg";

String birth() default "2000-01-01";

String region() default "KOREA";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.google.firebase.auth.FirebaseToken;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import java.time.LocalDate;
import java.util.regex.Pattern;
import net.pengcook.RestDocsSetting;
import net.pengcook.authentication.domain.JwtTokenManager;
Expand Down Expand Up @@ -127,7 +126,6 @@ void signUpWithGoogle() throws FirebaseAuthException {
idToken,
"new_face",
"신입",
LocalDate.of(2000, 1, 1),
"KOREA"
);

Expand All @@ -144,7 +142,6 @@ void signUpWithGoogle() throws FirebaseAuthException {
fieldWithPath("idToken").description("Google ID Token"),
fieldWithPath("username").description("사용자 아이디"),
fieldWithPath("nickname").description("사용자 닉네임"),
fieldWithPath("birthday").description("생년월일"),
fieldWithPath("country").description("국가")
),
responseFields(
Expand All @@ -153,7 +150,6 @@ void signUpWithGoogle() throws FirebaseAuthException {
fieldWithPath("username").description("사용자 아이디"),
fieldWithPath("nickname").description("사용자 닉네임"),
fieldWithPath("image").description("사용자 프로필 이미지"),
fieldWithPath("birthday").description("사용자 생년월일"),
fieldWithPath("country").description("사용자 국가"),
fieldWithPath("accessToken").description("JWT Access Token"),
fieldWithPath("refreshToken").description("JWT Refresh Token")
Expand All @@ -179,7 +175,6 @@ void signUpWithGoogleWhenEmailAleadyRegistered() throws FirebaseAuthException {
idToken,
"loki",
"로키",
LocalDate.of(1999, 8, 8),
"KOREA"
);

Expand All @@ -196,7 +191,6 @@ void signUpWithGoogleWhenEmailAleadyRegistered() throws FirebaseAuthException {
fieldWithPath("idToken").description("Google ID Token"),
fieldWithPath("username").description("사용자 아이디"),
fieldWithPath("nickname").description("사용자 닉네임"),
fieldWithPath("birthday").description("생년월일"),
fieldWithPath("country").description("국가")
)
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import java.time.LocalDate;
import net.pengcook.authentication.annotation.WithLoginUser;
import net.pengcook.authentication.domain.JwtTokenManager;
import net.pengcook.authentication.domain.TokenPayload;
Expand Down Expand Up @@ -49,7 +48,6 @@ private User saveUser(WithLoginUser annotation, UserRepository userRepository) {
annotation.username(),
annotation.nickname(),
annotation.image(),
LocalDate.parse(annotation.birth()),
annotation.region()
);
return userRepository.save(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthException;
import com.google.firebase.auth.FirebaseToken;
import java.time.LocalDate;
import java.util.regex.Pattern;
import net.pengcook.authentication.domain.JwtTokenManager;
import net.pengcook.authentication.domain.TokenPayload;
Expand Down Expand Up @@ -91,7 +90,6 @@ void signUpWithGoogle() throws FirebaseAuthException {
idToken,
"new_face",
"신입",
LocalDate.of(2000, 1, 1),
"KOREA"
);

Expand All @@ -115,7 +113,6 @@ void signUpWithGoogleWhenEmailAleadyRegistered() throws FirebaseAuthException {
idToken,
"loki",
"로키",
LocalDate.of(1999, 8, 8),
"KOREA"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.List;
import net.pengcook.category.repository.CategoryRecipeRepository;
Expand Down Expand Up @@ -36,7 +35,7 @@ class CategoryServiceTest {
@Test
@DisplayName("레시피의 카테고리를 저장할 수 있다.")
void saveCategories() {
User author = new User("[email protected]", "ela", "엘라", "ela.jpg", LocalDate.of(2024, 7, 22), "KOREA");
User author = new User("[email protected]", "ela", "엘라", "ela.jpg", "KOREA");
Recipe recipe = new Recipe(1L, "김치볶음밥", author, LocalTime.of(0, 30, 0), "김치볶음밥이미지.jpg", 3, 2, "김치볶음밥 조리법");

categoryService.saveCategories(recipe, List.of("건강식", "매운음식"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import java.time.LocalDate;
import net.pengcook.RestDocsSetting;
import net.pengcook.authentication.annotation.WithLoginUser;
import net.pengcook.authentication.annotation.WithLoginUserTest;
Expand All @@ -36,7 +35,6 @@ void getUserProfile() {
"loki",
"로키",
"loki.jpg",
LocalDate.of(1999, 8, 8),
"KOREA"
);

Expand All @@ -50,7 +48,6 @@ void getUserProfile() {
fieldWithPath("username").description("사용자 아이디"),
fieldWithPath("nickname").description("사용자 닉네임"),
fieldWithPath("image").description("사용자 프로필 이미지"),
fieldWithPath("birth").description("사용자 생년월일"),
fieldWithPath("region").description("사용자 국가")
)
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import java.time.LocalDate;
import java.util.NoSuchElementException;
import net.pengcook.user.dto.UserResponse;
import net.pengcook.user.dto.UsernameCheckResponse;
Expand Down Expand Up @@ -37,7 +36,6 @@ void getUserById() {
"loki",
"로키",
"loki.jpg",
LocalDate.of(1999, 8, 8),
"KOREA"
);

Expand All @@ -54,7 +52,7 @@ void getUserByIdWhenNotExistId() {
assertThatThrownBy(() -> userService.getUserById(id))
.isInstanceOf(NoSuchElementException.class);
}

@Test
@DisplayName("중복되지 않은 username을 입력하면 사용 가능하다")
void checkUsername() {
Expand Down
4 changes: 2 additions & 2 deletions backend/src/test/resources/data/category.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ALTER TABLE ingredient_recipe
SET
REFERENTIAL_INTEGRITY TRUE;

INSERT INTO users (email, username, nickname, image, birth, region)
VALUES ('[email protected]', 'ela', '엘라', 'ela.jpg', '2024-07-22', 'KOREA');
INSERT INTO users (email, username, nickname, image, region)
VALUES ('[email protected]', 'ela', '엘라', 'ela.jpg', 'KOREA');

INSERT INTO category (name)
VALUES ('한식'),
Expand Down
18 changes: 9 additions & 9 deletions backend/src/test/resources/data/ingredient.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ ALTER TABLE ingredient_recipe ALTER COLUMN id RESTART;

SET REFERENTIAL_INTEGRITY TRUE;

INSERT INTO users (email, username, nickname, image, birth, region)
VALUES ('[email protected]', 'loki', '로키', 'loki.jpg', '1999-08-08', 'KOREA'),
('[email protected]', 'ela', '엘라', 'ela.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'crocodile', '악어', 'crocodile.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'birdsheep', '새양', 'birdsheep.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'pond', '폰드', 'pond.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'ato', '아토', 'ato.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'km', '케이엠', 'km.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'hadi', '하디', 'hadi.jpg', '2024-07-22', 'KOREA');
INSERT INTO users (email, username, nickname, image, region)
VALUES ('[email protected]', 'loki', '로키', 'loki.jpg', 'KOREA'),
('[email protected]', 'ela', '엘라', 'ela.jpg', 'KOREA'),
('[email protected]', 'crocodile', '악어', 'crocodile.jpg', 'KOREA'),
('[email protected]', 'birdsheep', '새양', 'birdsheep.jpg', 'KOREA'),
('[email protected]', 'pond', '폰드', 'pond.jpg', 'KOREA'),
('[email protected]', 'ato', '아토', 'ato.jpg', 'KOREA'),
('[email protected]', 'km', '케이엠', 'km.jpg', 'KOREA'),
('[email protected]', 'hadi', '하디', 'hadi.jpg', 'KOREA');

INSERT INTO recipe (title, author_id, cooking_time, thumbnail, difficulty, like_count, description)
VALUES ('김밥', 1, '01:00:00', '김밥이미지.jpg', 8, 1, '김밥 조리법'),
Expand Down
18 changes: 9 additions & 9 deletions backend/src/test/resources/data/recipe.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ ALTER TABLE recipe_step ALTER COLUMN id RESTART;

SET REFERENTIAL_INTEGRITY TRUE;

INSERT INTO users (email, username, nickname, image, birth, region)
VALUES ('[email protected]', 'loki', '로키', 'loki.jpg', '1999-08-08', 'KOREA'),
('[email protected]', 'ela', '엘라', 'ela.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'crocodile', '악어', 'crocodile.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'birdsheep', '새양', 'birdsheep.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'pond', '폰드', 'pond.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'ato', '아토', 'ato.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'km', '케이엠', 'km.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'hadi', '하디', 'hadi.jpg', '2024-07-22', 'KOREA');
INSERT INTO users (email, username, nickname, image, region)
VALUES ('[email protected]', 'loki', '로키', 'loki.jpg', 'KOREA'),
('[email protected]', 'ela', '엘라', 'ela.jpg', 'KOREA'),
('[email protected]', 'crocodile', '악어', 'crocodile.jpg', 'KOREA'),
('[email protected]', 'birdsheep', '새양', 'birdsheep.jpg', 'KOREA'),
('[email protected]', 'pond', '폰드', 'pond.jpg', 'KOREA'),
('[email protected]', 'ato', '아토', 'ato.jpg', 'KOREA'),
('[email protected]', 'km', '케이엠', 'km.jpg', 'KOREA'),
('[email protected]', 'hadi', '하디', 'hadi.jpg', 'KOREA');

INSERT INTO category (name)
VALUES ('한식'),
Expand Down
18 changes: 9 additions & 9 deletions backend/src/test/resources/data/users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ TRUNCATE TABLE users;
ALTER TABLE users ALTER COLUMN id RESTART WITH 1;
SET REFERENTIAL_INTEGRITY TRUE;

INSERT INTO users (email, username, nickname, image, birth, region)
VALUES ('[email protected]', 'loki', '로키', 'loki.jpg', '1999-08-08', 'KOREA'),
('[email protected]', 'ela', '엘라', 'ela.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'crocodile', '악어', 'crocodile.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'birdsheep', '새양', 'birdsheep.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'pond', '폰드', 'pond.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'ato', '아토', 'ato.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'km', '케이엠', 'km.jpg', '2024-07-22', 'KOREA'),
('[email protected]', 'hadi', '하디', 'hadi.jpg', '2024-07-22', 'KOREA');
INSERT INTO users (email, username, nickname, image, region)
VALUES ('[email protected]', 'loki', '로키', 'loki.jpg', 'KOREA'),
('[email protected]', 'ela', '엘라', 'ela.jpg', 'KOREA'),
('[email protected]', 'crocodile', '악어', 'crocodile.jpg', 'KOREA'),
('[email protected]', 'birdsheep', '새양', 'birdsheep.jpg', 'KOREA'),
('[email protected]', 'pond', '폰드', 'pond.jpg', 'KOREA'),
('[email protected]', 'ato', '아토', 'ato.jpg', 'KOREA'),
('[email protected]', 'km', '케이엠', 'km.jpg', 'KOREA'),
('[email protected]', 'hadi', '하디', 'hadi.jpg', 'KOREA');

Loading