Skip to content

Commit 044661e

Browse files
committed
implement tracking activity with amqp
1 parent 7cf27f2 commit 044661e

File tree

78 files changed

+1037
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1037
-422
lines changed

front-end/src/modals/CardModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div class="description" v-show="description && !editingDescription" v-html="descriptionHtml"></div>
3434
</div>
3535
</div>
36-
<div class="wrapper attachments-wrapper" v-show="attachments.length">
36+
<div class="wrapper attachments-wrapper" v-show="attachments.length || uploadingCount">
3737
<h5><font-awesome-icon icon="paperclip" class="icon"/> <span>Attachments</span></h5>
3838
<div class="wrapper-body">
3939
<div class="uploading" v-show="uploadingCount"><font-awesome-icon icon="spinner" class="fa-spin" spin/>Uploading...</div>

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
</exclusion>
6666
</exclusions>
6767
</dependency>
68+
<dependency>
69+
<groupId>org.springframework.boot</groupId>
70+
<artifactId>spring-boot-starter-amqp</artifactId>
71+
</dependency>
6872
<dependency>
6973
<groupId>mysql</groupId>
7074
<artifactId>mysql-connector-java</artifactId>

setup/2.refactoring-database.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ALTER TABLE `task_agile`.`card` ADD CONSTRAINT `fk_card_board_board_id`
1515
ALTER TABLE `task_agile`.`activity` CHANGE COLUMN `board_id` `board_id` INT(11) NULL COMMENT '' AFTER `card_id`;
1616
-- Change type to support integer value other than 0, 1
1717
ALTER TABLE `task_agile`.`activity` CHANGE COLUMN `type` `type` INT(11) NOT NULL COMMENT '' AFTER `board_id`;
18+
-- Add `ip_address` to activity table
19+
ALTER TABLE `task_agile`.`activity` ADD COLUMN `ip_address` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' AFTER `detail`;
20+
1821
-- Change file_type to be a varchar
1922
ALTER TABLE `task_agile`.`attachment` CHANGE COLUMN `file_type` `file_type` VARCHAR(32) NOT NULL DEFAULT '' COMMENT '' AFTER `file_path`;
2023
-- Add thumbnail_created to attachment
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.taskagile.config;
2+
3+
import org.springframework.amqp.core.Binding;
4+
import org.springframework.amqp.core.BindingBuilder;
5+
import org.springframework.amqp.core.FanoutExchange;
6+
import org.springframework.amqp.core.Queue;
7+
import org.springframework.context.annotation.Bean;
8+
import org.springframework.context.annotation.Configuration;
9+
10+
@Configuration
11+
public class MessageConfiguration {
12+
13+
@Bean
14+
public FanoutExchange domainEventsExchange() {
15+
return new FanoutExchange("ta.domain.events", true, false);
16+
}
17+
18+
@Bean
19+
public Queue activityTrackingQueue() {
20+
return new Queue("ta.activity.tracking", true);
21+
}
22+
23+
@Bean
24+
public Binding bindingActivityTracking(FanoutExchange exchange, Queue activityTrackingQueue) {
25+
return BindingBuilder.bind(activityTrackingQueue).to(exchange);
26+
}
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.taskagile.domain.application;
2+
3+
import com.taskagile.domain.model.activity.Activity;
4+
5+
public interface ActivityService {
6+
7+
/**
8+
* Save an activity
9+
*
10+
* @param activity the activity instance
11+
*/
12+
void saveActivity(Activity activity);
13+
}

src/main/java/com/taskagile/domain/application/BoardService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.taskagile.domain.application;
22

3+
import com.taskagile.domain.application.commands.AddBoardMemberCommand;
34
import com.taskagile.domain.application.commands.CreateBoardCommand;
45
import com.taskagile.domain.model.board.Board;
56
import com.taskagile.domain.model.board.BoardId;
@@ -47,10 +48,9 @@ public interface BoardService {
4748
/**
4849
* Add board member
4950
*
50-
* @param boardId id of the board
51-
* @param usernameOrEmailAddress username or email address
51+
* @param command the command instance
5252
* @return newly added member user
5353
* @throws UserNotFoundException user by the usernameOrEmailAddress not found
5454
*/
55-
User addMember(BoardId boardId, String usernameOrEmailAddress) throws UserNotFoundException;
55+
User addMember(AddBoardMemberCommand command) throws UserNotFoundException;
5656
}

src/main/java/com/taskagile/domain/application/TeamService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.taskagile.domain.application;
22

33
import com.taskagile.domain.application.commands.CreateTeamCommand;
4-
import com.taskagile.domain.model.board.Board;
54
import com.taskagile.domain.model.team.Team;
65
import com.taskagile.domain.model.team.TeamId;
76
import com.taskagile.domain.model.user.UserId;

src/main/java/com/taskagile/domain/application/UserService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.taskagile.domain.application;
22

3-
import com.taskagile.domain.application.commands.RegistrationCommand;
3+
import com.taskagile.domain.application.commands.RegisterCommand;
44
import com.taskagile.domain.model.user.RegistrationException;
55
import com.taskagile.domain.model.user.User;
66
import com.taskagile.domain.model.user.UserId;
@@ -19,10 +19,10 @@ public interface UserService extends UserDetailsService {
1919
/**
2020
* Register a new user with username, email address, and password.
2121
*
22-
* @param command instance of <code>RegistrationCommand</code>
22+
* @param command instance of <code>RegisterCommand</code>
2323
* @throws RegistrationException when registration failed. Possible reasons are:
2424
* 1) Username already exists
2525
* 2) Email address already exists.
2626
*/
27-
void register(RegistrationCommand command) throws RegistrationException;
27+
void register(RegisterCommand command) throws RegistrationException;
2828
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.taskagile.domain.application.commands;
2+
3+
import com.taskagile.domain.model.board.BoardId;
4+
5+
public class AddBoardMemberCommand extends UserCommand {
6+
7+
private BoardId boardId;
8+
private String usernameOrEmailAddress;
9+
10+
public AddBoardMemberCommand(BoardId boardId, String usernameOrEmailAddress) {
11+
this.boardId = boardId;
12+
this.usernameOrEmailAddress = usernameOrEmailAddress;
13+
}
14+
15+
public BoardId getBoardId() {
16+
return boardId;
17+
}
18+
19+
public String getUsernameOrEmailAddress() {
20+
return usernameOrEmailAddress;
21+
}
22+
}
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
package com.taskagile.domain.application.commands;
22

33
import com.taskagile.domain.model.card.CardId;
4-
import com.taskagile.domain.model.user.UserId;
54
import org.springframework.web.multipart.MultipartFile;
65

7-
public class AddCardAttachmentCommand {
6+
public class AddCardAttachmentCommand extends UserCommand {
87

98
private CardId cardId;
109
private MultipartFile file;
11-
private UserId userId;
1210

13-
public AddCardAttachmentCommand(long cardId, MultipartFile file, UserId userId) {
11+
public AddCardAttachmentCommand(long cardId, MultipartFile file) {
1412
this.cardId = new CardId(cardId);
1513
this.file = file;
16-
this.userId = userId;
1714
}
1815

1916
public CardId getCardId() {
@@ -23,8 +20,4 @@ public CardId getCardId() {
2320
public MultipartFile getFile() {
2421
return file;
2522
}
26-
27-
public UserId getUserId() {
28-
return userId;
29-
}
3023
}

0 commit comments

Comments
 (0)