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

Feature/#3 #6

Merged
merged 6 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions linkmind/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ out/

### VS Code ###
.vscode/
application-dev.yaml
application-main.yaml
application-dev.yml
application-local.yml
/src/test/resources/application-dev.yml
/src/test/resources/application-local.yml
/src/main/resources/application-dev.yml
Expand Down
27 changes: 27 additions & 0 deletions linkmind/src/main/java/com/app/linkmind/domain/Category.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.app.linkmind.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long categoryId;

private String title;

@Builder
public Category(String title) {
this.title = title;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.app.linkmind.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@NoArgsConstructor
@Getter
public class CategoryManagement {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long managedId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "managed_category")
private Category category;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "managed_toast")
private Toast toast;

@Builder
public CategoryManagement(Category category, Toast toast){
this.category = category;
this.toast = toast;
}
}
42 changes: 42 additions & 0 deletions linkmind/src/main/java/com/app/linkmind/domain/Reminder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.app.linkmind.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Reminder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฆฌ๋งˆ์ธ๋” ์—”ํ‹ฐํ‹ฐ์— ๋ฆฌ๋งˆ์ธ๋” ์‹œ์ (๋‚ ์งœ, ์‹œ๊ฐ„)์„ ๋”ฐ๋กœ ์ €์žฅํ•˜์ง€๋Š” ์•Š๋‚˜์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์‚ฌ์‹ค ์ด๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ๋Š” ๊ตฌํ˜„ ํ•  ๋•Œ ์–ด๋–ป๊ฒŒ ๋ ์ง€ ๋ชฐ๋ผ์„œ ์ž๋ฃŒํ˜•๋„ ์ข€ ๊ณ ๋ฏผ์ด ๋˜์—ˆ๋˜ ๋ถ€๋ถ„์ด๋„ค์š” ใ…œ ๋‚˜์ค‘์— yyyy๋ผ๋“ ๊ฐ€ ์ด๋Ÿฐ๊ฑฐ ํ™•์ •๋˜๊ณ  ๋‚˜์„œ ์ด๋ถ€๋ถ„์€ ๋ณ€๊ฒฝํ•ด๋„ ๋˜์ง€์•Š์„๊นŒ..! ๋ผ๋Š” ์ƒ๊ฐ์ด์—ˆ์Šต๋‹ˆ๋‹น

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‚˜์ค‘์— ๋ณ€๊ฒฝํ•ด๋„ ๊ดœ์ฐฎ์„๊ฑฐ๊ฐ™์•„์š”!

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;

@ManyToOne(fetch = FetchType.LAZY)
private User user;

@OneToOne
@JoinColumn(name = "category")
private Category category;

private String title;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title์€ ์–ด๋–ค๊ฒƒ์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ๋ณ€์ˆ˜์ผ๊นŒ์šฉ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„ ๋ฆฌ๋งˆ์ธ๋”์˜ ์ œ๋ชฉ์ด ์•„๋‹ˆ๋ผ ์นดํ…Œ๊ณ ๋ฆฌ์˜ ์ œ๋ชฉ์ด์—ˆ๊ตฐ์šฉ! ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹น ใ…Žใ…Ž


@Builder
public Reminder(User user, Category category, String title){
this.user = user;
this.category = category;
this.title = title;
}



}
11 changes: 11 additions & 0 deletions linkmind/src/main/java/com/app/linkmind/domain/SocialType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.app.linkmind.domain;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum SocialType {
KAKAO,
APPLE;
}
41 changes: 41 additions & 0 deletions linkmind/src/main/java/com/app/linkmind/domain/Toast.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.app.linkmind.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Toast {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋งํฌ ์—ด๋žŒํ–ˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ณ€์ˆ˜ ์ถ”๊ฐ€ํ•ด์•ผํ• ๊ฒƒ๊ฐ™์Šต๋‹ˆ๋‹ค!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์˜ค ๊ทธ๋ ‡๋„ค์šฉ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹น โ˜บ๏ธ

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long Id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "toast_id")
private User user;

private String title;

private String linkUrl;

@Builder
public Toast(User user, String title, String linkUrl){
this.user= user;
this.title = title;
this.linkUrl = linkUrl;
}

public void updateTitle(String title){
this.title = title;
}
}
70 changes: 70 additions & 0 deletions linkmind/src/main/java/com/app/linkmind/domain/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.app.linkmind.domain;

import java.util.Objects;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class User {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๋ฒˆ์ฃผ ์—ด๋žŒํ•œ ๋งํฌ๋ž‘ ์ด๋ฒˆ์ฃผ ์ €์žฅํ•œ ๋งํฌ ๊ฐœ์ˆ˜๋„ ์ €์žฅํ•ด์•ผํ• ๊ฑฐ๊ฐ™์•„์š”!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„ ์—ฌ๊ธฐ๋Š” ๊ทผ๋ฐ ์†Œ์…œ๋กœ๊ทธ์ธ ๋กœ์ง ๋๋‚˜๊ณ  refactor ๋ธŒ๋žœ์น˜๋กœ ๋ฐ˜์˜ํ•ด๋ณด๊ฑฐ๋‚˜? ๊ทธ ๋กœ์ง ๊ตฌํ˜„ํ•  ๋•Œ ํ•„์š”ํ•  ๋•Œ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ์‹์„ ์ƒ๊ฐํ•ด๋ดค๋Š”๋ฐ ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์šฉ?!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„์•„ ๋„ต ์ข‹์•„์š”!!


@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long userId;

@Column(nullable = false, unique = true)
private String nickname;

@Column(nullable = false)
private String socialId;

@Column(nullable = true)
private String refreshToken;

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private SocialType socialType;

@Column(nullable = true)
private String fcmToken;

@Column(nullable = true)
private Boolean fcmIsAllowed = true;

@Builder
public User(String nickname, String socialId, SocialType socialType) {
this.nickname = nickname;
this.socialId = socialId;
this.socialType = socialType;
}

public void updateRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}

public void updateNickname(String nickname) {
this.nickname = nickname;
}

public void updateFcmToken(String fcmToken) { this.fcmToken = fcmToken; }

public void updateFcmIsAllowed(Boolean isAllowed){this.fcmIsAllowed = isAllowed;}

public String getFcmToken() {
if (Objects.nonNull(this.fcmToken)) {
return this.fcmToken;
}
return null;
}
}