-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from coalingot/development
Development
- Loading branch information
Showing
61 changed files
with
2,100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3.8' | ||
services: | ||
db: | ||
image: mysql | ||
command: --default-authentication-plugin=mysql_native_password | ||
ports: | ||
- 3306:3306 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: password | ||
phpmyadmin: | ||
image: phpmyadmin | ||
restart: always | ||
ports: | ||
- 9000:80 | ||
environment: | ||
PMA_HOST: db | ||
MYSQL_ROOT_PASSWORD: password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/se/project/coalingot/auction/controller/AuctionController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package se.project.coalingot.auction.controller; | ||
|
||
import org.springframework.stereotype.Controller; | ||
|
||
@Controller | ||
public class AuctionController { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/se/project/coalingot/auction/dao/AuctionDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package se.project.coalingot.auction.dao; | ||
|
||
public interface AuctionDao { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/se/project/coalingot/auction/dao/AuctionDaoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package se.project.coalingot.auction.dao; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public class AuctionDaoImpl implements AuctionDao{ | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/se/project/coalingot/auction/dto/AuctionDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package se.project.coalingot.auction.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import se.project.coalingot.item.dto.ItemAuctionDto; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AuctionDto { | ||
Long auctionId; | ||
ItemAuctionDto auctionItem; | ||
Double highestPrice; | ||
Boolean status; | ||
Date startDate; | ||
Date endDate; | ||
List<AuctionHistoryDto> histories; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/se/project/coalingot/auction/dto/AuctionHistoryDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package se.project.coalingot.auction.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import se.project.coalingot.auctionuser.dto.AuctionUserPaticipantDto; | ||
import se.project.coalingot.item.dto.ItemAuctionDto; | ||
import se.project.coalingot.item.dto.ItemDto; | ||
import se.project.coalingot.item.dto.ItemHistoryDto; | ||
|
||
import java.util.Date; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AuctionHistoryDto { | ||
AuctionUserPaticipantDto auctionUser; | ||
Double submitPrice; | ||
Date submitAt; | ||
ItemHistoryDto auctionItem; | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/se/project/coalingot/auction/entity/Auction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package se.project.coalingot.auction.entity; | ||
|
||
import lombok.*; | ||
import se.project.coalingot.item.entity.Item; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@Entity | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Auction { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@EqualsAndHashCode.Exclude | ||
Long auctionId; | ||
|
||
@OneToOne | ||
Item auctionItem; | ||
|
||
@OneToMany(mappedBy = "auctionEvent") | ||
List<AuctionHistory> histories = new ArrayList<>(); | ||
|
||
Double highestPrice; | ||
|
||
Boolean status; | ||
|
||
Date startDate; | ||
|
||
Date endDate; | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/se/project/coalingot/auction/entity/AuctionHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package se.project.coalingot.auction.entity; | ||
|
||
import lombok.*; | ||
import se.project.coalingot.auctionuser.entity.AuctionUser; | ||
import se.project.coalingot.item.entity.Item; | ||
|
||
import javax.persistence.*; | ||
import java.util.Date; | ||
|
||
@Data | ||
@Builder | ||
@Entity | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AuctionHistory { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@EqualsAndHashCode.Exclude | ||
Long auctionHistoryId; | ||
|
||
@ManyToOne | ||
AuctionUser auctionUser; | ||
|
||
@ManyToOne | ||
Auction auctionEvent; | ||
|
||
Double submitPrice; | ||
|
||
Date submitAt; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/se/project/coalingot/auction/entity/AuctionRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package se.project.coalingot.auction.entity; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AuctionRequest { | ||
Long auctionId; | ||
Long userId; | ||
Double submitPrice; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/se/project/coalingot/auction/repository/AuctionHistoryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package se.project.coalingot.auction.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import se.project.coalingot.auction.entity.AuctionHistory; | ||
|
||
public interface AuctionHistoryRepository extends JpaRepository<AuctionHistory, Long> { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/se/project/coalingot/auction/repository/AuctionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package se.project.coalingot.auction.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import se.project.coalingot.auction.entity.Auction; | ||
|
||
public interface AuctionRepository extends JpaRepository<Auction,Long> { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/se/project/coalingot/auction/service/AuctionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package se.project.coalingot.auction.service; | ||
|
||
public interface AuctionService { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/se/project/coalingot/auction/service/AuctionServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package se.project.coalingot.auction.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class AuctionServiceImpl implements AuctionService{ | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/se/project/coalingot/auctionuser/controller/AuctionUserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package se.project.coalingot.auctionuser.controller; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import se.project.coalingot.auction.entity.Auction; | ||
import se.project.coalingot.auction.entity.AuctionRequest; | ||
import se.project.coalingot.auction.repository.AuctionRepository; | ||
import se.project.coalingot.auctionuser.entity.AuctionUser; | ||
import se.project.coalingot.auctionuser.service.AuctionUserService; | ||
import se.project.coalingot.util.AuctionMapper; | ||
|
||
import java.util.List; | ||
|
||
@Controller | ||
public class AuctionUserController { | ||
@Autowired | ||
AuctionUserService auctionUserService; | ||
|
||
// will change later | ||
@Autowired | ||
AuctionRepository auctionRepository; | ||
|
||
@PostMapping("/submit-price") | ||
public ResponseEntity<?> submitPrice( | ||
@RequestBody AuctionRequest auctionRequest | ||
) { | ||
auctionUserService.submitPrice( | ||
auctionRequest.getAuctionId(), | ||
auctionRequest.getUserId(), | ||
auctionRequest.getSubmitPrice() | ||
); | ||
return ResponseEntity.ok("You has been submitted the price."); | ||
} | ||
|
||
@GetMapping("/see-all-auction") | ||
public ResponseEntity<?> seeAuction(){ | ||
List<Auction> output = auctionRepository.findAll(); | ||
return ResponseEntity.ok(AuctionMapper.INSTANCE.seeAuction(output)); | ||
} | ||
|
||
@GetMapping("auctionList/{auctionUserID}") | ||
public ResponseEntity<?> getAuctionThatSubmit( | ||
@PathVariable("auctionUserID") Long auctionID | ||
) { | ||
AuctionUser output = auctionUserService.getAuctionUser(auctionID); | ||
return ResponseEntity.ok(AuctionMapper.INSTANCE.getAuctionUserDto(output)); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/se/project/coalingot/auctionuser/dao/AuctionUserDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package se.project.coalingot.auctionuser.dao; | ||
|
||
import se.project.coalingot.auctionuser.entity.AuctionUser; | ||
|
||
public interface AuctionUserDao { | ||
void submitPrice(Long auctionId,Long userId,Double price); | ||
AuctionUser getAuctionUser(Long auctionUserID); | ||
} |
Oops, something went wrong.