Skip to content

34 arc f5 save slack channels#59

Open
NikolayNN wants to merge 11 commits intoJujaLabs:developfrom
NikolayNN:34-ARC-F5-save-slack-channels
Open

34 arc f5 save slack channels#59
NikolayNN wants to merge 11 commits intoJujaLabs:developfrom
NikolayNN:34-ARC-F5-save-slack-channels

Conversation

@NikolayNN
Copy link
Copy Markdown

connect #34

"id",
"name"
})
@Getter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe @DaTa instead of many Annotations?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

@Service
public class SlackApiServiceImpl implements SlackApiService {

SlackApi slackApi;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

private?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

@Setter
@NoArgsConstructor
@ToString
@EqualsAndHashCode
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

need @entity annotation

@@ -1,4 +1,4 @@
package juja.microservices.slack.archive.model;
package juja.microservices.slack.archive.model.entity;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

need @entity annotation

Copy link
Copy Markdown
Author

@NikolayNN NikolayNN Dec 27, 2017

Choose a reason for hiding this comment

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

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.

  1. A property or field annotated with @id (org.springframework.data.annotation.Id) will be mapped to the _id field.
  2. 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with Nikolay


public class Util {

public static String getFile(String fileName){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe "readStringFromFile" ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

hamster4n
hamster4n previously approved these changes Dec 26, 2017
import java.util.List;

@SpringBootApplication
@EnableScheduling
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please, move @EnableScheduling to SchedulerConfig class
It will be better

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

@@ -1,4 +1,4 @@
package juja.microservices.slack.archive.model;
package juja.microservices.slack.archive.model.entity;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with Nikolay


import java.util.List;

public interface ArchiveRepository {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe better extract logic for messages to another repository
and rename this repo to slackchannelrepository ?

what do you think?

Copy link
Copy Markdown
Author

@NikolayNN NikolayNN Jan 8, 2018

Choose a reason for hiding this comment

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

Oh you suggest it too) ok I will do it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done!


@Repository
@Slf4j
public class SlackApiImpl implements SlackApi {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe is better naming for interface SlackApiClient?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done


@Override
public List<ChannelDTO> receiveChannelsList() {
String urlTemplate = slackApiChannelsUrlTemplate + slackApiToken;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Old service use simpleslackapi,
Why do you use resttemplate instead?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I will sort out with simpleSlackApi

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.*;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No * import

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done


import java.util.List;

public interface ArchiveService {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe is better naming ChannelService and extract some messages logic to another service

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, it is a good idea and in this case I will do separate repositories for channel and messages

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done!


String result = "";

Foo foo = new Foo();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the strange logic for reading the file
For example, you can use in test
IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

the method is static, I can't use non static method this.getClass() here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@danilkuznetsov
Copy link
Copy Markdown
Member

danilkuznetsov commented Jan 3, 2018

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants