Created
July 30, 2024 07:55
-
-
Save ezzabuzaid/1329d7ff4f424e85c43677f9017e5286 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
projectName: "HTTP trigger project" | |
extensions: "core,identity,hono,fly,postgresql" | |
--- | |
```ts | |
export default project( | |
feature('InventoryFeature', { | |
policies: { | |
cambodiaClient: policy.country('Cambodia'), | |
}, | |
tables: { | |
items: table({ | |
fields: { | |
name: field({ type: 'short-text' }), | |
price: field({ type: 'integer' }), | |
}, | |
}), | |
}, | |
workflows: [ | |
workflow('PurchaseItem', { | |
tag: 'items', | |
trigger: trigger.http({ | |
policies: ['cambodiaClient'], | |
method: 'post', | |
path: '/', | |
}), | |
actions: { | |
purchaseItem: (trigger) => | |
action.database.insert({ | |
table: useTable('items'), | |
columns: [useField('name', trigger.body.name)], | |
}), | |
}, | |
}), | |
], | |
}); | |
); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment