Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85c019a

Browse files
committed
implement home page back-end
1 parentdc44696 commit85c019a

File tree

43 files changed

+1140
-65
lines changed

Some content is hidden

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

43 files changed

+1140
-65
lines changed

‎front-end/src/store/getters.js‎

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
1-
// export const user = state => state.user
2-
exportconstuser=state=>{return{name:'James J. Ye'}}
1+
exportconstuser=state=>state.user
32

43
exportconsthasBoards=state=>{
5-
// return state.boards.length > 0
6-
returntrue
4+
returnstate.boards.length>0
75
}
86

97
exportconstpersonalBoards=state=>{
10-
// return state.boards.filter(board => board.teamId === 0)
11-
return[{
12-
id:1,
13-
name:'vuejs.spring-boot.mysql',
14-
description:'An implementation of TaskAgile application with Vue.js, Spring Boot, and MySQL'
15-
}]
8+
returnstate.boards.filter(board=>board.teamId===0)
169
}
1710

1811
exportconstteamBoards=state=>{
19-
// const teams = []
20-
//
21-
// state.teams.forEach(team => {
22-
// teams.push({
23-
// id: team.id,
24-
// name: team.name,
25-
// boards: state.boards.filter(board => board.teamId === team.id)
26-
// })
27-
// })
28-
//
29-
// return teams
30-
return[{
31-
id:1,
32-
name:'Sales & Marketing',
33-
boards:[{
34-
id:2,
35-
name:'2018 Planning',
36-
description:'2018 sales & marketing planning'
37-
},{
38-
id:3,
39-
name:'Ongoing Campaigns',
40-
description:'2018 ongoing marketing campaigns'
41-
}]
42-
}]
12+
constteams=[]
13+
14+
state.teams.forEach(team=>{
15+
teams.push({
16+
id:team.id,
17+
name:team.name,
18+
boards:state.boards.filter(board=>board.teamId===team.id)
19+
})
20+
})
21+
22+
returnteams
4323
}

‎src/main/java/com/taskagile/config/SecurityConfiguration.java‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
packagecom.taskagile.config;
22

3+
importcom.taskagile.domain.common.security.AccessDeniedHandlerImpl;
34
importcom.taskagile.web.apis.authenticate.AuthenticationFilter;
45
importcom.taskagile.web.apis.authenticate.SimpleAuthenticationFailureHandler;
56
importcom.taskagile.web.apis.authenticate.SimpleAuthenticationSuccessHandler;
@@ -11,6 +12,7 @@
1112
importorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
1213
importorg.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
1314
importorg.springframework.security.crypto.password.PasswordEncoder;
15+
importorg.springframework.security.web.access.AccessDeniedHandler;
1416
importorg.springframework.security.web.authentication.AuthenticationFailureHandler;
1517
importorg.springframework.security.web.authentication.AuthenticationSuccessHandler;
1618
importorg.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@@ -25,19 +27,21 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
2527
@Override
2628
protectedvoidconfigure(HttpSecurityhttp)throwsException {
2729
http
30+
.exceptionHandling().accessDeniedHandler(accessDeniedHandler())
31+
.and()
2832
.authorizeRequests()
29-
.antMatchers(PUBLIC).permitAll()
30-
.anyRequest().authenticated()
33+
.antMatchers(PUBLIC).permitAll()
34+
.anyRequest().authenticated()
3135
.and()
32-
.addFilterAt(authenticationFilter(),UsernamePasswordAuthenticationFilter.class)
33-
.formLogin()
34-
.loginPage("/login")
36+
.addFilterAt(authenticationFilter(),UsernamePasswordAuthenticationFilter.class)
37+
.formLogin()
38+
.loginPage("/login")
3539
.and()
36-
.logout()
37-
.logoutUrl("/logout")
38-
.logoutSuccessHandler(logoutSuccessHandler())
40+
.logout()
41+
.logoutUrl("/logout")
42+
.logoutSuccessHandler(logoutSuccessHandler())
3943
.and()
40-
.csrf().disable();
44+
.csrf().disable();
4145
}
4246

