Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b8f2d41
Merge branch 'main' of https://github.com/ezedike-evan/XLMate
ezedike-evan Mar 27, 2026
8f3ccf1
feat(matchmaking): implement closest-Elo pairing with expanding searc…
ezedike-evan Mar 27, 2026
26b90fc
feat(st_core): add SorobanEventListener background service
ezedike-evan Mar 27, 2026
447f1f6
resolved CI issue
ezedike-evan Mar 30, 2026
0f0e0cf
fix: add api feature flag to api crate
ezedike-evan Mar 30, 2026
c974a10
Enforce maximum stake limits to prevent gambling abuses #169
anonfedora Mar 28, 2026
6a47639
feat: handle searching for opponent screen display and routing to ma…
noelams Mar 27, 2026
36f7c8e
feat: replace mock data with api call
noelams Mar 27, 2026
d14f79e
feat: replace mock data with api call
noelams Mar 27, 2026
c7a6409
feat: add play custom route
noelams Mar 27, 2026
780ceef
feat: allow staking in stella usdc
Mar 26, 2026
1e27ae0
update
Mar 27, 2026
7c49db6
feat(game-registry): add tournament functionality with error handling
Lakes41 Mar 27, 2026
bb674d9
Implemented the custom chess board component
KAMALDEEN333 Mar 28, 2026
9ff7e61
Updated the Websocket reconnect logic
KAMALDEEN333 Mar 28, 2026
dfb6c13
fixed made
KAMALDEEN333 Mar 28, 2026
977f486
fix: memoize chessboard FEN parsing and handlers for 60fps drag-and-drop
legend4tech Mar 29, 2026
937c699
fix: Failing ci
anonfedora Mar 29, 2026
4a8da3a
feat: implement ai personality NFT contract
Mar 26, 2026
b15d385
format
Mar 27, 2026
357d42f
implement treasury fee
Iwueseiter Mar 27, 2026
244bfc8
implement treasury fee
Iwueseiter Mar 27, 2026
4c9b311
resolve merge conflicts
Iwueseiter Mar 28, 2026
a67bb89
Fix 'Token contract is not initialized' in tests
Iwueseiter Mar 28, 2026
67cf1f9
fix failing tests
Iwueseiter Mar 29, 2026
802c528
fix: failing test/fmt
anonfedora Mar 29, 2026
1a7e466
feat(game-contract): add puzzle rewards (#199) and treasury fee split…
phertyameen Mar 29, 2026
dce3a51
Merge branch 'main' into feat/soroban-event-listener
ezedike-evan Mar 30, 2026
80ce1bf
fix(chess): pass DbErr directly to ApiError::DatabaseError
ezedike-evan Apr 2, 2026
1c10bcc
fix: resolve merge conflicts and syntax errors in game_contract
ezedike-evan Apr 2, 2026
010fb19
fix: remove incomplete duplicate useEffect causing parsing error in p…
ezedike-evan Apr 2, 2026
9d781ef
fix:add icons import
ezedike-evan Apr 2, 2026
f2ee920
fix: simplify error handling by removing redundant closure in databas…
ezedike-evan Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/modules/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ redis = { version = "0.24", features = ["tokio-comp", "json"] }
tokio = { version = "1", features = ["full"] }
actix-rt = "2.9"


[features]
api = []
18 changes: 9 additions & 9 deletions backend/modules/chess/src/rating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ impl RatingService {
) -> Result<(i32, i32), ApiError> {
// Start a database transaction to ensure atomicity
let txn = db.begin().await
.map_err(|e| ApiError::DatabaseError(format!("Failed to start transaction: {}", e)))?;
.map_err(ApiError::DatabaseError)?;

let result = Self::update_ratings_in_transaction(&txn, game_id, config).await;

match result {
Ok(ratings) => {
// Commit the transaction if everything succeeded
txn.commit().await
.map_err(|e| ApiError::DatabaseError(format!("Failed to commit transaction: {}", e)))?;
.map_err(ApiError::DatabaseError)?;
Ok(ratings)
}
Err(e) => {
Expand All @@ -93,7 +93,7 @@ impl RatingService {
let game_model = game::Entity::find_by_id(game_id)
.one(txn)
.await
.map_err(|e| ApiError::DatabaseError(format!("Failed to fetch game: {}", e)))?
.map_err(ApiError::DatabaseError)?
.ok_or_else(|| ApiError::NotFound("Game not found".to_string()))?;

// 2. Check if game is completed
Expand All @@ -118,13 +118,13 @@ impl RatingService {
let white_player = player::Entity::find_by_id(game_model.white_player)
.one(txn)
.await
.map_err(|e| ApiError::DatabaseError(format!("Failed to fetch white player: {}", e)))?
.map_err(ApiError::DatabaseError)?
.ok_or_else(|| ApiError::NotFound("White player not found".to_string()))?;

let black_player = player::Entity::find_by_id(game_model.black_player)
.one(txn)
.await
.map_err(|e| ApiError::DatabaseError(format!("Failed to fetch black player: {}", e)))?
.map_err(ApiError::DatabaseError)?
.ok_or_else(|| ApiError::NotFound("Black player not found".to_string()))?;

// 5. Calculate new ratings based on game outcome
Expand All @@ -150,10 +150,10 @@ impl RatingService {

// Execute both updates in the same transaction
white_active_model.update(txn).await
.map_err(|e| ApiError::DatabaseError(format!("Failed to update white player rating: {}", e)))?;
.map_err(ApiError::DatabaseError)?;

black_active_model.update(txn).await
.map_err(|e| ApiError::DatabaseError(format!("Failed to update black player rating: {}", e)))?;
.map_err(ApiError::DatabaseError)?;

Ok((new_white_rating, new_black_rating))
}
Expand Down Expand Up @@ -216,7 +216,7 @@ impl RatingService {
let player = player::Entity::find_by_id(player_id)
.one(db)
.await
.map_err(|e| ApiError::DatabaseError(format!("Failed to fetch player: {}", e)))?
.map_err(ApiError::DatabaseError)?
.ok_or_else(|| ApiError::NotFound("Player not found".to_string()))?;

Ok(player.elo_rating)
Expand All @@ -238,7 +238,7 @@ impl RatingService {
};

active_model.update(db).await
.map_err(|e| ApiError::DatabaseError(format!("Failed to update player rating: {}", e)))?;
.map_err(ApiError::DatabaseError)?;

Ok(())
}
Expand Down
Loading
Loading