Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 53 additions & 107 deletions app(backend)/pom.xml
Original file line number Diff line number Diff line change
@@ -1,112 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.knockoutzone</groupId>
<artifactId>backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>KnockOutZone Backend</name>
<description>KnockOutZone Backend</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version> <!-- Updated for Java 21 -->
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

</project>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.knockoutzone.backend.controller;

import com.knockoutzone.backend.entity.Foul;
import com.knockoutzone.backend.service.impl.FoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/fouls")
public class FoulController {

@Autowired
private FoulService foulService;

@PostMapping
public Foul addFoul(@RequestBody Foul foul) {
return foulService.addFoul(foul);
}

@GetMapping("/match/{matchId}")
public List<Foul> getFoulsByMatch(@PathVariable Long matchId) {
return foulService.getFoulsByMatch(matchId);
}

@GetMapping("/player/{playerId}")
public List<Foul> getFoulsByPlayer(@PathVariable Long playerId) {
return foulService.getFoulsByPlayer(playerId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ public class ApiResponse<T> {
private String message = null;
private T data = null;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//package com.knockoutzone.backend.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiResponse<T> {
private boolean success = true;
private int statusCode = 200;
private String message = null;
private T data = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// EventMode.java
package com.knockoutzone.backend.entity;

public enum EventMode {
ONLINE,
OFFLINE,
HYBRID
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.knockoutzone.backend.entity;

import jakarta.persistence.*;
import lombok.*;
import java.time.LocalDateTime;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Foul {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private Long matchId;
private Long playerId;
private Long teamId;

private String type; // e.g., Minor, Major
private String description;

private LocalDateTime timestamp;

// Manually add setter for timestamp to fix "cannot find symbol" error
public void setTimestamp(LocalDateTime timestamp) {
this.timestamp = timestamp;
}

// Optional: you can also add getter explicitly if needed
public LocalDateTime getTimestamp() {
return timestamp;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Platform.java
package com.knockoutzone.backend.entity;

public enum Platform {
PC,
MOBILE,
CONSOLE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ScheduleType.java
package com.knockoutzone.backend.entity;

public enum ScheduleType {
FIXED,
FLEXIBLE
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.knockoutzone.backend.entity;


import com.knockoutzone.backend.entity.enums.*;

//import com.knockoutzone.backend.entity.enums.*;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.envers.Audited;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.knockoutzone.backend.entity;

public enum TournamentStatus {
UPCOMING,
ONGOING,
COMPLETED,
CANCELLED
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.knockoutzone.backend.entity;
import com.knockoutzone.backend.entity.TournamentType;


public enum TournamentType {
SINGLE_ELIMINATION,
DOUBLE_ELIMINATION,
ROUND_ROBIN,
LEAGUE
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.knockoutzone.backend.repository;

import com.knockoutzone.backend.entity.Foul;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface FoulRepository extends JpaRepository<Foul, Long> {
List<Foul> findByMatchId(Long matchId);
List<Foul> findByPlayerId(Long playerId);
}
Loading