| 1 | import * as GCP from "alchemy/GCP"; |
| 2 | |
| 3 | /** |
| 4 | * Eventarc only delivers Firestore events to triggers in the database's |
| 5 | * own location, so the database and the trigger pin the same location. |
| 6 | */ |
| 7 | export const LOCATION = "us-central1"; |
| 8 | |
| 9 | /** |
| 10 | * A named Firestore database in Native mode. Firestore change events come |
| 11 | * from Native-mode databases only, and a named database keeps the |
| 12 | * example's triggers from firing on anything else in the project. |
| 13 | */ |
| 14 | export const Shop = GCP.Firestore.Database("Shop", { |
| 15 | location: LOCATION, |
| 16 | type: "FIRESTORE_NATIVE", |
| 17 | }); |
| 18 | |
| 19 | /** An order as the API stores it at `orders/{id}`. */ |
| 20 | export interface Order { |
| 21 | item: string; |
| 22 | quantity: number; |
| 23 | createdAt: Date; |
| 24 | } |