File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments