Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
m30m committed Feb 29, 2024
1 parent 6a07ab4 commit 3118971
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions auction-server/src/api/bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use {
Bid,
},
state::{
BidId,
BidStatus,
Store,
},
Expand All @@ -29,15 +30,14 @@ use {
ToResponse,
ToSchema,
},
uuid::Uuid,
};

#[derive(Serialize, Deserialize, ToResponse, ToSchema, Clone)]
pub struct BidResult {
pub status: String,
/// The unique id created to identify the bid. This id can be used to query the status of the bid.
#[schema(example = "f47ac10b-58cc-4372-a567-0e02b2c3d479", value_type=String)]
pub id: Uuid,
#[schema(example = "beedbeed-58cc-4372-a567-0e02b2c3d479", value_type=String)]
pub id: BidId,
}


Expand All @@ -47,7 +47,7 @@ pub struct BidResult {
/// containing the contract call will be sent to the blockchain expecting the bid amount to be paid after the call.
#[utoipa::path(post, path = "/v1/bids", request_body = Bid, responses(
(status = 200, description = "Bid was placed successfully", body = BidResult,
example = json!({"status": "OK", "id": "115c5c03-b346-4fa1-8fab-2541a9e1872d"})),
example = json!({"status": "OK", "id": "beedbeed-b346-4fa1-8fab-2541a9e1872d"})),
(status = 400, response = ErrorBodyResponse),
(status = 404, description = "Chain id was not found", body = ErrorBodyResponse),
),)]
Expand Down Expand Up @@ -80,7 +80,7 @@ pub async fn process_bid(store: Arc<Store>, bid: Bid) -> Result<Json<BidResult>,
),)]
pub async fn bid_status(
State(store): State<Arc<Store>>,
Path(bid_id): Path<Uuid>,
Path(bid_id): Path<BidId>,
) -> Result<Json<BidStatus>, RestError> {
let status = store.bid_status_store.get_status(&bid_id).await;
match status {
Expand Down
2 changes: 1 addition & 1 deletion auction-server/src/api/liquidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use {
#[derive(Serialize, Deserialize, ToSchema, Clone, ToResponse)]
pub struct OpportunityParamsWithMetadata {
/// The opportunity unique id
#[schema(example = "f47ac10b-58cc-4372-a567-0e02b2c3d479", value_type=String)]
#[schema(example = "obo3ee3e-58cc-4372-a567-0e02b2c3d479", value_type=String)]
opportunity_id: OpportunityId,
/// Creation time of the opportunity
#[schema(example = 1700000000, value_type=i64)]
Expand Down
9 changes: 5 additions & 4 deletions auction-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,20 @@ pub async fn start_server(run_options: RunOptions) -> anyhow::Result<()> {
.into_iter()
.collect();

let (update_tx, update_rx) = tokio::sync::broadcast::channel(NOTIFICATIONS_CHAN_LEN);
let (broadcast_sender, broadcast_receiver) =
tokio::sync::broadcast::channel(NOTIFICATIONS_CHAN_LEN);
let store = Arc::new(Store {
chains: chain_store?,
liquidation_store: LiquidationStore::default(),
bid_status_store: BidStatusStore {
bids_status: Default::default(),
event_sender: update_tx.clone(),
event_sender: broadcast_sender.clone(),
},
per_operator: wallet,
ws: ws::WsState {
subscriber_counter: AtomicUsize::new(0),
broadcast_sender: update_tx,
broadcast_receiver: update_rx,
broadcast_sender,
broadcast_receiver,
},
});

Expand Down

0 comments on commit 3118971

Please sign in to comment.