Skip to content

Commit

Permalink
Global schema (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
lolopinto authored Aug 2, 2022
1 parent 8b67155 commit 881c050
Show file tree
Hide file tree
Showing 109 changed files with 6,654 additions and 4,678 deletions.
14 changes: 7 additions & 7 deletions examples/simple/package-lock.json

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

2 changes: 1 addition & 1 deletion examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"tsconfig-paths": "^3.11.0"
},
"dependencies": {
"@snowtop/ent": "^0.1.0-alpha56",
"@snowtop/ent": "^0.1.0-alpha57",
"@snowtop/ent-email": "^0.1.0-alpha1",
"@snowtop/ent-passport": "^0.1.0-alpha1",
"@snowtop/ent-password": "^0.1.0-alpha1",
Expand Down
2 changes: 2 additions & 0 deletions examples/simple/src/ent/generated/const.ts

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

14 changes: 14 additions & 0 deletions examples/simple/src/schema/__global__schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { GlobalSchema } from "@snowtop/ent/schema/";

const glo: GlobalSchema = {
edges: [
{
// TODO what's the best API to edit this to add/remove edges
// can add a new "Action" API just to get this
// Not Action or Builder though so just something that returns Changeset(s)
name: "loginAuth",
schemaName: "User",
},
],
};
export default glo;
13 changes: 13 additions & 0 deletions examples/simple/src/schema/schema.py

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

15 changes: 14 additions & 1 deletion examples/simple/src/schema/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ CREATE TABLE events (
CONSTRAINT events_id_pkey PRIMARY KEY (id)
);

CREATE TABLE global_login_auth_edges (
id1 UUID NOT NULL,
id1_type TEXT NOT NULL,
edge_type UUID NOT NULL,
id2 UUID NOT NULL,
id2_type TEXT NOT NULL,
time TIMESTAMP WITHOUT TIME ZONE NOT NULL,
data TEXT,
CONSTRAINT global_login_auth_edges_id1_edge_type_id2_pkey PRIMARY KEY (id1, edge_type, id2)
);

CREATE INDEX global_login_auth_edges_time_idx ON global_login_auth_edges (time);

CREATE TABLE holidays (
id UUID NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
Expand Down Expand Up @@ -270,5 +283,5 @@ CREATE INDEX contacts_phone_number_ids_idx ON contacts USING gin (phone_number_i

CREATE INDEX contacts_user_id_idx ON contacts (user_id);

INSERT INTO assoc_edge_config(edge_name, edge_type, edge_table, symmetric_edge, inverse_edge_type, created_at, updated_at) VALUES('AddressToHostedEventsEdge', 'd1979d4b-d033-4562-b078-cc528fec25bb', 'address_hosted_events_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('CommentToPostEdge', 'f430af94-d38a-4aaa-a92f-cfc56b6f811b', 'object_comments_edges', false, '8caba9c4-8035-447f-9eb1-4dd09a2d250c', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToAttendingEdge', '6ebc0c47-ea29-4635-b991-95e44162174d', 'event_rsvps_edges', false, '2a98ba02-e342-4bb4-93f6-5d7ed02f5c48', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToDeclinedEdge', 'db8d2454-f7b2-4147-aae1-e666daf3f3c3', 'event_rsvps_edges', false, '1c7c173b-63ce-4002-b121-4a87f82047dd', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToHostsEdge', 'ebe3e709-845c-4723-ac9c-29f983f2b8ea', 'event_hosts_edges', false, 'cf6542a4-8bae-427f-8a1f-01194047afb3', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToInvitedEdge', 'a72f5f64-3580-44fd-9bd0-d1335b803a46', 'event_rsvps_edges', false, 'e439f2b2-d93a-4d1a-83f0-865bda5c8337', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToMaybeEdge', 'b0f6311b-fdab-4c26-b6bf-b751e0997735', 'event_rsvps_edges', false, '8d5b1dee-ce65-452e-9f8d-78eca1993800', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('ObjectToCommentsEdge', '8caba9c4-8035-447f-9eb1-4dd09a2d250c', 'object_comments_edges', false, 'f430af94-d38a-4aaa-a92f-cfc56b6f811b', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('ObjectToLikersEdge', 'c9ccdad9-7aff-40e4-9a69-2c29cfa19763', 'object_likers_edges', false, '745a20bf-4fdc-4862-b39f-569c4451db8f', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToCreatedEventsEdge', 'daa3b2a3-8245-40ca-ae77-25bfb82578a7', 'user_created_events_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToDeclinedEventsEdge', '1c7c173b-63ce-4002-b121-4a87f82047dd', 'event_rsvps_edges', false, 'db8d2454-f7b2-4147-aae1-e666daf3f3c3', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToEventsAttendingEdge', '2a98ba02-e342-4bb4-93f6-5d7ed02f5c48', 'event_rsvps_edges', false, '6ebc0c47-ea29-4635-b991-95e44162174d', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToFriendsEdge', 'd1a9316d-090f-4b02-b393-fd9372e2c905', 'user_friends_edges', true, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToHostedEventsEdge', 'cf6542a4-8bae-427f-8a1f-01194047afb3', 'event_hosts_edges', false, 'ebe3e709-845c-4723-ac9c-29f983f2b8ea', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToInvitedEventsEdge', 'e439f2b2-d93a-4d1a-83f0-865bda5c8337', 'event_rsvps_edges', false, 'a72f5f64-3580-44fd-9bd0-d1335b803a46', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToLikesEdge', '745a20bf-4fdc-4862-b39f-569c4451db8f', 'object_likers_edges', false, 'c9ccdad9-7aff-40e4-9a69-2c29cfa19763', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToMaybeEventsEdge', '8d5b1dee-ce65-452e-9f8d-78eca1993800', 'event_rsvps_edges', false, 'b0f6311b-fdab-4c26-b6bf-b751e0997735', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToPostEdge', '4b725578-e9f5-472c-8e57-e47481c9e1b8', 'object_comments_edges', false, '8caba9c4-8035-447f-9eb1-4dd09a2d250c', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToSelfContactEdge', 'd504201d-cf3f-4eef-b6a0-0b46a7ae186b', 'user_self_contact_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToUserToHostedEventsEdge', 'e5555185-91bf-4322-8130-d0a00eb605b7', 'event_hosts_edges', false, 'ebe3e709-845c-4723-ac9c-29f983f2b8ea', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC') ON CONFLICT DO NOTHING;
INSERT INTO assoc_edge_config(edge_name, edge_type, edge_table, symmetric_edge, inverse_edge_type, created_at, updated_at) VALUES('AddressToHostedEventsEdge', 'd1979d4b-d033-4562-b078-cc528fec25bb', 'address_hosted_events_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('CommentToPostEdge', 'f430af94-d38a-4aaa-a92f-cfc56b6f811b', 'object_comments_edges', false, '8caba9c4-8035-447f-9eb1-4dd09a2d250c', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToAttendingEdge', '6ebc0c47-ea29-4635-b991-95e44162174d', 'event_rsvps_edges', false, '2a98ba02-e342-4bb4-93f6-5d7ed02f5c48', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToDeclinedEdge', 'db8d2454-f7b2-4147-aae1-e666daf3f3c3', 'event_rsvps_edges', false, '1c7c173b-63ce-4002-b121-4a87f82047dd', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToHostsEdge', 'ebe3e709-845c-4723-ac9c-29f983f2b8ea', 'event_hosts_edges', false, 'cf6542a4-8bae-427f-8a1f-01194047afb3', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToInvitedEdge', 'a72f5f64-3580-44fd-9bd0-d1335b803a46', 'event_rsvps_edges', false, 'e439f2b2-d93a-4d1a-83f0-865bda5c8337', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('EventToMaybeEdge', 'b0f6311b-fdab-4c26-b6bf-b751e0997735', 'event_rsvps_edges', false, '8d5b1dee-ce65-452e-9f8d-78eca1993800', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('GlobalToLoginAuthEdge', '13eb6687-d226-4272-ba65-d5e33e00954c', 'global_login_auth_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('ObjectToCommentsEdge', '8caba9c4-8035-447f-9eb1-4dd09a2d250c', 'object_comments_edges', false, 'f430af94-d38a-4aaa-a92f-cfc56b6f811b', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('ObjectToLikersEdge', 'c9ccdad9-7aff-40e4-9a69-2c29cfa19763', 'object_likers_edges', false, '745a20bf-4fdc-4862-b39f-569c4451db8f', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToCreatedEventsEdge', 'daa3b2a3-8245-40ca-ae77-25bfb82578a7', 'user_created_events_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToDeclinedEventsEdge', '1c7c173b-63ce-4002-b121-4a87f82047dd', 'event_rsvps_edges', false, 'db8d2454-f7b2-4147-aae1-e666daf3f3c3', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToEventsAttendingEdge', '2a98ba02-e342-4bb4-93f6-5d7ed02f5c48', 'event_rsvps_edges', false, '6ebc0c47-ea29-4635-b991-95e44162174d', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToFriendsEdge', 'd1a9316d-090f-4b02-b393-fd9372e2c905', 'user_friends_edges', true, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToHostedEventsEdge', 'cf6542a4-8bae-427f-8a1f-01194047afb3', 'event_hosts_edges', false, 'ebe3e709-845c-4723-ac9c-29f983f2b8ea', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToInvitedEventsEdge', 'e439f2b2-d93a-4d1a-83f0-865bda5c8337', 'event_rsvps_edges', false, 'a72f5f64-3580-44fd-9bd0-d1335b803a46', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToLikesEdge', '745a20bf-4fdc-4862-b39f-569c4451db8f', 'object_likers_edges', false, 'c9ccdad9-7aff-40e4-9a69-2c29cfa19763', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToMaybeEventsEdge', '8d5b1dee-ce65-452e-9f8d-78eca1993800', 'event_rsvps_edges', false, 'b0f6311b-fdab-4c26-b6bf-b751e0997735', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToPostEdge', '4b725578-e9f5-472c-8e57-e47481c9e1b8', 'object_comments_edges', false, '8caba9c4-8035-447f-9eb1-4dd09a2d250c', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToSelfContactEdge', 'd504201d-cf3f-4eef-b6a0-0b46a7ae186b', 'user_self_contact_edges', false, NULL, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC'), ('UserToUserToHostedEventsEdge', 'e5555185-91bf-4322-8130-d0a00eb605b7', 'event_hosts_edges', false, 'ebe3e709-845c-4723-ac9c-29f983f2b8ea', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC') ON CONFLICT DO NOTHING;

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

4 changes: 4 additions & 0 deletions examples/todo-sqlite/ent.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
globalSchemaPath: global_schema.ts
codegen:
disableBase64Encoding: true
generateRootResolvers: true
defaultGraphQLMutationName: VerbNoun
defaultGraphQLFieldFormat: snake_case
fieldPrivacyEvaluated: at_ent_load
customAssocEdgePath:
path: 'src/ent/edge/custom_edge.ts'
name: 'CustomTodoEdge'

Loading

0 comments on commit 881c050

Please sign in to comment.