Added job list container. Removed all previous migrations.

This commit is contained in:
Patrick Fic
2019-12-06 09:26:50 -08:00
parent f875e9611b
commit ab1e4d5424
85 changed files with 104 additions and 1088 deletions

View File

@@ -1,2 +1,9 @@
React App:
React Hooks are used for Authentication ONLY to ensure the correct web token is passed.
GraphQL API:
Hasura is hosted on another dyno. Several environmental variables are required, including disabling the console.
ALL CHANGES MUST BE MADE USING LOCAL CONSOLE TO ENSURE DATABASE MIGRATION FILES ARE CREATED.
To Start Hasura CLI:
npx hasura console --admin-secret Dev-BodyShopAppBySnaptSoftware!

View File

@@ -10,7 +10,7 @@ export default function Auth() {
useEffect(() => {
return firebase.auth().onAuthStateChanged(async user => {
console.log("user", user);
console.log("User in App Container.js: ", user);
if (user) {
const token = await user.getIdToken();
const idTokenResult = await user.getIdTokenResult();
@@ -31,6 +31,10 @@ export default function Auth() {
setAuthState({ status: "in", user, token });
});
}
console.log("#####Logged In. make a gql call to upsert", user);
} else {
setAuthState({ status: "out" });
}

View File

@@ -10,6 +10,7 @@ import "./App.css";
import HeaderAppBarContainer from "../components/header-app-bar/header-app-bar.container";
import SignIn from "../components/sign-in/sign-in.component";
import initialState from "../graphql/initial-state";
import JobListContainer from "../components/job-list/job-list.container";
//Todo: Issue with this line. Not sure why.
const graphqlEndpoint =
@@ -37,11 +38,11 @@ export default function App({ authState }) {
data: initialState
});
console.log(client);
return (
<ApolloProvider client={client}>
<HeaderAppBarContainer />
<SignIn />
<JobListContainer />
</ApolloProvider>
);
}

View File

@@ -28,6 +28,7 @@ const HeaderAppBarContainer = () => (
<Query query={GET_NAV_ITEMS}>
{({ loading, error, data }) => {
if (loading) return <Spin size="large" />;
if (error) return <Alert message={error.message} />;
return (
<HeaderAppBar
selectedNavItem={selectedNavItem}

View File

@@ -0,0 +1,6 @@
import React from "react";
export default function JobList() {
//console.log("JobList props", this.props);
return <div>JobList</div>;
}

View File

@@ -0,0 +1,28 @@
import React from "react";
import { Query } from "react-apollo";
import { gql } from "apollo-boost";
import { Spin, Alert } from "antd";
import JobList from "./job-list.component";
const GET_JOBS = gql`
query get_jobs {
estimates {
ro_number
}
}
`;
const JobListContainer = () => (
<Query query={GET_JOBS}>
{({ loading, error, data }) => {
if (loading) return <Spin size="large" />;
if (error) return <Alert message={error.message} />;
console.log("JobListContainer Data:", data);
return <JobList jobs={data} />;
}}
</Query>
);
export default JobListContainer;

View File

@@ -1,91 +0,0 @@
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/database";
import React, { useState, useEffect } from "react";
import App from "./App";
const provider = new firebase.auth.GoogleAuthProvider();
// Find these options in your Firebase console
firebase.initializeApp({
apiKey: "xxx",
authDomain: "xxx",
databaseURL: "xxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "xxx"
});
export default function Auth() {
const [authState, setAuthState] = useState({ status: "loading" });
useEffect(() => {
return firebase.auth().onAuthStateChanged(async user => {
if (user) {
const token = await user.getIdToken();
const idTokenResult = await user.getIdTokenResult();
const hasuraClaim =
idTokenResult.claims["https://hasura.io/jwt/claims"];
if (hasuraClaim) {
setAuthState({ status: "in", user, token });
} else {
// Check if refresh is required.
const metadataRef = firebase
.database()
.ref("metadata/" + user.uid + "/refreshTime");
metadataRef.on("value", async () => {
// Force refresh to pick up the latest custom claims changes.
const token = await user.getIdToken(true);
setAuthState({ status: "in", user, token });
});
}
} else {
setAuthState({ status: "out" });
}
});
}, []);
const signInWithGoogle = async () => {
try {
await firebase.auth().signInWithPopup(provider);
} catch (error) {
console.log(error);
}
};
const signOut = async () => {
try {
setAuthState({ status: "loading" });
await firebase.auth().signOut();
setAuthState({ status: "out" });
} catch (error) {
console.log(error);
}
};
let content;
if (authState.status === "loading") {
content = null;
} else {
content = (
<>
<div>
{authState.status === "in" ? (
<div>
<h2>Welcome, {authState.user.displayName}</h2>
<button onClick={signOut}>Sign out</button>
</div>
) : (
<button onClick={signInWithGoogle}>Sign in with Google</button>
)}
</div>
<App authState={authState} />
</>
);
}
return <div className="auth">{content}</div>;
}

View File

@@ -1,18 +0,0 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: "CREATE TABLE \"public\".\"users\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
\"username\" text NOT NULL, \"password\" text NOT NULL, \"created_at\" timestamptz
NOT NULL DEFAULT now(), \"updated_at\" timestamptz NOT NULL DEFAULT now(), \"last_login\"
timestamptz, PRIMARY KEY (\"id\") );\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_users_updated_at\"\nBEFORE
UPDATE ON \"public\".\"users\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
ON TRIGGER \"set_public_users_updated_at\" ON \"public\".\"users\" \nIS 'trigger
to set value of column \"updated_at\" to current timestamp on row update';\n"
type: run_sql
- args:
name: users
schema: public
type: add_existing_table_or_view

View File

@@ -1,18 +0,0 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: "CREATE TABLE \"public\".\"bodyshops\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
\"shop_name\" text NOT NULL, \"created_at\" timestamptz NOT NULL DEFAULT now(),
\"updated_at\" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (\"id\") );\nCREATE
OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_bodyshops_updated_at\"\nBEFORE
UPDATE ON \"public\".\"bodyshops\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
ON TRIGGER \"set_public_bodyshops_updated_at\" ON \"public\".\"bodyshops\" \nIS
'trigger to set value of column \"updated_at\" to current timestamp on row update';\n"
type: run_sql
- args:
name: bodyshops
schema: public
type: add_existing_table_or_view

View File

@@ -1,11 +0,0 @@
- args:
sql: CREATE TABLE "public"."associations"("bodyshop" uuid NOT NULL, "user" uuid
NOT NULL, "active" boolean NOT NULL DEFAULT false, PRIMARY KEY ("bodyshop","user")
, FOREIGN KEY ("bodyshop") REFERENCES "public"."bodyshops"("id") ON UPDATE restrict
ON DELETE restrict, FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON
UPDATE restrict ON DELETE restrict);
type: run_sql
- args:
name: associations
schema: public
type: add_existing_table_or_view

View File

@@ -1,3 +0,0 @@
- args:
sql: DROP TABLE "public"."estimates"
type: run_sql

View File

@@ -1,20 +0,0 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: "CREATE TABLE \"public\".\"estimates\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
\"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz
NOT NULL DEFAULT now(), \"est_number\" text NOT NULL, \"ro_number\" text NOT
NULL, \"shopid\" uuid NOT NULL, PRIMARY KEY (\"id\") , FOREIGN KEY (\"shopid\")
REFERENCES \"public\".\"bodyshops\"(\"id\") ON UPDATE restrict ON DELETE restrict);\nCREATE
OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_estimates_updated_at\"\nBEFORE
UPDATE ON \"public\".\"estimates\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
ON TRIGGER \"set_public_estimates_updated_at\" ON \"public\".\"estimates\" \nIS
'trigger to set value of column \"updated_at\" to current timestamp on row update';\n"
type: run_sql
- args:
name: estimates
schema: public
type: add_existing_table_or_view

View File

@@ -1,3 +0,0 @@
- args:
sql: DROP TABLE "public"."estimatelines"
type: run_sql

View File

@@ -1,20 +0,0 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: "CREATE TABLE \"public\".\"estimatelines\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
\"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz
NOT NULL DEFAULT now(), \"estimate_id\" uuid NOT NULL, \"line_desc\" text NOT
NULL, PRIMARY KEY (\"id\") , FOREIGN KEY (\"estimate_id\") REFERENCES \"public\".\"estimates\"(\"id\")
ON UPDATE restrict ON DELETE restrict);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_estimatelines_updated_at\"\nBEFORE
UPDATE ON \"public\".\"estimatelines\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
ON TRIGGER \"set_public_estimatelines_updated_at\" ON \"public\".\"estimatelines\"
\nIS 'trigger to set value of column \"updated_at\" to current timestamp on
row update';\n"
type: run_sql
- args:
name: estimatelines
schema: public
type: add_existing_table_or_view

View File

@@ -1,48 +0,0 @@
- args:
relationship: userByUser
table:
name: associations
schema: public
type: drop_relationship
- args:
relationship: bodyshopByBodyshop
table:
name: associations
schema: public
type: drop_relationship
- args:
relationship: associations
table:
name: bodyshops
schema: public
type: drop_relationship
- args:
relationship: estimates
table:
name: bodyshops
schema: public
type: drop_relationship
- args:
relationship: estimate
table:
name: estimatelines
schema: public
type: drop_relationship
- args:
relationship: bodyshop
table:
name: estimates
schema: public
type: drop_relationship
- args:
relationship: estimatelines
table:
name: estimates
schema: public
type: drop_relationship
- args:
relationship: associations
table:
name: users
schema: public
type: drop_relationship

View File

@@ -1,80 +0,0 @@
- args:
name: userByUser
table:
name: associations
schema: public
using:
foreign_key_constraint_on: user
type: create_object_relationship
- args:
name: bodyshopByBodyshop
table:
name: associations
schema: public
using:
foreign_key_constraint_on: bodyshop
type: create_object_relationship
- args:
name: associations
table:
name: bodyshops
schema: public
using:
foreign_key_constraint_on:
column: bodyshop
table:
name: associations
schema: public
type: create_array_relationship
- args:
name: estimates
table:
name: bodyshops
schema: public
using:
foreign_key_constraint_on:
column: shopid
table:
name: estimates
schema: public
type: create_array_relationship
- args:
name: estimate
table:
name: estimatelines
schema: public
using:
foreign_key_constraint_on: estimate_id
type: create_object_relationship
- args:
name: bodyshop
table:
name: estimates
schema: public
using:
foreign_key_constraint_on: shopid
type: create_object_relationship
- args:
name: estimatelines
table:
name: estimates
schema: public
using:
foreign_key_constraint_on:
column: estimate_id
table:
name: estimatelines
schema: public
type: create_array_relationship
- args:
name: associations
table:
name: users
schema: public
using:
foreign_key_constraint_on:
column: user
table:
name: associations
schema: public
type: create_array_relationship

View File

@@ -1,3 +0,0 @@
- args:
sql: ALTER TABLE "public"."users" DROP COLUMN "auth0id";
type: run_sql

View File

@@ -1,3 +0,0 @@
- args:
sql: ALTER TABLE "public"."users" ADD COLUMN "auth0id" text NULL;
type: run_sql

View File

@@ -1,6 +0,0 @@
- args:
sql: COMMENT ON COLUMN "public"."users"."auth0id" IS E'null'
type: run_sql
- args:
sql: alter table "public"."users" rename column "authid" to "auth0id";
type: run_sql

View File

@@ -1,6 +0,0 @@
- args:
sql: COMMENT ON COLUMN "public"."users"."auth0id" IS E''
type: run_sql
- args:
sql: alter table "public"."users" rename column "auth0id" to "authid";
type: run_sql

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_insert_permission

View File

@@ -1,23 +0,0 @@
- args:
permission:
allow_upsert: true
check:
authid:
_eq: X-Hasura-User-Id
columns:
- id
- username
- password
- created_at
- updated_at
- last_login
- authid
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: users
schema: public
type: create_insert_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_select_permission

View File

@@ -1,13 +0,0 @@
- args:
permission:
allow_aggregations: false
columns: []
filter:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: users
schema: public
type: create_select_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_update_permission

View File

@@ -1,15 +0,0 @@
- args:
permission:
columns: []
filter:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: users
schema: public
type: create_update_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_delete_permission

View File

@@ -1,10 +0,0 @@
- args:
permission:
filter:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: users
schema: public
type: create_delete_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_insert_permission

View File

@@ -1,22 +0,0 @@
- args:
permission:
allow_upsert: true
check:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
columns:
- id
- shop_name
- created_at
- updated_at
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_insert_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_select_permission

View File

@@ -1,15 +0,0 @@
- args:
permission:
allow_aggregations: false
columns: []
filter:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: bodyshops
schema: public
type: create_select_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission

View File

@@ -1,17 +0,0 @@
- args:
permission:
columns: []
filter:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_delete_permission

View File

@@ -1,12 +0,0 @@
- args:
permission:
filter:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: bodyshops
schema: public
type: create_delete_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_insert_permission

View File

@@ -1,20 +0,0 @@
- args:
permission:
allow_upsert: true
check:
userByUser:
authid:
_eq: X-Hasura-User-Id
columns:
- bodyshop
- user
- active
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: associations
schema: public
type: create_insert_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_select_permission

View File

@@ -1,14 +0,0 @@
- args:
permission:
allow_aggregations: false
columns: []
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: associations
schema: public
type: create_select_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_update_permission

View File

@@ -1,16 +0,0 @@
- args:
permission:
columns: []
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: associations
schema: public
type: create_update_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_delete_permission

View File

@@ -1,11 +0,0 @@
- args:
permission:
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: associations
schema: public
type: create_delete_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: estimates
schema: public
type: drop_insert_permission

View File

@@ -1,25 +0,0 @@
- args:
permission:
allow_upsert: true
check:
bodyshop:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
columns:
- id
- created_at
- updated_at
- est_number
- ro_number
- shopid
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: estimates
schema: public
type: create_insert_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: estimates
schema: public
type: drop_select_permission

View File

@@ -1,22 +0,0 @@
- args:
permission:
allow_aggregations: false
columns:
- est_number
- ro_number
- created_at
- updated_at
- id
- shopid
filter:
bodyshop:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: estimates
schema: public
type: create_select_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: estimates
schema: public
type: drop_update_permission

View File

@@ -1,24 +0,0 @@
- args:
permission:
columns:
- est_number
- ro_number
- created_at
- updated_at
- id
- shopid
filter:
bodyshop:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: estimates
schema: public
type: create_update_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: estimates
schema: public
type: drop_delete_permission

View File

@@ -1,13 +0,0 @@
- args:
permission:
filter:
bodyshop:
associations:
userByUser:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: estimates
schema: public
type: create_delete_permission

View File

@@ -1,20 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns: []
computed_fields: []
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: associations
schema: public
type: create_select_permission

View File

@@ -1,23 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- bodyshop
- user
- active
computed_fields: []
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: associations
schema: public
type: create_select_permission

View File

@@ -1,22 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_update_permission
- args:
permission:
columns: []
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: associations
schema: public
type: create_update_permission

View File

@@ -1,25 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_update_permission
- args:
permission:
columns:
- active
- bodyshop
- user
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: associations
schema: public
type: create_update_permission

View File

@@ -1,22 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_update_permission
- args:
permission:
columns: []
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: associations
schema: public
type: create_update_permission

View File

@@ -1,25 +0,0 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_update_permission
- args:
permission:
columns:
- active
- bodyshop
- user
filter:
userByUser:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: associations
schema: public
type: create_update_permission

View File

@@ -1,19 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns: []
computed_fields: []
filter:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: users
schema: public
type: create_select_permission

View File

@@ -1,26 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- id
- username
- password
- created_at
- updated_at
- last_login
- authid
computed_fields: []
filter:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: users
schema: public
type: create_select_permission

View File

@@ -1,21 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_update_permission
- args:
permission:
columns: []
filter:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: users
schema: public
type: create_update_permission

View File

@@ -1,28 +0,0 @@
- args:
role: user
table:
name: users
schema: public
type: drop_update_permission
- args:
permission:
columns:
- authid
- password
- username
- created_at
- last_login
- updated_at
- id
filter:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: users
schema: public
type: create_update_permission

View File

@@ -1,6 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_insert_permission

View File

@@ -1,14 +0,0 @@
- args:
permission:
allow_upsert: true
check: {}
columns: []
localPresets:
- key: ""
value: ""
set: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_insert_permission

View File

@@ -1,19 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_insert_permission
- args:
permission:
check: {}
columns: []
localPresets:
- key: ""
value: ""
set: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_insert_permission

View File

@@ -1,21 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_insert_permission
- args:
permission:
check: {}
columns:
- value
- key
localPresets:
- key: ""
value: ""
set: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_insert_permission

View File

@@ -1,19 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_insert_permission
- args:
permission:
check: {}
columns: []
localPresets:
- key: ""
value: ""
set: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_insert_permission

View File

@@ -1,19 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_insert_permission
- args:
permission:
check: {}
columns: []
localPresets:
- key: ""
value: ""
set: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_insert_permission

View File

@@ -1,13 +0,0 @@
- args:
permission:
check: {}
columns: []
localPresets:
- key: ""
value: ""
set: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_insert_permission

View File

@@ -1,6 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_insert_permission

View File

@@ -1,6 +0,0 @@
- args:
role: user
table:
name: masterdata
schema: public
type: drop_select_permission

View File

@@ -1,13 +0,0 @@
- args:
permission:
allow_aggregations: false
columns:
- value
- key
filter: {}
limit: null
role: user
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -1,6 +0,0 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_select_permission

View File

@@ -1,13 +0,0 @@
- args:
permission:
allow_aggregations: false
columns:
- value
- key
filter: {}
limit: null
role: anonymous
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -1,6 +1,6 @@
- args:
sql: CREATE TABLE "public"."masterdata"("key" text NOT NULL, "value" jsonb NOT
NULL, PRIMARY KEY ("key") , UNIQUE ("key"));
NULL, PRIMARY KEY ("key") );
type: run_sql
- args:
name: masterdata

View File

@@ -0,0 +1,15 @@
- args:
sql: "CREATE TABLE \"public\".\"users\"(\"email\" text NOT NULL, \"authid\" text
NOT NULL, \"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\"
timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (\"email\") );\nCREATE OR REPLACE
FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS TRIGGER
AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_users_updated_at\"\nBEFORE
UPDATE ON \"public\".\"users\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
ON TRIGGER \"set_public_users_updated_at\" ON \"public\".\"users\" \nIS 'trigger
to set value of column \"updated_at\" to current timestamp on row update';\n"
type: run_sql
- args:
name: users
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,11 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: CREATE TABLE "public"."bodyshops"("shopid" uuid NOT NULL DEFAULT gen_random_uuid(),
"name" text NOT NULL, PRIMARY KEY ("shopid") );
type: run_sql
- args:
name: bodyshops
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,11 @@
- args:
sql: CREATE TABLE "public"."associations"("shopid" uuid NOT NULL, "useremail"
text NOT NULL, "active" boolean NOT NULL DEFAULT false, PRIMARY KEY ("shopid","useremail")
, FOREIGN KEY ("shopid") REFERENCES "public"."bodyshops"("shopid") ON UPDATE
restrict ON DELETE restrict, FOREIGN KEY ("useremail") REFERENCES "public"."users"("email")
ON UPDATE restrict ON DELETE restrict);
type: run_sql
- args:
name: associations
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,3 @@
- args:
sql: DROP TABLE "public"."jobs"
type: run_sql

View File

@@ -0,0 +1,13 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: CREATE TABLE "public"."jobs"("jobid" uuid NOT NULL DEFAULT gen_random_uuid(),
"ro_number" text NOT NULL, "est_number" text NOT NULL, "shopid" uuid NOT NULL,
PRIMARY KEY ("jobid") , FOREIGN KEY ("shopid") REFERENCES "public"."bodyshops"("shopid")
ON UPDATE restrict ON DELETE restrict);
type: run_sql
- args:
name: jobs
schema: public
type: add_existing_table_or_view

View File

@@ -1,7 +1,7 @@
{
"name": "bodyshop-server",
"version": "0.0.1",
"license": "Copyright Snapt Software (C) 2019",
"license": "UNLICENSED",
"engines": {
"node": "12.13.1",
"npm": "6.11.3"