diff --git a/.gitignore b/.gitignore index ec9fa66b12..008f36801c 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ app-modules/**/resources/js/dist/* /.phpactor.json **/.DS_Store public/api-docs/* +/_lighthouse_ide_helper.php +/programmatic-types.graphql +/schema-directives.graphql diff --git a/app-modules/notifications/graphql/subscription.graphql b/app-modules/notifications/graphql/subscription.graphql index aa07093cf5..0d0f7fe660 100644 --- a/app-modules/notifications/graphql/subscription.graphql +++ b/app-modules/notifications/graphql/subscription.graphql @@ -1,21 +1,28 @@ -type UserSubscription @model(class: "subscription") { +type UserSubscription + @model(class: "AdvisingApp\\Notifications\\Models\\Subscription") { "Unique primary key." id: ID! + "The user related to this subscription." user: User! @belongsTo + "The subscribable the user is subscribed to." subscribable: Educatable! @morphTo + "The created date of the subscription." + created_at: DateTime + "The updated date of the subscription." + updated_at: DateTime } extend type Query { + "Get a subscription by its primary key." + userSubscription( + "Search by primary key." + id: ID! @whereKey + ): UserSubscription @find @canResolved(ability: "view") + "Get all subscriptions." userSubscriptions: [UserSubscription!]! @paginate @canModel(ability: "viewAny") - - "Get a subscription by its primary key." - findUserSubscription( - "The primary key of the subscription." - id: ID! @whereKey - ): UserSubscription @find @canResolved(ability: "view") } extend type Mutation { @@ -36,5 +43,5 @@ extend type Mutation { deleteUserSubscription( "The primary key of the subscription." id: ID! @whereKey - ): UserSubscription @delete @canFind(ability: "delete") + ): UserSubscription @delete @canFind(ability: "delete", find: "id") } diff --git a/composer.json b/composer.json index 2721152d95..b8add8365b 100644 --- a/composer.json +++ b/composer.json @@ -72,6 +72,7 @@ "lomkit/laravel-rest-api": "^2.3", "maatwebsite/excel": "^3.1", "microsoft/microsoft-graph": "^1.109", + "mll-lab/graphql-php-scalars": "^6.2", "nuwave/lighthouse": "^6.28", "owen-it/laravel-auditing": "dev-feature/queued-auditing@dev", "saade/filament-fullcalendar": "^3.1", @@ -204,6 +205,7 @@ "@php artisan lighthouse:print-schema -W -D public" ], "generate-api-docs": [ + "@php artisan lighthouse:ide-helper", "@prettier-format", "@print-schema", "npm run api-docs:generate" diff --git a/composer.lock b/composer.lock index b5876dcc02..6ece492752 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9bfaad2414272ba1599b5e9c467e60eb", + "content-hash": "114ab3eac3c7a0e2278d79df819b4371", "packages": [ { "name": "awcodes/filament-tiptap-editor", @@ -7715,6 +7715,67 @@ }, "time": "2023-12-01T09:41:49+00:00" }, + { + "name": "mll-lab/graphql-php-scalars", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/mll-lab/graphql-php-scalars.git", + "reference": "f0922636f090bc1e56f6a9efb3ebb8272aa5cff3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mll-lab/graphql-php-scalars/zipball/f0922636f090bc1e56f6a9efb3ebb8272aa5cff3", + "reference": "f0922636f090bc1e56f6a9efb3ebb8272aa5cff3", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.1.17 || ^3 || ^4", + "ext-json": "*", + "php": "^8", + "spatie/regex": "^1.4 || ^2 || ^3", + "thecodingmachine/safe": "^1.3 || ^2", + "webonyx/graphql-php": "^15" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.16", + "mll-lab/php-cs-fixer-config": "^5", + "phpstan/extension-installer": "^1", + "phpstan/phpstan": "^1", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1", + "phpunit/phpunit": "^9 || ^10", + "symfony/var-dumper": "^5.4 || ^6", + "thecodingmachine/phpstan-safe-rule": "^1.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "MLL\\GraphQLScalars\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Benedikt Franke", + "email": "benedikt@franke.tech" + } + ], + "description": "A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php", + "keywords": [ + "graphql", + "php" + ], + "support": { + "issues": "https://github.com/mll-lab/graphql-php-scalars/issues", + "source": "https://github.com/mll-lab/graphql-php-scalars/tree/v6.2.0" + }, + "time": "2023-05-09T13:20:50+00:00" + }, { "name": "monolog/monolog", "version": "3.5.0", @@ -19791,5 +19852,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/config/app.php b/config/app.php index 3766ace6d2..19e1923db0 100644 --- a/config/app.php +++ b/config/app.php @@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Facade; use App\Providers\MultiConnectionParallelTestingServiceProvider; +use Nuwave\Lighthouse\WhereConditions\WhereConditionsServiceProvider; return [ /* @@ -233,6 +234,7 @@ App\Providers\HealthServiceProvider::class, App\Providers\FilamentServiceProvider::class, MultiConnectionParallelTestingServiceProvider::class, + WhereConditionsServiceProvider::class, ], /*