From c2f71d2efc86fdbc593a0256a99300de194e56bd Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Mon, 10 Jul 2023 17:52:26 +0200 Subject: [PATCH] reconnected basic projects directus CRUD (no auth) --- schema.graphql | 492 ++------------------------- src/routes/projects/[[id]]/+page.gql | 24 +- 2 files changed, 44 insertions(+), 472 deletions(-) diff --git a/schema.graphql b/schema.graphql index 06389bf..5431557 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1,12 +1,15 @@ """ISO8601 Date values""" scalar Date +enum EventEnum { + create + delete + update +} + """A Float or a String""" scalar GraphQLStringOrFloat -"""Hashed string values""" -scalar Hash - """ The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). """ @@ -15,8 +18,6 @@ scalar JSON type Mutation { create_Projects_item(data: create_Projects_input!): Projects create_Projects_items(data: [create_Projects_input!], filter: Projects_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Projects!]! - create_todos_item(data: create_todos_input!): todos - create_todos_items(data: [create_todos_input!], filter: todos_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [todos!]! delete_Projects_item(id: ID!): delete_one delete_Projects_items(ids: [ID]!): delete_many update_Projects_batch(data: [update_Projects_input!], filter: Projects_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Projects!]! @@ -32,6 +33,8 @@ type Projects { favorite: Boolean id: ID! name: String + sort: Int + status: String user_created: String user_updated: String } @@ -55,12 +58,14 @@ type Projects_aggregated_count { favorite: Int id: Int name: Int + sort: Int + status: Int user_created: Int user_updated: Int } type Projects_aggregated_fields { - id: Float + sort: Float } input Projects_filter { @@ -71,225 +76,28 @@ input Projects_filter { date_updated: date_filter_operators date_updated_func: datetime_function_filter_operators favorite: boolean_filter_operators - id: number_filter_operators + id: string_filter_operators name: string_filter_operators + sort: number_filter_operators + status: string_filter_operators user_created: string_filter_operators user_updated: string_filter_operators } +type Projects_mutated { + data: Projects + event: EventEnum + key: ID! +} + type Query { Projects(filter: Projects_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Projects!]! Projects_aggregated(filter: Projects_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Projects_aggregated!]! Projects_by_id(id: ID!): Projects - apps(filter: apps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps!]! - apps_aggregated(filter: apps_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_aggregated!]! - apps_by_id(id: ID!): apps - apps_ora_components(filter: apps_ora_components_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_ora_components!]! - apps_ora_components_aggregated(filter: apps_ora_components_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_ora_components_aggregated!]! - apps_ora_components_by_id(id: ID!): apps_ora_components - apps_todos(filter: apps_todos_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_todos!]! - apps_todos_aggregated(filter: apps_todos_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_todos_aggregated!]! - apps_todos_by_id(id: ID!): apps_todos - apps_views(filter: apps_views_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_views!]! - apps_views_aggregated(filter: apps_views_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_views_aggregated!]! - apps_views_by_id(id: ID!): apps_views - ora_components(filter: ora_components_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [ora_components!]! - ora_components_aggregated(filter: ora_components_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [ora_components_aggregated!]! - ora_components_by_id(id: ID!): ora_components - ora_components_code(filter: ora_components_code_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [ora_components_code!]! - ora_components_code_aggregated(filter: ora_components_code_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [ora_components_code_aggregated!]! - ora_components_code_by_id(id: ID!): ora_components_code - todos(filter: todos_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [todos!]! - todos_aggregated(filter: todos_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [todos_aggregated!]! - todos_by_id(id: ID!): todos - views(filter: views_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [views!]! - views_aggregated(filter: views_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [views_aggregated!]! - views_by_id(id: ID!): views - views_collections(filter: views_collections_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [views_collections!]! - views_collections_aggregated(filter: views_collections_filter, groupBy: [String], limit: Int, offset: Int, page: Int, search: String, sort: [String]): [views_collections_aggregated!]! - views_collections_by_id(id: ID!): views_collections } -type apps { - components(filter: apps_ora_components_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_ora_components] - components_func: count_functions - date_created: Date - date_created_func: datetime_functions - date_updated: Date - date_updated_func: datetime_functions - id: ID! - image: String - name: String - sort: Int - todos(filter: apps_todos_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_todos] - todos_func: count_functions - user_created: String - user_updated: String - views(filter: apps_views_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_views] - views_func: count_functions -} - -type apps_aggregated { - avg: apps_aggregated_fields - avgDistinct: apps_aggregated_fields - count: apps_aggregated_count - countAll: Int - countDistinct: apps_aggregated_count - group: JSON - max: apps_aggregated_fields - min: apps_aggregated_fields - sum: apps_aggregated_fields - sumDistinct: apps_aggregated_fields -} - -type apps_aggregated_count { - components: Int - date_created: Int - date_updated: Int - id: Int - image: Int - name: Int - sort: Int - todos: Int - user_created: Int - user_updated: Int - views: Int -} - -type apps_aggregated_fields { - sort: Float -} - -input apps_filter { - _and: [apps_filter] - _or: [apps_filter] - components: apps_ora_components_filter - components_func: count_function_filter_operators - date_created: date_filter_operators - date_created_func: datetime_function_filter_operators - date_updated: date_filter_operators - date_updated_func: datetime_function_filter_operators - id: string_filter_operators - image: string_filter_operators - name: string_filter_operators - sort: number_filter_operators - todos: apps_todos_filter - todos_func: count_function_filter_operators - user_created: string_filter_operators - user_updated: string_filter_operators - views: apps_views_filter - views_func: count_function_filter_operators -} - -type apps_ora_components { - apps_id(filter: apps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): apps - id: ID! - ora_components_id(filter: ora_components_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): ora_components -} - -type apps_ora_components_aggregated { - avg: apps_ora_components_aggregated_fields - avgDistinct: apps_ora_components_aggregated_fields - count: apps_ora_components_aggregated_count - countAll: Int - countDistinct: apps_ora_components_aggregated_count - group: JSON - max: apps_ora_components_aggregated_fields - min: apps_ora_components_aggregated_fields - sum: apps_ora_components_aggregated_fields - sumDistinct: apps_ora_components_aggregated_fields -} - -type apps_ora_components_aggregated_count { - apps_id: Int - id: Int - ora_components_id: Int -} - -type apps_ora_components_aggregated_fields { - id: Float -} - -input apps_ora_components_filter { - _and: [apps_ora_components_filter] - _or: [apps_ora_components_filter] - apps_id: apps_filter - id: number_filter_operators - ora_components_id: ora_components_filter -} - -type apps_todos { - apps_id(filter: apps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): apps - id: ID! - todos_id(filter: todos_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): todos -} - -type apps_todos_aggregated { - avg: apps_todos_aggregated_fields - avgDistinct: apps_todos_aggregated_fields - count: apps_todos_aggregated_count - countAll: Int - countDistinct: apps_todos_aggregated_count - group: JSON - max: apps_todos_aggregated_fields - min: apps_todos_aggregated_fields - sum: apps_todos_aggregated_fields - sumDistinct: apps_todos_aggregated_fields -} - -type apps_todos_aggregated_count { - apps_id: Int - id: Int - todos_id: Int -} - -type apps_todos_aggregated_fields { - id: Float -} - -input apps_todos_filter { - _and: [apps_todos_filter] - _or: [apps_todos_filter] - apps_id: apps_filter - id: number_filter_operators - todos_id: todos_filter -} - -type apps_views { - apps_id(filter: apps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): apps - id: ID! - views_id(filter: views_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): views -} - -type apps_views_aggregated { - avg: apps_views_aggregated_fields - avgDistinct: apps_views_aggregated_fields - count: apps_views_aggregated_count - countAll: Int - countDistinct: apps_views_aggregated_count - group: JSON - max: apps_views_aggregated_fields - min: apps_views_aggregated_fields - sum: apps_views_aggregated_fields - sumDistinct: apps_views_aggregated_fields -} - -type apps_views_aggregated_count { - apps_id: Int - id: Int - views_id: Int -} - -type apps_views_aggregated_fields { - id: Float -} - -input apps_views_filter { - _and: [apps_views_filter] - _or: [apps_views_filter] - apps_id: apps_filter - id: number_filter_operators - views_id: views_filter +type Subscription { + Projects_mutated(event: EventEnum): Projects_mutated } input boolean_filter_operators { @@ -299,43 +107,16 @@ input boolean_filter_operators { _null: Boolean } -input count_function_filter_operators { - count: number_filter_operators -} - -type count_functions { - count: Int -} - input create_Projects_input { date_created: Date date_updated: Date favorite: Boolean id: ID name: String - user_created: create_directus_users_input - user_updated: create_directus_users_input -} - -input create_directus_users_input { - avatar: String - description: String - email: String - first_name: String - last_name: String - location: String - password: Hash - role: String - title: String -} - -input create_todos_input { - date_created: Date - date_updated: Date - id: ID - name: String - user_created: create_directus_users_input - user_updated: create_directus_users_input + sort: Int + status: String + user_created: String + user_updated: String } input date_filter_operators { @@ -398,245 +179,36 @@ input number_filter_operators { _null: Boolean } -type ora_components { - apps(filter: apps_ora_components_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [apps_ora_components] - apps_func: count_functions - code: String - date_created: Date - date_created_func: datetime_functions - date_updated: Date - date_updated_func: datetime_functions - id: ID! - name: String! - svelte: String - user_created: String - user_updated: String -} - -type ora_components_aggregated { - count: ora_components_aggregated_count - countAll: Int - countDistinct: ora_components_aggregated_count - group: JSON -} - -type ora_components_aggregated_count { - apps: Int - code: Int - date_created: Int - date_updated: Int - id: Int - name: Int - svelte: Int - user_created: Int - user_updated: Int -} - -type ora_components_code { - collection: String - id: ID! - item: ora_components_code_item_union - ora_components_id(filter: ora_components_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): ora_components -} - -type ora_components_code_aggregated { - avg: ora_components_code_aggregated_fields - avgDistinct: ora_components_code_aggregated_fields - count: ora_components_code_aggregated_count - countAll: Int - countDistinct: ora_components_code_aggregated_count - group: JSON - max: ora_components_code_aggregated_fields - min: ora_components_code_aggregated_fields - sum: ora_components_code_aggregated_fields - sumDistinct: ora_components_code_aggregated_fields -} - -type ora_components_code_aggregated_count { - collection: Int - id: Int - item: Int - ora_components_id: Int -} - -type ora_components_code_aggregated_fields { - id: Float -} - -input ora_components_code_filter { - _and: [ora_components_code_filter] - _or: [ora_components_code_filter] - collection: string_filter_operators - id: number_filter_operators - item__ora_components: ora_components_filter - ora_components_id: ora_components_filter -} - -union ora_components_code_item_union = ora_components - -input ora_components_filter { - _and: [ora_components_filter] - _or: [ora_components_filter] - apps: apps_ora_components_filter - apps_func: count_function_filter_operators - code: string_filter_operators - date_created: date_filter_operators - date_created_func: datetime_function_filter_operators - date_updated: date_filter_operators - date_updated_func: datetime_function_filter_operators - id: string_filter_operators - name: string_filter_operators - svelte: string_filter_operators - user_created: string_filter_operators - user_updated: string_filter_operators -} - input string_filter_operators { _contains: String _empty: Boolean _ends_with: String _eq: String _icontains: String + _iends_with: String _in: [String] + _istarts_with: String _ncontains: String _nempty: Boolean _nends_with: String _neq: String + _niends_with: String _nin: [String] + _nistarts_with: String _nnull: Boolean _nstarts_with: String _null: Boolean _starts_with: String } -type todos { - date_created: Date - date_created_func: datetime_functions - date_updated: Date - date_updated_func: datetime_functions - id: ID! - name: String - user_created: String - user_updated: String -} - -type todos_aggregated { - count: todos_aggregated_count - countAll: Int - countDistinct: todos_aggregated_count - group: JSON -} - -type todos_aggregated_count { - date_created: Int - date_updated: Int - id: Int - name: Int - user_created: Int - user_updated: Int -} - -input todos_filter { - _and: [todos_filter] - _or: [todos_filter] - date_created: date_filter_operators - date_created_func: datetime_function_filter_operators - date_updated: date_filter_operators - date_updated_func: datetime_function_filter_operators - id: string_filter_operators - name: string_filter_operators - user_created: string_filter_operators - user_updated: string_filter_operators -} - input update_Projects_input { date_created: Date date_updated: Date favorite: Boolean id: ID name: String + sort: Int + status: String user_created: String user_updated: String } - -type views { - date_created: Date - date_created_func: datetime_functions - date_updated: Date - date_updated_func: datetime_functions - id: ID! - name: String - user_created: String - user_updated: String -} - -type views_aggregated { - count: views_aggregated_count - countAll: Int - countDistinct: views_aggregated_count - group: JSON -} - -type views_aggregated_count { - date_created: Int - date_updated: Int - id: Int - name: Int - user_created: Int - user_updated: Int -} - -type views_collections { - collection: String - id: ID! - item: views_collections_item_union - views_id(filter: views_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): views -} - -type views_collections_aggregated { - avg: views_collections_aggregated_fields - avgDistinct: views_collections_aggregated_fields - count: views_collections_aggregated_count - countAll: Int - countDistinct: views_collections_aggregated_count - group: JSON - max: views_collections_aggregated_fields - min: views_collections_aggregated_fields - sum: views_collections_aggregated_fields - sumDistinct: views_collections_aggregated_fields -} - -type views_collections_aggregated_count { - collection: Int - id: Int - item: Int - views_id: Int -} - -type views_collections_aggregated_fields { - id: Float -} - -input views_collections_filter { - _and: [views_collections_filter] - _or: [views_collections_filter] - collection: string_filter_operators - id: number_filter_operators - item__todos: todos_filter - views_id: views_filter -} - -union views_collections_item_union = todos - -input views_filter { - _and: [views_filter] - _or: [views_filter] - date_created: date_filter_operators - date_created_func: datetime_function_filter_operators - date_updated: date_filter_operators - date_updated_func: datetime_function_filter_operators - id: string_filter_operators - name: string_filter_operators - user_created: string_filter_operators - user_updated: string_filter_operators -} diff --git a/src/routes/projects/[[id]]/+page.gql b/src/routes/projects/[[id]]/+page.gql index af4d30c..a8bc37a 100644 --- a/src/routes/projects/[[id]]/+page.gql +++ b/src/routes/projects/[[id]]/+page.gql @@ -1,12 +1,12 @@ -query Projects($id: ID! = 7) { - Projects_by_id(id: $id) { - id - name - favorite - } - Projects { - id - name - favorite - } -} \ No newline at end of file +query Projects($id: ID! = "734932fb-1675-4c5b-9c4b-5dbc0c4a6265") { + Projects_by_id(id: $id) { + id + name + favorite + } + Projects { + id + name + favorite + } +}