Skip to content

Commit

Permalink
Merge pull request #365 from canyongbs/feature/advising-1145-add-api-…
Browse files Browse the repository at this point in the history
…capabilities-subscriptions-graphql

[ADVISING-1145]: Add API Capabilities for Subscriptions
  • Loading branch information
Orrison authored Dec 14, 2023
2 parents 4561e54 + c66cd6f commit 5d06bf8
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 15 additions & 8 deletions app-modules/notifications/graphql/subscription.graphql
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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")
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
65 changes: 63 additions & 2 deletions composer.lock

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

2 changes: 2 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

use Illuminate\Support\Facades\Facade;
use App\Providers\MultiConnectionParallelTestingServiceProvider;
use Nuwave\Lighthouse\WhereConditions\WhereConditionsServiceProvider;

return [
/*
Expand Down Expand Up @@ -233,6 +234,7 @@
App\Providers\HealthServiceProvider::class,
App\Providers\FilamentServiceProvider::class,
MultiConnectionParallelTestingServiceProvider::class,
WhereConditionsServiceProvider::class,
],

/*
Expand Down

0 comments on commit 5d06bf8

Please sign in to comment.