Skip to content

Commit 9c76eab

Browse files
committed
[Blog] edit
1 parent 8a9777c commit 9c76eab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Blog/blog/2025-10-08-seaography.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,11 @@ pub struct Coupon {
275275
}
276276
```
277277

278-
Then we can define the mutation endpoint:
278+
Then we can define the mutation endpoint. The business logic is:
279+
280+
1. Look up the specifc customer and film
281+
2. Find if there is inventory in store. If not, return error
282+
3. Create a new rental record and remove the item from inventory
279283

280284
```rust
281285
#[CustomFields]
@@ -292,7 +296,7 @@ impl Operations {
292296
// ⬆ create a transaction to make operation atomic
293297

294298
let customer = Customer::find_by_name(rental_request.customer, &txn).await?;
295-
let film = Film::find_by_name(rental_request.film, &txn).await?;
299+
let film = Film::find_by_title(rental_request.film, &txn).await?;
296300
// ⬆ helper methods to find the corresponding customer and film
297301

298302
// ⬇ find if there is inventory in current store

0 commit comments

Comments
 (0)