You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Store a string value under the given key, optionally expiring after a number of seconds.
31
+
32
+
Parameters:
33
+
key (str): Key under which to store the value.
34
+
value (str): String value to store.
35
+
ex (Optional[int]): Expiration time in seconds; if provided, the key will be removed after this many seconds. Existing values for the key are overwritten.
36
+
"""
37
+
...
38
+
39
+
40
+
class_InMemoryRedis:
41
+
"""Minimal in-memory Redis replacement used when redis-py asyncio is unavailable."""
42
+
43
+
def__init__(self) ->None:
44
+
"""
45
+
Initialize internal storage for the in-memory Redis replacement.
46
+
47
+
Creates the `_store` dictionary that maps keys (str) to tuples of `(value, expires_at)`,
48
+
where `value` is the stored string and `expires_at` is a Unix timestamp (float) when the
Convert a backend PriceResponse into a GraphQL PriceQuote.
30
+
31
+
Constructs a PriceQuote with total_cents from the response and a nested PriceBreakdown populated from the response.breakdown keys: "base", "finish", "hardware", and "countertop".
32
+
33
+
Returns:
34
+
PriceQuote: GraphQL PriceQuote with mapped `total_cents` and `breakdown`.
35
+
"""
36
+
breakdown=response.breakdown
37
+
returnPriceQuote(
38
+
total_cents=response.total_cents,
39
+
breakdown=PriceBreakdown(
40
+
base=breakdown["base"],
41
+
finish=breakdown["finish"],
42
+
hardware=breakdown["hardware"],
43
+
countertop=breakdown["countertop"],
44
+
),
45
+
)
46
+
47
+
48
+
@strawberry.type
49
+
classQuery:
50
+
@strawberry.field
51
+
asyncdefprice_quote(
52
+
self,
53
+
elevation: str,
54
+
finish: str,
55
+
hardware: str,
56
+
countertop: str,
57
+
) ->PriceQuote:
58
+
"""
59
+
Resolve a price quote for a product configuration specified by the provided attributes.
60
+
61
+
Builds a price request from the provided elevation, finish, hardware, and countertop identifiers, queries the pricing backend, and returns the result as a GraphQL PriceQuote.
62
+
63
+
Parameters:
64
+
elevation (str): Identifier for the product elevation/profile.
65
+
finish (str): Identifier for the surface finish option.
66
+
hardware (str): Identifier for the hardware option.
67
+
countertop (str): Identifier for the countertop option.
68
+
69
+
Returns:
70
+
PriceQuote: GraphQL representation of the computed price, including `total_cents` and a `breakdown` of cost components.
0 commit comments