-
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.
- Loading branch information
1 parent
1596b9b
commit d2af01b
Showing
9 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,9 +1,24 @@ | ||
package space.space_spring.dao; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.PersistenceContext; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import space.space_spring.domain.User; | ||
import space.space_spring.dto.PostUserRequest; | ||
|
||
@Repository | ||
@Transactional | ||
public class UserDao { | ||
|
||
@PersistenceContext | ||
private EntityManager em; | ||
|
||
public Long saveUser(PostUserRequest postUserRequest) { | ||
User user = new User(); | ||
user.saveUser(postUserRequest.getEmail(), postUserRequest.getPassword(), postUserRequest.getUserName()); | ||
|
||
em.persist(user); | ||
return user.getUserId(); | ||
} | ||
} |
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,22 @@ | ||
package space.space_spring.domain; | ||
|
||
import jakarta.annotation.Nullable; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "Spaces") | ||
public class Space extends BaseEntity { | ||
|
||
@Id @GeneratedValue | ||
@Column(name = "space_id") | ||
private Long spaceId; | ||
|
||
@Column(name = "space_name") | ||
private String spaceName; | ||
|
||
@Column(name = "space_profile_img") | ||
@Nullable | ||
private String spaceProfileImg; | ||
} |
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,42 @@ | ||
package space.space_spring.domain; | ||
|
||
import jakarta.annotation.Nullable; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "User_Space") | ||
public class UserSpace extends BaseEntity { | ||
|
||
@Id @GeneratedValue | ||
@Column(name = "user_space_id") | ||
private Long userSpaceId; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "space_id") | ||
private Space space; | ||
|
||
@Column(name = "user_name") | ||
private String userName; | ||
|
||
@Column(name = "user_profile_img") | ||
@Nullable | ||
private String userProfileImg; | ||
|
||
@Column(name = "user_profile_msg") | ||
@Nullable | ||
private String userProfileMsg; | ||
|
||
@Column(name = "user_auth") | ||
private String userAuth; | ||
|
||
@Column(name = "space_order") | ||
private int spaceOrder; | ||
|
||
|
||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/space/space_spring/dto/PostUserResponse.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,12 @@ | ||
package space.space_spring.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class PostUserResponse { | ||
|
||
private Long userId; | ||
// private String jwt; | ||
} |
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