34 arc f5 save slack channels#59
Conversation
…tabase by a schedule
| "id", | ||
| "name" | ||
| }) | ||
| @Getter |
| @Service | ||
| public class SlackApiServiceImpl implements SlackApiService { | ||
|
|
||
| SlackApi slackApi; |
| @Setter | ||
| @NoArgsConstructor | ||
| @ToString | ||
| @EqualsAndHashCode |
| @@ -1,4 +1,4 @@ | |||
| package juja.microservices.slack.archive.model; | |||
| package juja.microservices.slack.archive.model.entity; | |||
There was a problem hiding this comment.
i read spring docs. MongoTemplate doesn't require @entity annotation
9.5. Saving, Updating, and Removing Documents
https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongo-template
and there are two ways with Id annotation.
- A property or field annotated with @id (org.springframework.data.annotation.Id) will be mapped to the _id field.
- A property or field without an annotation but named id will be mapped to the _id field.
I think it is a good case to use @id annotation explicitly
|
|
||
| public class Util { | ||
|
|
||
| public static String getFile(String fileName){ |
| import java.util.List; | ||
|
|
||
| @SpringBootApplication | ||
| @EnableScheduling |
There was a problem hiding this comment.
Please, move @EnableScheduling to SchedulerConfig class
It will be better
| @@ -1,4 +1,4 @@ | |||
| package juja.microservices.slack.archive.model; | |||
| package juja.microservices.slack.archive.model.entity; | |||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface ArchiveRepository { |
There was a problem hiding this comment.
Maybe better extract logic for messages to another repository
and rename this repo to slackchannelrepository ?
what do you think?
There was a problem hiding this comment.
Oh you suggest it too) ok I will do it
|
|
||
| @Repository | ||
| @Slf4j | ||
| public class SlackApiImpl implements SlackApi { |
There was a problem hiding this comment.
Maybe is better naming for interface SlackApiClient?
|
|
||
| @Override | ||
| public List<ChannelDTO> receiveChannelsList() { | ||
| String urlTemplate = slackApiChannelsUrlTemplate + slackApiToken; |
There was a problem hiding this comment.
Old service use simpleslackapi,
Why do you use resttemplate instead?
There was a problem hiding this comment.
I will sort out with simpleSlackApi
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import lombok.Getter; | ||
| import lombok.*; |
|
|
||
| import java.util.List; | ||
|
|
||
| public interface ArchiveService { |
There was a problem hiding this comment.
Maybe is better naming ChannelService and extract some messages logic to another service
There was a problem hiding this comment.
Yes, it is a good idea and in this case I will do separate repositories for channel and messages
|
|
||
| String result = ""; | ||
|
|
||
| Foo foo = new Foo(); |
There was a problem hiding this comment.
the strange logic for reading the file
For example, you can use in test
IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName));
There was a problem hiding this comment.
the method is static, I can't use non static method this.getClass() here
There was a problem hiding this comment.
I want to return this code into test or another case classz should be ones from parameters this method
After that this method becomes simple
|
@NikolayNN please update your branch from upstream and fix conflicts |
…lack-channels # Conflicts: # slack-archive/src/main/java/juja/microservices/slack/archive/SlackArchiveApplication.java
…o ChannelService, MessageService and ChannelRepository, MessageRepository
connect #34