changed deadline to timestamp and the logic to schedule an auction

This commit is contained in:
julius.lautz 2021-11-10 11:03:57 +00:00
parent f2fb945064
commit 74a51cfcf6
3 changed files with 7 additions and 4 deletions

View File

@ -1,10 +1,11 @@
package ch.unisg.tapas.auctionhouse.application.port.in;
import ch.unisg.tapas.auctionhouse.domain.Auction;
import ch.unisg.tapas.common.SelfValidating;
import ch.unisg.common.SelfValidating;
import lombok.NonNull;
import lombok.Value;
import javax.validation.constraints.NotNull;
import javax.validation.constraint.NotNull;
/**
* Command for launching an auction in this auction house.

View File

@ -2,6 +2,7 @@ package ch.unisg.tapas.auctionhouse.application.service;
import ch.unisg.tapas.auctionhouse.application.port.in.LaunchAuctionCommand;
import ch.unisg.tapas.auctionhouse.application.port.in.LaunchAuctionUseCase;
import ch.unisg.tapas.auctionhouse.application.port.in.LaunchAuctionUseCase;
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionWonEventPort;
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionStartedEventPort;
import ch.unisg.tapas.auctionhouse.domain.*;
@ -63,7 +64,7 @@ public class StartAuctionService implements LaunchAuctionUseCase {
auctions.addAuction(auction);
// Schedule the closing of the auction at the deadline
service.schedule(new CloseAuctionTask(auction.getAuctionId()), deadline.getValue(),
service.schedule(new CloseAuctionTask(auction.getAuctionId()), deadline.getValue().getTime() - System.currentTimeMillis(),
TimeUnit.MILLISECONDS);
// Publish an auction started event

View File

@ -4,6 +4,7 @@ import lombok.Getter;
import lombok.Value;
import java.net.URI;
import java.sql.Timestamp;
import java.util.*;
/**
@ -166,6 +167,6 @@ public class Auction {
@Value
public static class AuctionDeadline {
int value;
Timestamp value;
}
}