Problem
Double-booking is prevented only in the NestJS backend. There is no on-chain validation, meaning a malicious actor can bypass the backend and submit duplicate booking transactions directly to the contract.
Proposed Solution
Create contracts/cntr/booking_conflict.rs defining pub struct BookingSlot { pub booking_id: String, pub start_ts: u64, pub end_ts: u64 } and implementing pub fn find_conflicts(new_slot: &BookingSlot, existing_slots: &[BookingSlot]) -> Vec<String> returning the booking_id of each conflicting slot. Overlap condition: new.start_ts < existing.end_ts && new.end_ts > existing.start_ts. Adjacent slots (touching endpoints) are NOT conflicts. All implementation must live inside contracts/cntr/.
Acceptance Criteria
Problem
Double-booking is prevented only in the NestJS backend. There is no on-chain validation, meaning a malicious actor can bypass the backend and submit duplicate booking transactions directly to the contract.
Proposed Solution
Create
contracts/cntr/booking_conflict.rsdefiningpub struct BookingSlot { pub booking_id: String, pub start_ts: u64, pub end_ts: u64 }and implementingpub fn find_conflicts(new_slot: &BookingSlot, existing_slots: &[BookingSlot]) -> Vec<String>returning thebooking_idof each conflicting slot. Overlap condition:new.start_ts < existing.end_ts && new.end_ts > existing.start_ts. Adjacent slots (touching endpoints) are NOT conflicts. All implementation must live insidecontracts/cntr/.Acceptance Criteria
contracts/cntr/booking_conflict.rsVecwhen no conflicts existbooking_idstrings of conflicting slotscargo test