-
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.
Chore/conversation controller functionalities (#12)
* add get all conversations * add get conversation by id * add List<Discussion> for conversation * make code spotless * add entity mapper * add entity mapper * modify entity mapper * modify entity mapper * modify entity mapper * added Base Model * added Base Model * refactor model package to dto
- Loading branch information
Showing
17 changed files
with
106 additions
and
51 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
2 changes: 1 addition & 1 deletion
2
...ava/com/llm_service/llm_service/controller/conversation/ConversationControllerMapper.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
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
4 changes: 2 additions & 2 deletions
4
...in/java/com/llm_service/llm_service/controller/discussion/DiscussionControllerMapper.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
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/llm_service/llm_service/dto/Base.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,14 @@ | ||
package com.llm_service.llm_service.dto; | ||
|
||
import java.time.Instant; | ||
import java.util.UUID; | ||
import lombok.Data; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@SuperBuilder(toBuilder = true) | ||
@Data | ||
public abstract class Base { | ||
UUID id; | ||
Instant createdOn; | ||
Instant lastUpdatedOn; | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/llm_service/llm_service/dto/Conversation.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,14 @@ | ||
package com.llm_service.llm_service.dto; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@SuperBuilder(toBuilder = true) | ||
@Data | ||
public class Conversation extends Base { | ||
List<UUID> discussions; | ||
} |
17 changes: 17 additions & 0 deletions
17
backend/src/main/java/com/llm_service/llm_service/dto/Discussion.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,17 @@ | ||
package com.llm_service.llm_service.dto; | ||
|
||
import com.llm_service.llm_service.persistance.entities.DiscussionRole; | ||
import java.util.UUID; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@SuperBuilder(toBuilder = true) | ||
@Data | ||
public class Discussion extends Base { | ||
UUID id; | ||
String text; | ||
DiscussionRole promptRole; | ||
Conversation conversation; | ||
} |
12 changes: 0 additions & 12 deletions
12
backend/src/main/java/com/llm_service/llm_service/model/Conversation.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
backend/src/main/java/com/llm_service/llm_service/model/Discussion.java
This file was deleted.
Oops, something went wrong.
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
13 changes: 12 additions & 1 deletion
13
...m_service/llm_service/persistance/repositories/conversation/ConversationEntityMapper.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,12 +1,23 @@ | ||
package com.llm_service.llm_service.persistance.repositories.conversation; | ||
|
||
import com.llm_service.llm_service.model.Conversation; | ||
import com.llm_service.llm_service.dto.Conversation; | ||
import com.llm_service.llm_service.persistance.entities.ConversationEntity; | ||
import com.llm_service.llm_service.persistance.entities.DiscussionEntity; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface ConversationEntityMapper { | ||
Conversation map(ConversationEntity conversationEntity); | ||
|
||
ConversationEntity map(Conversation conversation); | ||
|
||
List<UUID> map(List<DiscussionEntity> discussionEntities); | ||
|
||
List<DiscussionEntity> mapToEntities(List<UUID> discussionIds); | ||
|
||
UUID map(DiscussionEntity discussionEntity); | ||
|
||
DiscussionEntity map(UUID value); | ||
} |
2 changes: 1 addition & 1 deletion
2
.../llm_service/persistance/repositories/conversation/ConversationJpaPersistenceManager.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
2 changes: 1 addition & 1 deletion
2
...ice/llm_service/persistance/repositories/conversation/ConversationPersistenceManager.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
14 changes: 13 additions & 1 deletion
14
...m/llm_service/llm_service/persistance/repositories/discussion/DiscussionEntityMapper.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,12 +1,24 @@ | ||
package com.llm_service.llm_service.persistance.repositories.discussion; | ||
|
||
import com.llm_service.llm_service.model.Discussion; | ||
import com.llm_service.llm_service.dto.Discussion; | ||
import com.llm_service.llm_service.persistance.entities.DiscussionEntity; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface DiscussionEntityMapper { | ||
Discussion map(DiscussionEntity discussionEntity); | ||
|
||
DiscussionEntity map(Discussion discussion); | ||
|
||
// TODO Thee mappings should be removed, | ||
// should be done with @Mapper annotation | ||
List<UUID> map(List<DiscussionEntity> discussionEntities); | ||
|
||
UUID mapToId(DiscussionEntity discussionEntity); | ||
|
||
List<DiscussionEntity> mapToEntities(List<UUID> discussionIds); | ||
|
||
DiscussionEntity map(UUID value); | ||
} |
2 changes: 1 addition & 1 deletion
2
...vice/llm_service/persistance/repositories/discussion/DiscussionJpaPersistenceManager.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
2 changes: 1 addition & 1 deletion
2
...service/llm_service/persistance/repositories/discussion/DiscussionPersistenceManager.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
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