-
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.
Merge branch 'develop' into feat/#172-project_api
- Loading branch information
Showing
43 changed files
with
668 additions
and
115 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
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
51 changes: 51 additions & 0 deletions
51
src/main/java/io/oeid/mogakgo/domain/achievement/domain/entity/UserAchievement.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,51 @@ | ||
package io.oeid.mogakgo.domain.achievement.domain.entity; | ||
|
||
import io.oeid.mogakgo.domain.user.domain.User; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EntityListeners; | ||
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.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "user_achievement_tb") | ||
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class UserAchievement { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "achievement_id") | ||
private Achievement achievement; | ||
|
||
// TODO: 필요하면 개발하다가 추가 | ||
// @Column(name = "progress_count") | ||
// private Integer progressCount; | ||
|
||
@Column(name = "completed") | ||
private Boolean completed; | ||
|
||
@CreatedDate | ||
@Column(name = "created_at") | ||
private LocalDateTime createdAt; | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/oeid/mogakgo/domain/achievement/domain/entity/UserActivity.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,48 @@ | ||
package io.oeid.mogakgo.domain.achievement.domain.entity; | ||
|
||
import io.oeid.mogakgo.domain.achievement.domain.entity.enums.ActivityType; | ||
import io.oeid.mogakgo.domain.user.domain.User; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
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.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "user_activity_tb") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class UserActivity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "activity_type") | ||
private ActivityType activityType; | ||
|
||
@CreatedDate | ||
@Column(name = "created_at") | ||
private LocalDateTime createdAt; | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/io/oeid/mogakgo/domain/achievement/domain/entity/enums/ActivityType.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,31 @@ | ||
package io.oeid.mogakgo.domain.achievement.domain.entity.enums; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ActivityType { | ||
|
||
FROM_ONE_STEP(List.of(2, 3, 4)), | ||
GOOD_PERSON_GOOD_MEETUP(List.of(5, 6, 7)), | ||
LIKE_E(List.of(8, 9, 10)), | ||
MY_DESTINY(List.of(11)), | ||
CAPTURE_FAIL_EXIST(List.of(12)), | ||
RUN_AWAY_FROM_MONSTAR_BALL(List.of(13)), | ||
PLEASE_GIVE_ME_MOGAK(List.of(14, 15, 16)), | ||
BRAVE_EXPLORER(List.of(17)), | ||
NOMAD_CODER(List.of(18)), | ||
CATCH_ME_IF_YOU_CAN(List.of(19, 20, 21)), | ||
LEAVE_YOUR_MARK(List.of(22)), | ||
WHAT_A_POPULAR_PERSON(List.of(23, 24, 25)), | ||
CONTACT_WITH_GOD(List.of(26)), | ||
FRESH_DEVELOPER(List.of(28, 29, 30)), | ||
; | ||
|
||
private final List<Integer> includedDbIdList; | ||
|
||
ActivityType(List<Integer> includedDbIdList) { | ||
this.includedDbIdList = includedDbIdList; | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/io/oeid/mogakgo/domain/achievement/domain/entity/enums/RequirementType.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,8 @@ | ||
package io.oeid.mogakgo.domain.achievement.domain.entity.enums; | ||
|
||
public enum RequirementType { | ||
SEQUENCE, | ||
ACCUMULATE, | ||
; | ||
|
||
} |
6 changes: 0 additions & 6 deletions
6
src/main/java/io/oeid/mogakgo/domain/achievement/domain/enums/AchievementType.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...main/java/io/oeid/mogakgo/domain/achievement/infrastructure/AchievementJpaRepository.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package io.oeid.mogakgo.domain.achievement.infrastructure; | ||
|
||
import io.oeid.mogakgo.domain.achievement.domain.Achievement; | ||
import io.oeid.mogakgo.domain.achievement.domain.entity.Achievement; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AchievementJpaRepository extends JpaRepository<Achievement, Long> { | ||
|
||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/io/oeid/mogakgo/domain/chat/application/ChatIdSequenceGeneratorService.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,26 @@ | ||
package io.oeid.mogakgo.domain.chat.application; | ||
|
||
import static org.springframework.data.mongodb.core.FindAndModifyOptions.options; | ||
import static org.springframework.data.mongodb.core.query.Criteria.where; | ||
import static org.springframework.data.mongodb.core.query.Query.query; | ||
|
||
import io.oeid.mogakgo.domain.chat.entity.document.ChatIdSequence; | ||
import java.util.Objects; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.mongodb.core.MongoOperations; | ||
import org.springframework.data.mongodb.core.query.Update; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ChatIdSequenceGeneratorService { | ||
|
||
private final MongoOperations mongoOperations; | ||
|
||
public Long generateSequence(String collectionName) { | ||
ChatIdSequence counter = mongoOperations.findAndModify( | ||
query(where("_id").is(collectionName)), new Update().inc("seq", 1), | ||
options().returnNew(true).upsert(true), ChatIdSequence.class); | ||
return !Objects.isNull(counter) ? counter.getSeq() : 1; | ||
} | ||
} |
Oops, something went wrong.