mirror of https://github.com/elunez/eladmin
				
				
				
			add Match
							parent
							
								
									e7b914c00b
								
							
						
					
					
						commit
						55f7ab3e21
					
				| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
-- Create event_player join table for co-host players
 | 
			
		||||
CREATE TABLE event_co_host_player (
 | 
			
		||||
    event_id BIGINT,
 | 
			
		||||
    player_id BIGINT,
 | 
			
		||||
    PRIMARY KEY (event_id, player_id),
 | 
			
		||||
    CONSTRAINT fk_event_player_event FOREIGN KEY (event_id) REFERENCES event(id),
 | 
			
		||||
    CONSTRAINT fk_event_player_player FOREIGN KEY (player_id) REFERENCES player(id)
 | 
			
		||||
);
 | 
			
		||||
| 
						 | 
				
			
			@ -29,6 +29,8 @@ import java.sql.Timestamp;
 | 
			
		|||
import javax.validation.constraints.NotBlank;
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @website https://eladmin.vip
 | 
			
		||||
| 
						 | 
				
			
			@ -126,6 +128,12 @@ public class Event implements Serializable {
 | 
			
		|||
    @Column(name = "`allow_wait_list`")
 | 
			
		||||
    private boolean allowWaitList;
 | 
			
		||||
 | 
			
		||||
    @ManyToMany
 | 
			
		||||
    @JoinTable(name = "event_player",
 | 
			
		||||
            joinColumns = {@JoinColumn(name = "event_id",referencedColumnName = "id")},
 | 
			
		||||
            inverseJoinColumns = {@JoinColumn(name = "player_id",referencedColumnName = "id")})
 | 
			
		||||
    private List<Player> coHostPlayers = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    public void copy(Event source){
 | 
			
		||||
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,8 +23,8 @@ public class Match implements Serializable {
 | 
			
		|||
    private MatchGroup matchGroup;
 | 
			
		||||
 | 
			
		||||
    @ManyToOne
 | 
			
		||||
    @JoinColumn(name = "team_player_a_id")
 | 
			
		||||
    private TeamPlayer teamPlayerA;
 | 
			
		||||
    @JoinColumn(name = "team_a_id")
 | 
			
		||||
    private TeamPlayer teamA;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "`score_a`")
 | 
			
		||||
    @ApiModelProperty(value = "Score A")
 | 
			
		||||
| 
						 | 
				
			
			@ -41,8 +41,8 @@ public class Match implements Serializable {
 | 
			
		|||
    private boolean teamBWin;
 | 
			
		||||
 | 
			
		||||
    @ManyToOne
 | 
			
		||||
    @JoinColumn(name = "team_player_b_id")
 | 
			
		||||
    private TeamPlayer teamPlayerB;
 | 
			
		||||
    @JoinColumn(name = "team_b_id")
 | 
			
		||||
    private Team teamB;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "`score_verified`")
 | 
			
		||||
    private boolean scoreVerified;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,8 @@ import lombok.Setter;
 | 
			
		|||
 | 
			
		||||
import javax.persistence.*;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Getter
 | 
			
		||||
@Setter
 | 
			
		||||
| 
						 | 
				
			
			@ -25,4 +27,11 @@ public class MatchGroup implements Serializable {
 | 
			
		|||
    @ManyToOne
 | 
			
		||||
    @JoinColumn(name = "event_id")
 | 
			
		||||
    private Event event;
 | 
			
		||||
 | 
			
		||||
    // how many teams in one group
 | 
			
		||||
    @Column(name = "`group_team_size`")
 | 
			
		||||
    private int groupTeamSize;
 | 
			
		||||
 | 
			
		||||
    @OneToMany(mappedBy = "matchGroup")
 | 
			
		||||
    private List<Team> teams = new ArrayList<>();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,10 @@ public class Team implements Serializable {
 | 
			
		|||
    @ApiModelProperty(value = "id", hidden = true)
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @ManyToOne
 | 
			
		||||
    @JoinColumn(name = "match_group_id")
 | 
			
		||||
    private MatchGroup matchGroup;
 | 
			
		||||
 | 
			
		||||
    @ManyToOne
 | 
			
		||||
    @JoinColumn(name = "event_id")
 | 
			
		||||
    private Event event;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,7 @@ import lombok.Data;
 | 
			
		|||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @website https://eladmin.vip
 | 
			
		||||
| 
						 | 
				
			
			@ -85,4 +86,7 @@ public class EventDto implements Serializable {
 | 
			
		|||
    private boolean isPublic;
 | 
			
		||||
 | 
			
		||||
    private boolean allowWaitList;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Co-host players")
 | 
			
		||||
    private List<PlayerDto> coHostPlayers;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -35,15 +35,24 @@ public class MatchDto implements Serializable {
 | 
			
		|||
    @ApiModelProperty(value = "Match Group id")
 | 
			
		||||
    private Long matchGroupId;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Team 1 id")
 | 
			
		||||
    private Long team1Id;
 | 
			
		||||
    @ApiModelProperty(value = "Team A id")
 | 
			
		||||
    private Long teamA;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Team 2 id")
 | 
			
		||||
    private Long team2Id;
 | 
			
		||||
    @ApiModelProperty(value = "Team B id")
 | 
			
		||||
    private Long teamB;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Score Team 1")
 | 
			
		||||
    private Integer scoreTeam1;
 | 
			
		||||
    @ApiModelProperty(value = "Score A")
 | 
			
		||||
    private Integer scoreA;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Score Team 2")
 | 
			
		||||
    private Integer scoreTeam2;
 | 
			
		||||
    @ApiModelProperty(value = "Score B")
 | 
			
		||||
    private Integer scoreB;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Team A Win")
 | 
			
		||||
    private Boolean teamAWin;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Team B Win")
 | 
			
		||||
    private Boolean teamBWin;
 | 
			
		||||
    
 | 
			
		||||
    @ApiModelProperty(value = "Score Verified")
 | 
			
		||||
    private Boolean scoreVerified;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue