Group independent binary markets under discoverable topic events
This commit is contained in:
@@ -17,38 +17,7 @@ pub(crate) fn apply(tx: &Transaction, books: &Books, command: Command) -> Result
|
||||
tx.execute("INSERT INTO accounts VALUES(?,?)", params![account, cents])?;
|
||||
Ok(json!({"funded":cents}))
|
||||
}
|
||||
Command::Event {
|
||||
event,
|
||||
title,
|
||||
sport,
|
||||
competition,
|
||||
home,
|
||||
away,
|
||||
scheduled_at_ms,
|
||||
} => {
|
||||
identifier(&event)?;
|
||||
ensure!(
|
||||
scheduled_at_ms >= 0
|
||||
&& home.trim() != away.trim()
|
||||
&& [&title, &sport, &competition, &home, &away]
|
||||
.iter()
|
||||
.all(|s| !s.trim().is_empty()),
|
||||
"invalid event"
|
||||
);
|
||||
tx.execute(
|
||||
"INSERT INTO events VALUES(?,?,?,?,?,?,?)",
|
||||
params![
|
||||
event,
|
||||
title,
|
||||
sport,
|
||||
competition,
|
||||
home,
|
||||
away,
|
||||
scheduled_at_ms
|
||||
],
|
||||
)?;
|
||||
Ok(json!({"event":event}))
|
||||
}
|
||||
Command::Event(event) => event.save(tx),
|
||||
Command::List {
|
||||
market,
|
||||
rules,
|
||||
|
||||
Reference in New Issue
Block a user