changed deadline to timestamp and the logic to schedule an auction #56
|
@ -1,10 +1,11 @@
|
||||||
package ch.unisg.tapas.auctionhouse.application.port.in;
|
package ch.unisg.tapas.auctionhouse.application.port.in;
|
||||||
|
|
||||||
import ch.unisg.tapas.auctionhouse.domain.Auction;
|
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 lombok.Value;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraint.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command for launching an auction in this auction house.
|
* Command for launching an auction in this auction house.
|
||||||
|
|
|
@ -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.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.in.LaunchAuctionUseCase;
|
||||||
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionWonEventPort;
|
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionWonEventPort;
|
||||||
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionStartedEventPort;
|
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionStartedEventPort;
|
||||||
import ch.unisg.tapas.auctionhouse.domain.*;
|
import ch.unisg.tapas.auctionhouse.domain.*;
|
||||||
|
@ -63,7 +64,7 @@ public class StartAuctionService implements LaunchAuctionUseCase {
|
||||||
auctions.addAuction(auction);
|
auctions.addAuction(auction);
|
||||||
|
|
||||||
// Schedule the closing of the auction at the deadline
|
// 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);
|
TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
// Publish an auction started event
|
// Publish an auction started event
|
||||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,6 +167,6 @@ public class Auction {
|
||||||
|
|
||||||
@Value
|
@Value
|
||||||
public static class AuctionDeadline {
|
public static class AuctionDeadline {
|
||||||
int value;
|
Timestamp value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user