From 1f6c982db21cef348424efd43b70618732f470ae Mon Sep 17 00:00:00 2001 From: Derek Goetz Date: Tue, 5 Mar 2024 13:54:27 -0500 Subject: [PATCH] Update more references. --- .../Pages/CreateEmailTemplate.php | 4 +- .../Pages/EditEmailTemplate.php | 4 +- .../interaction/graphql/interaction.graphql | 411 +++++++++--------- .../notification/graphql/subscription.graphql | 126 +++--- .../src/Rules/SubscribableIdExistsRule.php | 2 +- .../Concerns/HasSharedFormConfiguration.php | 2 +- .../task/database/seeders/TaskSeeder.php | 22 +- 7 files changed, 272 insertions(+), 299 deletions(-) diff --git a/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/CreateEmailTemplate.php b/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/CreateEmailTemplate.php index 41eb11445..68b2e394f 100644 --- a/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/CreateEmailTemplate.php +++ b/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/CreateEmailTemplate.php @@ -65,8 +65,8 @@ public function form(Form $form): Form ->visibility('public') ->directory('editor-images/email-templates') ->mergeTags([ - 'student full name', - 'student email', + 'contact full name', + 'contact email', ]) ->profile('email') ->output(TiptapOutput::Json) diff --git a/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/EditEmailTemplate.php b/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/EditEmailTemplate.php index 06616010c..3ef81a2bb 100644 --- a/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/EditEmailTemplate.php +++ b/app-modules/engagement/src/Filament/Resources/EmailTemplateResource/Pages/EditEmailTemplate.php @@ -64,8 +64,8 @@ public function form(Form $form): Form ->disk('s3-public') ->visibility('public') ->mergeTags([ - 'student full name', - 'student email', + 'contact full name', + 'contact email', ]) ->profile('email') ->output(TiptapOutput::Json) diff --git a/app-modules/interaction/graphql/interaction.graphql b/app-modules/interaction/graphql/interaction.graphql index 251d08566..8816f03a8 100644 --- a/app-modules/interaction/graphql/interaction.graphql +++ b/app-modules/interaction/graphql/interaction.graphql @@ -1,259 +1,250 @@ -union Interactable = Student | Contact | ServiceRequest +union Interactable = Contact | ServiceRequest enum InteractableType { - Student @enum(value: "student") - Contact @enum(value: "contact") - ServiceRequest @enum(value: "service_request") + Contact @enum(value: "contact") + ServiceRequest @enum(value: "service_request") } scalar InteractableId - @scalar(class: "App\\GraphQL\\Scalars\\InteractableId") - @searchByOperators(type: "ID") + @scalar(class: "App\\GraphQL\\Scalars\\InteractableId") + @searchByOperators(type: "ID") type Interaction - @model(class: "AdvisingApp\\Interaction\\Models\\Interaction") { - "Unique primary key." - id: UUID! + @model(class: "AdvisingApp\\Interaction\\Models\\Interaction") { + "Unique primary key." + id: UUID! - "The subject of the interaction." - subject: String! + "The subject of the interaction." + subject: String! - "The description of the interaction." - description: String! + "The description of the interaction." + description: String! - "The User related to the interaction." - user: User @belongsTo @canResolved(ability: "view") + "The User related to the interaction." + user: User @belongsTo @canResolved(ability: "view") - "The Interactable related to the interaction." - interactable: Interactable @morphTo + "The Interactable related to the interaction." + interactable: Interactable @morphTo - "The type of interaction." - type: InteractionType @belongsTo + "The type of interaction." + type: InteractionType @belongsTo - "The relation of the interaction." - relation: InteractionRelation @belongsTo + "The relation of the interaction." + relation: InteractionRelation @belongsTo - "The campaign of the interaction." - campaign: InteractionCampaign @belongsTo + "The campaign of the interaction." + campaign: InteractionCampaign @belongsTo - "The driver of the interaction." - driver: InteractionDriver @belongsTo + "The driver of the interaction." + driver: InteractionDriver @belongsTo - "The status of the interaction." - status: InteractionStatus @belongsTo + "The status of the interaction." + status: InteractionStatus @belongsTo - "The outcome of the interaction." - outcome: InteractionOutcome @belongsTo + "The outcome of the interaction." + outcome: InteractionOutcome @belongsTo - "The division of the interaction." - division: Division @belongsTo + "The division of the interaction." + division: Division @belongsTo - "The start datetime of the interaction." - start_datetime: DateTime! + "The start datetime of the interaction." + start_datetime: DateTime! - "The end datetime of the interaction." - end_datetime: DateTime + "The end datetime of the interaction." + end_datetime: DateTime - "The created datetime of the interaction." - created_at: DateTime + "The created datetime of the interaction." + created_at: DateTime - "The updated datetime of the interaction." - updated_at: DateTime + "The updated datetime of the interaction." + updated_at: DateTime } input InteractionInteractablesQuery { - student: StudentsQuery - contact: ContactsQuery - service_request: ServiceRequestQuery + contact: ContactsQuery + service_request: ServiceRequestQuery } input InteractionsQuery { - id: UUID - subject: String - description: String - user: UsersQuery - interactable: InteractionInteractablesQuery @morphToRelation - interactable_id: InteractableId - interactable_type: InteractableType - relation: InteractionRelationQuery - campaign: InteractionCampaignQuery - driver: InteractionDriverQuery - status: InteractionStatusesQuery - outcome: InteractionOutcomeQuery - division: DivisionQuery - start_datetime: DateTime - end_datetime: DateTime - created_at: DateTime - updated_at: DateTime + id: UUID + subject: String + description: String + user: UsersQuery + interactable: InteractionInteractablesQuery @morphToRelation + interactable_id: InteractableId + interactable_type: InteractableType + relation: InteractionRelationQuery + campaign: InteractionCampaignQuery + driver: InteractionDriverQuery + status: InteractionStatusesQuery + outcome: InteractionOutcomeQuery + division: DivisionQuery + start_datetime: DateTime + end_datetime: DateTime + created_at: DateTime + updated_at: DateTime } type InteractionQueries { - "Find a single interaction by an identifying attribute." - find( - "The value of the attribute to match." - id: UUID! - @whereKey - @rules(apply: ["required", "uuid", "exists:interactions"]) - ): Interaction @find @canResolved(ability: "view") - - "List multiple interactions." - list(where: InteractionsQuery @searchBy): [Interaction!]! - @paginate - @canModel(ability: "viewAny") + "Find a single interaction by an identifying attribute." + find( + "The value of the attribute to match." + id: UUID! + @whereKey + @rules(apply: ["required", "uuid", "exists:interactions"]) + ): Interaction @find @canResolved(ability: "view") + + "List multiple interactions." + list(where: InteractionsQuery @searchBy): [Interaction!]! + @paginate + @canModel(ability: "viewAny") } extend type Query { - interaction: InteractionQueries! @namespaced + interaction: InteractionQueries! @namespaced } input CreateInteractionInput { - "The subject of the interaction." - subject: String! @rules(apply: ["required", "string", "max:255"]) - - "The description of the interaction." - description: String! @rules(apply: ["required", "string"]) - - "The User related to the interaction." - user_id: UUID! @rules(apply: ["required", "exists:users,id"]) - - "The Interactable related to the interaction." - interactable_id: InteractableId! - @rules( - apply: [ - "required" - "AdvisingApp\\Interaction\\Rules\\InteractableIdExistsRule" - ] - ) - - "The type of Interactable related to the interaction." - interactable_type: InteractableType! - @rules(apply: ["required", "in:student,contact,service_request"]) - - "The type of interaction." - interaction_type_id: UUID! - @rules(apply: ["required", "exists:interaction_types,id"]) - - "The relation of the interaction." - interaction_relation_id: UUID! - @rules(apply: ["required", "exists:interaction_relations,id"]) - - "The campaign of the interaction." - interaction_campaign_id: UUID! - @rules(apply: ["required", "exists:interaction_campaigns,id"]) - - "The driver of the interaction." - interaction_driver_id: UUID! - @rules(apply: ["required", "exists:interaction_drivers,id"]) - - "The status of the interaction." - interaction_status_id: UUID! - @rules(apply: ["required", "exists:interaction_statuses,id"]) - - "The outcome of the interaction." - interaction_outcome_id: UUID! - @rules(apply: ["required", "exists:interaction_outcomes,id"]) - - "The division of the interaction." - division_id: UUID! @rules(apply: ["required", "exists:divisions,id"]) - - "The start datetime of the interaction." - start_datetime: DateTime! - @rules(apply: ["required", "date_format:Y-m-d H:i:s"]) - - "The end datetime of the interaction." - end_datetime: DateTime - @rules(apply: ["nullable", "date_format:Y-m-d H:i:s"]) + "The subject of the interaction." + subject: String! @rules(apply: ["required", "string", "max:255"]) + + "The description of the interaction." + description: String! @rules(apply: ["required", "string"]) + + "The User related to the interaction." + user_id: UUID! @rules(apply: ["required", "exists:users,id"]) + + "The Interactable related to the interaction." + interactable_id: InteractableId! + @rules( + apply: [ + "required" + "AdvisingApp\\Interaction\\Rules\\InteractableIdExistsRule" + ] + ) + + "The type of Interactable related to the interaction." + interactable_type: InteractableType! + @rules(apply: ["required", "in:contact,service_request"]) + + "The type of interaction." + interaction_type_id: UUID! + @rules(apply: ["required", "exists:interaction_types,id"]) + + "The relation of the interaction." + interaction_relation_id: UUID! + @rules(apply: ["required", "exists:interaction_relations,id"]) + + "The campaign of the interaction." + interaction_campaign_id: UUID! + @rules(apply: ["required", "exists:interaction_campaigns,id"]) + + "The driver of the interaction." + interaction_driver_id: UUID! + @rules(apply: ["required", "exists:interaction_drivers,id"]) + + "The status of the interaction." + interaction_status_id: UUID! + @rules(apply: ["required", "exists:interaction_statuses,id"]) + + "The outcome of the interaction." + interaction_outcome_id: UUID! + @rules(apply: ["required", "exists:interaction_outcomes,id"]) + + "The division of the interaction." + division_id: UUID! @rules(apply: ["required", "exists:divisions,id"]) + + "The start datetime of the interaction." + start_datetime: DateTime! + @rules(apply: ["required", "date_format:Y-m-d H:i:s"]) + + "The end datetime of the interaction." + end_datetime: DateTime @rules(apply: ["nullable", "date_format:Y-m-d H:i:s"]) } input UpdateInteractionInput { - "The subject of the interaction." - subject: String @rules(apply: ["string", "max:255"]) - - "The description of the interaction." - description: String @rules(apply: ["string"]) - - "The User related to the interaction." - user_id: UUID @rules(apply: ["exists:users,id"]) - - "The Interactable related to the interaction." - interactable_id: InteractableId - @rules( - apply: [ - "AdvisingApp\\Interaction\\Rules\\InteractableIdExistsRule" - "required_with:interactable_type" - ] - ) - - "The type of Interactable related to the interaction." - interactable_type: InteractableType - @rules( - apply: [ - "in:student,contact,service_request" - "required_with:interactable_id" - ] - ) - - "The type of interaction." - interaction_type_id: UUID @rules(apply: ["exists:interaction_types,id"]) - - "The relation of the interaction." - interaction_relation_id: UUID - @rules(apply: ["exists:interaction_relations,id"]) - - "The campaign of the interaction." - interaction_campaign_id: UUID - @rules(apply: ["exists:interaction_campaigns,id"]) - - "The driver of the interaction." - interaction_driver_id: UUID @rules(apply: ["exists:interaction_drivers,id"]) - - "The status of the interaction." - interaction_status_id: UUID - @rules(apply: ["exists:interaction_statuses,id"]) - - "The outcome of the interaction." - interaction_outcome_id: UUID - @rules(apply: ["exists:interaction_outcomes,id"]) - - "The division of the interaction." - division_id: UUID @rules(apply: ["exists:divisions,id"]) - - "The start datetime of the interaction." - start_datetime: DateTime @rules(apply: ["date_format:Y-m-d H:i:s"]) - - "The end datetime of the interaction." - end_datetime: DateTime - @rules(apply: ["nullable", "date_format:Y-m-d H:i:s"]) + "The subject of the interaction." + subject: String @rules(apply: ["string", "max:255"]) + + "The description of the interaction." + description: String @rules(apply: ["string"]) + + "The User related to the interaction." + user_id: UUID @rules(apply: ["exists:users,id"]) + + "The Interactable related to the interaction." + interactable_id: InteractableId + @rules( + apply: [ + "AdvisingApp\\Interaction\\Rules\\InteractableIdExistsRule" + "required_with:interactable_type" + ] + ) + + "The type of Interactable related to the interaction." + interactable_type: InteractableType + @rules( + apply: ["in:contact,service_request", "required_with:interactable_id"] + ) + + "The type of interaction." + interaction_type_id: UUID @rules(apply: ["exists:interaction_types,id"]) + + "The relation of the interaction." + interaction_relation_id: UUID + @rules(apply: ["exists:interaction_relations,id"]) + + "The campaign of the interaction." + interaction_campaign_id: UUID + @rules(apply: ["exists:interaction_campaigns,id"]) + + "The driver of the interaction." + interaction_driver_id: UUID @rules(apply: ["exists:interaction_drivers,id"]) + + "The status of the interaction." + interaction_status_id: UUID @rules(apply: ["exists:interaction_statuses,id"]) + + "The outcome of the interaction." + interaction_outcome_id: UUID @rules(apply: ["exists:interaction_outcomes,id"]) + + "The division of the interaction." + division_id: UUID @rules(apply: ["exists:divisions,id"]) + + "The start datetime of the interaction." + start_datetime: DateTime @rules(apply: ["date_format:Y-m-d H:i:s"]) + + "The end datetime of the interaction." + end_datetime: DateTime @rules(apply: ["nullable", "date_format:Y-m-d H:i:s"]) } type InteractionMutations { - "Create an interaction." - create(input: CreateInteractionInput! @spread): Interaction! - @create - @canModel(ability: "create") - - "Update an interaction." - update( - "The identifier of the interaction you would like to update." - id: UUID! - @whereKey - @rules(apply: ["required", "uuid", "exists:interactions"]) - - "The fields you would like to update." - input: UpdateInteractionInput! @spread - ): Interaction! @canFind(ability: "update", find: "id") @update - - "Delete an interaction." - delete( - "The identifier of the interaction you would like to delete." - id: UUID! - @whereKey - @rules(apply: ["required", "uuid", "exists:interactions"]) - ): Interaction @canFind(ability: "delete", find: "id") @delete + "Create an interaction." + create(input: CreateInteractionInput! @spread): Interaction! + @create + @canModel(ability: "create") + + "Update an interaction." + update( + "The identifier of the interaction you would like to update." + id: UUID! + @whereKey + @rules(apply: ["required", "uuid", "exists:interactions"]) + + "The fields you would like to update." + input: UpdateInteractionInput! @spread + ): Interaction! @canFind(ability: "update", find: "id") @update + + "Delete an interaction." + delete( + "The identifier of the interaction you would like to delete." + id: UUID! + @whereKey + @rules(apply: ["required", "uuid", "exists:interactions"]) + ): Interaction @canFind(ability: "delete", find: "id") @delete } extend type Mutation { - interaction: InteractionMutations! @namespaced + interaction: InteractionMutations! @namespaced } #import ./interaction-campaign.graphql diff --git a/app-modules/notification/graphql/subscription.graphql b/app-modules/notification/graphql/subscription.graphql index 393408ceb..a193f18c7 100644 --- a/app-modules/notification/graphql/subscription.graphql +++ b/app-modules/notification/graphql/subscription.graphql @@ -1,91 +1,89 @@ type UserSubscription - @model(class: "AdvisingApp\\Notification\\Models\\Subscription") { - "Unique primary key." - id: UUID! - "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 + @model(class: "AdvisingApp\\Notification\\Models\\Subscription") { + "Unique primary key." + id: UUID! + "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 } input UserSubscriptionSubscribablesQuery { - student: StudentsQuery - contact: ContactsQuery + contact: ContactsQuery } input SubscriptionsQuery { - id: UUID - user: UsersQuery - subscribable: UserSubscriptionSubscribablesQuery @morphToRelation - subscribable_id: EducatableId - subscribable_type: EducatableType - created_at: DateTime - updated_at: DateTime + id: UUID + user: UsersQuery + subscribable: UserSubscriptionSubscribablesQuery @morphToRelation + subscribable_id: EducatableId + subscribable_type: EducatableType + created_at: DateTime + updated_at: DateTime } type UserSubscriptionQueries { - "Find a single subscription by an identifying attribute." - find( - "The value of the attribute to match." - id: UUID! - @whereKey - @rules(apply: ["required", "uuid", "exists:subscriptions"]) - ): UserSubscription @find @canResolved(ability: "view") + "Find a single subscription by an identifying attribute." + find( + "The value of the attribute to match." + id: UUID! + @whereKey + @rules(apply: ["required", "uuid", "exists:subscriptions"]) + ): UserSubscription @find @canResolved(ability: "view") - "List multiple subscriptions." - list(where: SubscriptionsQuery @searchBy): [UserSubscription!]! - @paginate - @canModel(ability: "viewAny") + "List multiple subscriptions." + list(where: SubscriptionsQuery @searchBy): [UserSubscription!]! + @paginate + @canModel(ability: "viewAny") } extend type Query { - subscription: UserSubscriptionQueries! @namespaced + subscription: UserSubscriptionQueries! @namespaced } input CreateUserSubscriptionInput { - "The user to subscribe." - user_id: UUID! - @rules( - apply: [ - "required" - "exists:users,id" - "AdvisingApp\\Notification\\Rules\\UniqueSubscriptionRule" - ] - ) + "The user to subscribe." + user_id: UUID! + @rules( + apply: [ + "required" + "exists:users,id" + "AdvisingApp\\Notification\\Rules\\UniqueSubscriptionRule" + ] + ) - "The subscribable to subscribe to." - subscribable_id: EducatableId! - @rules( - apply: [ - "required" - "AdvisingApp\\Notification\\Rules\\SubscribableIdExistsRule" - ] - ) + "The subscribable to subscribe to." + subscribable_id: EducatableId! + @rules( + apply: [ + "required" + "AdvisingApp\\Notification\\Rules\\SubscribableIdExistsRule" + ] + ) - "The type of subscribable to subscribe to." - subscribable_type: EducatableType! - @rules(apply: ["required", "in:student,contact"]) + "The type of subscribable to subscribe to." + subscribable_type: EducatableType! @rules(apply: ["required", "in:contact"]) } type UserSubscriptionMutations { - "Subscribe a User to a Subscribable." - subscribe(input: CreateUserSubscriptionInput! @spread): UserSubscription! - @create - @canModel(ability: "create") + "Subscribe a User to a Subscribable." + subscribe(input: CreateUserSubscriptionInput! @spread): UserSubscription! + @create + @canModel(ability: "create") - "Unsubscribe a User from a Subscribable." - unsubscribe( - "The primary key of the subscription." - id: UUID! - @whereKey - @rules(apply: ["required", "uuid", "exists:subscriptions"]) - ): UserSubscription @delete @canFind(ability: "delete", find: "id") + "Unsubscribe a User from a Subscribable." + unsubscribe( + "The primary key of the subscription." + id: UUID! + @whereKey + @rules(apply: ["required", "uuid", "exists:subscriptions"]) + ): UserSubscription @delete @canFind(ability: "delete", find: "id") } extend type Mutation { - subscription: UserSubscriptionMutations! @namespaced + subscription: UserSubscriptionMutations! @namespaced } diff --git a/app-modules/notification/src/Rules/SubscribableIdExistsRule.php b/app-modules/notification/src/Rules/SubscribableIdExistsRule.php index b2b5a4f58..00895c98e 100644 --- a/app-modules/notification/src/Rules/SubscribableIdExistsRule.php +++ b/app-modules/notification/src/Rules/SubscribableIdExistsRule.php @@ -54,7 +54,7 @@ public function validate(string $attribute, mixed $value, Closure $fail): void $morph = Relation::getMorphedModel($type); if (! $morph) { - $fail('The subscribable type must be student or contact.'); + $fail('The subscribable type must be contact.'); } elseif ($morph::query()->whereKey($value)->doesntExist()) { $fail('The subscribable does not exist.'); } diff --git a/app-modules/survey/src/Filament/Resources/SurveyResource/Pages/Concerns/HasSharedFormConfiguration.php b/app-modules/survey/src/Filament/Resources/SurveyResource/Pages/Concerns/HasSharedFormConfiguration.php index 1134a85c6..eebea4140 100644 --- a/app-modules/survey/src/Filament/Resources/SurveyResource/Pages/Concerns/HasSharedFormConfiguration.php +++ b/app-modules/survey/src/Filament/Resources/SurveyResource/Pages/Concerns/HasSharedFormConfiguration.php @@ -94,7 +94,7 @@ public function fields(): array ->columnSpanFull(), Toggle::make('is_authenticated') ->label('Requires authentication') - ->helperText('If enabled, only students and contacts can submit this survey, and they must verify their email address first.'), + ->helperText('If enabled, only contacts can submit this survey, and they must verify their email address first.'), Toggle::make('is_wizard') ->label('Multi-step survey') ->live() diff --git a/app-modules/task/database/seeders/TaskSeeder.php b/app-modules/task/database/seeders/TaskSeeder.php index d1e9229df..47ee3adda 100644 --- a/app-modules/task/database/seeders/TaskSeeder.php +++ b/app-modules/task/database/seeders/TaskSeeder.php @@ -44,14 +44,6 @@ class TaskSeeder extends Seeder { public function run(): void { - // Past due, Student Concerned - Task::factory() - ->count(3) - ->assigned(User::first()) - ->concerningStudent() - ->pastDue() - ->create(); - // Past due, Contact Concerned Task::factory() ->count(3) @@ -60,14 +52,6 @@ public function run(): void ->pastDue() ->create(); - // Due Later, Student Concerned - Task::factory() - ->count(3) - ->assigned(User::first()) - ->concerningStudent() - ->dueLater() - ->create(); - // Due Later, Contact Concerned Task::factory() ->count(3) @@ -79,13 +63,13 @@ public function run(): void // Unassigned Task::factory() ->count(3) - ->concerningStudent() + ->concerningContact() ->create(); // Unassigned, Past Due Task::factory() ->count(3) - ->concerningStudent() + ->concerningContact() ->pastDue() ->create(); @@ -93,7 +77,7 @@ public function run(): void Task::factory() ->count(10) ->assigned() - ->concerningStudent() + ->concerningContact() ->create(); } }