Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implemented event triggers #103

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 3
endpoint: http://host.docker.internal:8080
endpoint: http://localhost:8080
admin_secret: myadminsecretkey
metadata_directory: metadata
migrations_directory: migrations
seeds_directory: seeds
actions:
kind: synchronous
handler_webhook_baseurl: http://host.docker.internal:3000
handler_webhook_baseurl: http://localhost:3000
1 change: 0 additions & 1 deletion metadata/actions.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

type Mutation {
sendVerificationCode(
input: SendVerificationInput!
Expand Down
2 changes: 0 additions & 2 deletions metadata/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ actions:
forward_client_headers: true
permissions:
- role: anonymous

custom_types:
enums: []
input_objects:
Expand All @@ -22,4 +21,3 @@ custom_types:
objects:
- name: VerificationResponse
scalars: []

11 changes: 0 additions & 11 deletions metadata/databases/safetrust/tables/public_apartments.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
table:
name: apartments
schema: public
configuration:
custom_root_fields: {}
custom_column_names: {}
array_relationships:
- name: users
using:
foreign_key_constraint_on:
column: owner_id
table:
schema: public
name: users
13 changes: 1 addition & 12 deletions metadata/databases/safetrust/tables/public_bid_requests.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
table:
schema: public
name: bid_requests
configuration:
custom_root_fields: {}
custom_column_names: {}
array_relationships:
- name: status_histories
using:
foreign_key_constraint_on:
column: bid_request_id
table:
schema: public
name: bid_status_histories
schema: public
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
table:
schema: public
name: bid_status_histories
schema: public
object_relationships:
- name: bid_request
using:
foreign_key_constraint_on: bid_request_id
foreign_key_constraint_on: bid_request_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: escrow_api_calls
schema: public
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
table:
name: escrow_transactions
schema: public
event_triggers:
- name: escrow_refund_status_update
definition:
enable_manual: false
update:
columns:
- refund_status
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 60
webhook: http://localhost:3000/webhooks/escrow_refund_status_update
- name: escrow_status_update
definition:
enable_manual: false
update:
columns:
- status
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 60
webhook: http://localhost:3000/webhooks/escrow_status_update
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: escrow_xdr_transactions
schema: public
18 changes: 9 additions & 9 deletions metadata/databases/safetrust/tables/public_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ array_relationships:
name: user_wallets
schema: public
select_permissions:
- role: users
- role: anonymous
permission:
columns: []
filter: {}
comment: ""
- role: landlord
permission:
columns:
- country_code
Expand All @@ -27,11 +32,6 @@ select_permissions:
id:
_eq: X-Hasura-User-Id
comment: ""
- role: anonymous
permission:
columns: []
filter: {}
comment: ""
- role: tenant
permission:
columns:
Expand All @@ -49,7 +49,7 @@ select_permissions:
id:
_eq: X-Hasura-User-Id
comment: ""
- role: landlord
- role: users
permission:
columns:
- country_code
Expand All @@ -67,7 +67,7 @@ select_permissions:
_eq: X-Hasura-User-Id
comment: ""
update_permissions:
- role: users
- role: landlord
permission:
columns:
- country_code
Expand Down Expand Up @@ -101,7 +101,7 @@ update_permissions:
id:
_eq: X-Hasura-User-Id
comment: ""
- role: landlord
- role: users
permission:
columns:
- country_code
Expand Down
25 changes: 12 additions & 13 deletions metadata/databases/safetrust/tables/tables.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
- '!include public_geography_columns.yaml'
- '!include public_geometry_columns.yaml'
- '!include public_spatial_ref_sys.yaml'
- '!include public_user_wallets.yaml'
- '!include public_users.yaml'
- '!include escrow_api_calls.yaml'
- '!include escrow_transactions.yaml'
- '!include escrow_xdr_transactions.yaml'
- '!include public_apartments.yaml'
- '!include public_apartment_images.yaml'
- '!include public_bid_requests.yaml'
- '!include public_bid_status_histories.yaml'

- "!include public_apartment_images.yaml"
- "!include public_apartments.yaml"
- "!include public_bid_requests.yaml"
- "!include public_bid_status_histories.yaml"
- "!include public_escrow_api_calls.yaml"
- "!include public_escrow_transactions.yaml"
- "!include public_escrow_xdr_transactions.yaml"
- "!include public_geography_columns.yaml"
- "!include public_geometry_columns.yaml"
- "!include public_spatial_ref_sys.yaml"
- "!include public_user_wallets.yaml"
- "!include public_users.yaml"
3 changes: 2 additions & 1 deletion storage-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const express = require('express');
const cors = require('cors');
const morgan = require('morgan');
const storageRoutes = require('./routes/storage');

const app = express();

// Middleware
Expand All @@ -15,6 +14,8 @@ app.use(cors({
app.use(morgan('tiny'));
app.disable('x-powered-by');



// Routes
app.use('/storage', storageRoutes);

Expand Down
9 changes: 0 additions & 9 deletions storage-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions webhook/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require('dotenv').config();
const express = require('express');
const cors = require('cors');
const morgan = require('morgan');
const webhooksRoutes = require('./webhooks');

const app = express();

// Middleware
app.use(express.json());
app.use(cors({
credentials: true,
origin: true,
}));
app.use(morgan('tiny'));
app.disable('x-powered-by');



// Routes
app.use('/webhooks', webhooksRoutes);


// Error handler
app.use((err, req, res, next) => {
if (err) {
console.error(err.message);
console.error(err.stack);
return res.status(500).json({ error: err.message });
}
});

const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`listening on port ${port}`);
});
Loading