4347
@Override
@@ -73,4 +77,8 @@ public AuthenticationFailureHandler authenticationFailureHandler() {
7377
publicLogoutSuccessHandlerlogoutSuccessHandler() {
7478
returnnewSimpleLogoutSuccessHandler();
7579
}
80+
81+
publicAccessDeniedHandleraccessDeniedHandler() {
82+
returnnewAccessDeniedHandlerImpl();
83+
}
7684
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
packagecom.taskagile.domain.application;
2+
3+
importcom.taskagile.domain.application.commands.CreateBoardCommand;
4+
importcom.taskagile.domain.model.board.Board;
5+
importcom.taskagile.domain.model.user.UserId;
6+
7+
importjava.util.List;
8+
9+
publicinterfaceBoardService {
10+
11+
/**
12+
* Find the boards that a user is a member, including those boards
13+
* the user created as well as joined.
14+
*
15+
* @param userId the id of the user
16+
* @return a list of boards or an empty list if none found
17+
*/
18+
List<Board>findBoardsByMembership(UserIduserId);
19+
20+
/**
21+
* Create a new board
22+
*
23+
* @param command the command instance
24+
* @return the new board just created
25+
*/
26+
BoardcreateBoard(CreateBoardCommandcommand);
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
packagecom.taskagile.domain.application;
2+
3+
importcom.taskagile.domain.application.commands.CreateTeamCommand;
4+
importcom.taskagile.domain.model.team.Team;
5+
importcom.taskagile.domain.model.user.UserId;
6+
7+
importjava.util.List;
8+
9+
publicinterfaceTeamService {
10+
11+
/**
12+
* Find the teams that created by a user
13+
*
14+
* @param userId the id of the user
15+
* @return a list of teams or an empty list if none found
16+
*/
17+
List<Team>findTeamsByUserId(UserIduserId);
18+
19+
/**
20+
* Create a new team
21+
*
22+
* @param command the command instance
23+
* @return the newly created team
24+
*/
25+
TeamcreateTeam(CreateTeamCommandcommand);
26+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
packagecom.taskagile.domain.application.commands;
2+
3+
importcom.taskagile.domain.model.team.TeamId;
4+
importcom.taskagile.domain.model.user.UserId;
5+
6+
publicclassCreateBoardCommand {
7+
8+
privateUserIduserId;
9+
privateStringname;
10+
privateStringdescription;
11+
privateTeamIdteamId;
12+
13+
publicCreateBoardCommand(UserIduserId,Stringname,Stringdescription,TeamIdteamId) {
14+
this.userId =userId;
15+
this.name =name;
16+
this.description =description;
17+
this.teamId =teamId;
18+
}
19+
20+
publicUserIdgetUserId() {
21+
returnuserId;
22+
}
23+
24+
publicStringgetName() {
25+
returnname;
26+
}
27+
28+
publicStringgetDescription() {
29+
returndescription;
30+
}
31+
32+
publicTeamIdgetTeamId() {
33+
returnteamId;
34+
}
35+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
packagecom.taskagile.domain.application.commands;
2+
3+
importcom.taskagile.domain.model.user.UserId;
4+
5+
publicclassCreateTeamCommand {
6+
7+
privateUserIduserId;
8+
privateStringname;
9+
10+
publicCreateTeamCommand(UserIduserId,Stringname) {
11+
this.userId =userId;
12+
this.name =name;
13+
}
14+
15+
publicUserIdgetUserId() {
16+
returnuserId;
17+
}
18+
19+
publicStringgetName() {
20+
returnname;
21+
}
22+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
packagecom.taskagile.domain.application.impl;
2+
3+
importcom.taskagile.domain.application.BoardService;
4+
importcom.taskagile.domain.application.commands.CreateBoardCommand;
5+
importcom.taskagile.domain.common.event.DomainEventPublisher;
6+
importcom.taskagile.domain.model.board.Board;
7+
importcom.taskagile.domain.model.board.BoardManagement;
8+
importcom.taskagile.domain.model.board.BoardRepository;
9+
importcom.taskagile.domain.model.board.events.BoardCreatedEvent;
10+
importcom.taskagile.domain.model.user.UserId;
11+
importorg.springframework.stereotype.Service;
12+
13+
importjavax.transaction.Transactional;
14+
importjava.util.List;
15+
16+
@Service
17+
@Transactional
18+
publicclassBoardServiceImplimplementsBoardService {
19+
20+
privateBoardRepositoryboardRepository;
21+
privateBoardManagementboardManagement;
22+
privateDomainEventPublisherdomainEventPublisher;
23+
24+
publicBoardServiceImpl(BoardRepositoryboardRepository,
25+
BoardManagementboardManagement,
26+
DomainEventPublisherdomainEventPublisher) {
27+
this.boardRepository =boardRepository;
28+
this.boardManagement =boardManagement;
29+
this.domainEventPublisher =domainEventPublisher;
30+
}
31+
32+
@Override
33+
publicList<Board>findBoardsByMembership(UserIduserId) {
34+
returnboardRepository.findBoardsByMembership(userId);
35+
}
36+
37+
@Override
38+
publicBoardcreateBoard(CreateBoardCommandcommand) {
39+
Boardboard =boardManagement.createBoard(command.getUserId(),command.getName(),
40+
command.getDescription(),command.getTeamId());
41+
domainEventPublisher.publish(newBoardCreatedEvent(this,board));
42+
returnboard;
43+
}
44+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
packagecom.taskagile.domain.application.impl;
2+
3+
importcom.taskagile.domain.application.TeamService;
4+
importcom.taskagile.domain.application.commands.CreateTeamCommand;
5+
importcom.taskagile.domain.common.event.DomainEventPublisher;
6+
importcom.taskagile.domain.model.team.Team;
7+
importcom.taskagile.domain.model.team.TeamRepository;
8+
importcom.taskagile.domain.model.team.events.TeamCreatedEvent;
9+
importcom.taskagile.domain.model.user.UserId;
10+
importorg.springframework.stereotype.Service;
11+
12+
importjavax.transaction.Transactional;
13+
importjava.util.List;
14+
15+
@Service
16+
@Transactional
17+
publicclassTeamServiceImplimplementsTeamService {
18+
19+
privateTeamRepositoryteamRepository;
20+
privateDomainEventPublisherdomainEventPublisher;
21+
22+
publicTeamServiceImpl(TeamRepositoryteamRepository,DomainEventPublisherdomainEventPublisher) {
23+
this.teamRepository =teamRepository;
24+
this.domainEventPublisher =domainEventPublisher;
25+
}
26+
27+
@Override
28+
publicList<Team>findTeamsByUserId(UserIduserId) {
29+
returnteamRepository.findTeamsByUserId(userId);
30+
}
31+
32+
@Override
33+
publicTeamcreateTeam(CreateTeamCommandcommand) {
34+
Teamteam =Team.create(command.getName(),command.getUserId());
35+
teamRepository.save(team);
36+
domainEventPublisher.publish(newTeamCreatedEvent(this,team));
37+
returnteam;
38+
}
39+
}

‎src/main/java/com/taskagile/domain/application/impl/UserServiceImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void register(RegistrationCommand command) throws RegistrationException {
6161
command.getPassword());
6262

6363
sendWelcomeMessage(newUser);
64-
domainEventPublisher.publish(newUserRegisteredEvent(newUser));
64+
domainEventPublisher.publish(newUserRegisteredEvent(this,newUser));
6565
}
6666

6767
privatevoidsendWelcomeMessage(Useruser) {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
packagecom.taskagile.domain.common.model;
2+
3+
importjava.io.Serializable;
4+
5+
publicabstractclassAbstractBaseIdimplementsSerializable {
6+
7+
privatestaticfinallongserialVersionUID =3435210296634626689L;
8+
9+
privatelongid;
10+
11+
publicAbstractBaseId(longid) {
12+
this.id =id;
13+
}
14+
15+
publiclongvalue() {
16+
returnid;
17+
}
18+
19+
publicbooleanisValid() {
20+
returnid >0;
21+
}
22+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp