From 222194e55404451474c2ef29985123eb1a0accd2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 4 Aug 2021 00:49:21 +0200 Subject: [PATCH] Key Controller + list --- controllers/GraphqlKey.php | 16 ++++++ controllers/Playground.php | 2 - controllers/graphqlkey/_list_toolbar.htm | 17 ++++++ controllers/graphqlkey/config_list.yaml | 11 ++++ controllers/graphqlkey/index.htm | 1 + controllers/playground/index.htm | 1 - lang/en/lang.php | 56 +++++++++---------- models/GraphqlKey.php | 29 ++++++++++ models/graphqlkey/columns.yaml | 13 +++++ plugin.yaml | 37 +++++++----- updates/builder_table_create_graphql_keys.php | 6 +- 11 files changed, 141 insertions(+), 48 deletions(-) create mode 100644 controllers/GraphqlKey.php create mode 100644 controllers/graphqlkey/_list_toolbar.htm create mode 100644 controllers/graphqlkey/config_list.yaml create mode 100644 controllers/graphqlkey/index.htm create mode 100644 models/GraphqlKey.php create mode 100644 models/graphqlkey/columns.yaml diff --git a/controllers/GraphqlKey.php b/controllers/GraphqlKey.php new file mode 100644 index 0000000..3dad937 --- /dev/null +++ b/controllers/GraphqlKey.php @@ -0,0 +1,16 @@ + + + diff --git a/controllers/graphqlkey/config_list.yaml b/controllers/graphqlkey/config_list.yaml new file mode 100644 index 0000000..5d34fbf --- /dev/null +++ b/controllers/graphqlkey/config_list.yaml @@ -0,0 +1,11 @@ +list: $/germanairlinesva/graphql/models/graphqlkey/columns.yaml +modelClass: GermanAirlinesVa\Graphql\Models\GraphqlKey +title: GraphQL Keys +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' diff --git a/controllers/graphqlkey/index.htm b/controllers/graphqlkey/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/controllers/graphqlkey/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/controllers/playground/index.htm b/controllers/playground/index.htm index 5703cc5..a21a437 100644 --- a/controllers/playground/index.htm +++ b/controllers/playground/index.htm @@ -1,2 +1 @@ -
diff --git a/lang/en/lang.php b/lang/en/lang.php index 713f30e..2414f80 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -1,33 +1,33 @@ [ - 'name' => 'GA GraphQL', - 'description' => '', - ], - 'menu' => [ - 'playground' => 'GA GraphiQL', - ], - 'permission' => [ - 'tab' => [ - 'schemas' => 'German Airlines VA - GraphQL', + 'plugin' => [ + 'name' => 'GA GraphQL', + 'description' => '', ], - 'label' => [ - 'schemas' => 'Access GraphiQL', + 'menu' => [ + 'main' => 'GA GraphQL', + 'keys' => 'GraphQL Keys', + 'playground' => 'GraphiQL', ], - ], - 'settings' => [ - 'label' => 'German Airlines VA - GraphQL', - 'description' => 'Configure GrapQL', - 'general' => 'General', - 'engine' => 'Engine', - 'enable_cache' => [ - 'label' => 'Enable Schema Cache', - 'comment' => - 'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.', + 'permission' => [ + 'tab' => [ + 'schemas' => 'German Airlines VA - GraphQL', + ], + 'label' => [ + 'schemas' => 'Access GraphiQL', + ], ], - 'batched_queries' => [ - 'label' => 'Batched Queries', - 'comment' => - 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.', + 'settings' => [ + 'label' => 'German Airlines VA - GraphQL', + 'description' => 'Configure GrapQL', + 'general' => 'General', + 'engine' => 'Engine', + 'enable_cache' => [ + 'label' => 'Enable Schema Cache', + 'comment' => 'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.', + ], + 'batched_queries' => [ + 'label' => 'Batched Queries', + 'comment' => 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.', + ], ], - ], -]; +]; \ No newline at end of file diff --git a/models/GraphqlKey.php b/models/GraphqlKey.php new file mode 100644 index 0000000..60bf236 --- /dev/null +++ b/models/GraphqlKey.php @@ -0,0 +1,29 @@ + 'required', + 'key' => 'required', + ]; +} diff --git a/models/graphqlkey/columns.yaml b/models/graphqlkey/columns.yaml new file mode 100644 index 0000000..0e45288 --- /dev/null +++ b/models/graphqlkey/columns.yaml @@ -0,0 +1,13 @@ +columns: + id: + label: id + type: number + member_id: + label: member_id + type: number + valid_from: + label: valid_from + type: datetime + key: + label: key + type: text diff --git a/plugin.yaml b/plugin.yaml index c153034..0a19b9f 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,17 +1,26 @@ plugin: - name: 'germanairlinesva.graphql::lang.plugin.name' - description: 'germanairlinesva.graphql::lang.plugin.description' - author: 'German Airlines VA' - icon: oc-icon-database - homepage: '' + name: 'germanairlinesva.graphql::lang.plugin.name' + description: 'germanairlinesva.graphql::lang.plugin.description' + author: 'German Airlines VA' + icon: oc-icon-database + homepage: '' permissions: - schemas: - tab: 'germanairlinesva.graphql::lang.permission.tab.schemas' - label: 'germanairlinesva.graphql::lang.permission.label.schemas' + schemas: + tab: 'germanairlinesva.graphql::lang.permission.tab.schemas' + label: 'germanairlinesva.graphql::lang.permission.label.schemas' navigation: - menu: - label: 'germanairlinesva.graphql::lang.menu.playground' - url: germanairlinesva/graphql/playground - icon: icon-database - permissions: - - schemas + menu: + label: 'germanairlinesva.graphql::lang.menu.main' + url: / + icon: icon-database + permissions: + - schemas + sideMenu: + side-menu-item: + label: 'germanairlinesva.graphql::lang.menu.playground' + url: germanairlinesva/graphql/playground + icon: icon-database + side-menu-item2: + label: 'germanairlinesva.graphql::lang.menu.keys' + url: germanairlinesva/graphql/graphqlkey + icon: icon-key diff --git a/updates/builder_table_create_graphql_keys.php b/updates/builder_table_create_graphql_keys.php index e741252..433c84d 100644 --- a/updates/builder_table_create_graphql_keys.php +++ b/updates/builder_table_create_graphql_keys.php @@ -1,18 +1,18 @@ -create('graphql_keys', function ($table) { $table->engine = 'InnoDB'; $table->bigIncrements('id')->unsigned(); + $table->bigInteger('member_id')->unsigned(); $table->datetime('valid_from')->default(DB::raw('NOW()')); - $table->datetime('valid_to')->default(DB::raw('NOW()')); $table->string('key'); }); }