JujaLabs / juja-platform

0 stars 7 forks source link

Add 'owner' to Links #51

Open Moses-odessa opened 6 years ago

Moses-odessa commented 6 years ago
Task 'As a user I want to own link that I added to storage'
Microservice - LINKS SLACK BOT
Subtask 'Add ownner to link logic' from milestone
https://github.com/JujaLabs/juja-platform/milestones/2

1) What is this feature/fix provided for?
    User want to own added link.

2) List the objects you want to add or change, use appropriate API annotations
    Model:
        Update class SaveLinkRequest
            private final String owner  
            this field is uuid of User form Users microservice

        Update class Link
            private final String owner

        Create class User
            public class User {
                @JsonProperty
                private String uuid;
                @JsonProperty("slackId")
                private String slackUser;
                }

    Controller:
        Update method onReceiveSlashCommandSaveLink
            add parameter @RequestParam("user_id") String fromSlackUser

    Users Service:
        Create UsersService interface and implementation classes:
            implement method List findUsersBySlackUsers(List slackUsers);

    Users Repository 
        Create UsersRepository interface and implementation classes:
            implement method List findUsersBySlackUsers(List slackUsers);
            method have to go to Users microservice via particular feignClient fetch Users from it by List 
        Add new FeignClient to interact with Users microservice
        For example @FeignClient(name = "gateway", url = "localhost:8090") without Eureka dependencies

    Links Service:
        Update method Link saveLink(String fromSlackUser, String text)
        Change logic to found Users uuid by slackUser in UsersService

3) Are there any special requirements or constraints?
    Response to slack have to contain id of saved link in message

4) What behavior do you expect? Any examples?