From 33aaa6a32b163826311099d63109a20642f1e62c Mon Sep 17 00:00:00 2001 From: chanhengseang Date: Mon, 26 May 2025 10:06:15 -0700 Subject: [PATCH] event organizer and rating history --- .../db/migration/V10__add_rating_history.sql | 26 +++++++++++++++++++ .../java/com/srr/domain/EventOrganizer.java | 4 +++ .../java/com/srr/dto/EventOrganizerDto.java | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 eladmin-system/src/main/resources/db/migration/V10__add_rating_history.sql diff --git a/eladmin-system/src/main/resources/db/migration/V10__add_rating_history.sql b/eladmin-system/src/main/resources/db/migration/V10__add_rating_history.sql new file mode 100644 index 00000000..5362845d --- /dev/null +++ b/eladmin-system/src/main/resources/db/migration/V10__add_rating_history.sql @@ -0,0 +1,26 @@ +-- Add rating_history table +CREATE TABLE rating_history +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + player_id BIGINT NOT NULL COMMENT 'Player ID', + rate_score DOUBLE NULL COMMENT 'Rating score', + changes DOUBLE NULL COMMENT 'Score changes', + create_time TIMESTAMP NULL COMMENT 'Creation time', + match_id BIGINT NULL COMMENT 'Match ID', + CONSTRAINT fk_rating_history_player FOREIGN KEY (player_id) REFERENCES player (id), + CONSTRAINT fk_rating_history_match FOREIGN KEY (match_id) REFERENCES `match` (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Rating History'; + +-- Create index for fast lookup by player and match +CREATE INDEX idx_rating_history_player ON rating_history (player_id); +CREATE INDEX idx_rating_history_match ON rating_history (match_id); + +-- Update event_organizer table with additional fields +ALTER TABLE event_organizer + ADD COLUMN description VARCHAR(255) NULL COMMENT 'Description', +ADD COLUMN create_time TIMESTAMP NULL COMMENT 'Creation time', +ADD COLUMN update_time TIMESTAMP NULL COMMENT 'Update time'; + +-- Create index for faster lookup by user_id +CREATE INDEX idx_event_organizer_user ON event_organizer (user_id); + diff --git a/sport/src/main/java/com/srr/domain/EventOrganizer.java b/sport/src/main/java/com/srr/domain/EventOrganizer.java index 9ee6b058..a3d74c51 100644 --- a/sport/src/main/java/com/srr/domain/EventOrganizer.java +++ b/sport/src/main/java/com/srr/domain/EventOrganizer.java @@ -64,6 +64,10 @@ public class EventOrganizer implements Serializable { @ApiModelProperty(value = "userId") private Long userId; + @ManyToOne + @JoinColumn(name = "club_id") + private Club club; + public void copy(EventOrganizer source){ BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/sport/src/main/java/com/srr/dto/EventOrganizerDto.java b/sport/src/main/java/com/srr/dto/EventOrganizerDto.java index 4514c154..56faf618 100644 --- a/sport/src/main/java/com/srr/dto/EventOrganizerDto.java +++ b/sport/src/main/java/com/srr/dto/EventOrganizerDto.java @@ -33,6 +33,9 @@ public class EventOrganizerDto implements Serializable { @ApiModelProperty(value = "id") private Long id; + @ApiModelProperty(value = "Club") + private ClubDto club; + @ApiModelProperty(value = "Description") private String description;