From 0cf49ccda79e7bf6c4fa36ff87a8f325e6ec0cae Mon Sep 17 00:00:00 2001 From: Steven Wade Date: Mon, 19 Feb 2024 13:03:30 -0800 Subject: [PATCH] feat: isArchived --> inAppSent --- MINT.postman_collection.json | 12 +++--- migrations/V148__Add_Notification_tables.sql | 2 +- pkg/graph/generated/generated.go | 38 +++++++++---------- .../schema/types/user_notification.graphql | 2 +- pkg/models/user_notification.go | 4 +- .../collection_get_by_user_id.sql | 2 +- .../SQL/user_notification/create.sql | 6 +-- .../user_notification/mark_as_read_by_id.sql | 2 +- .../mark_as_read_by_user_id.sql | 2 +- src/gql/gen/graphql.ts | 2 +- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/MINT.postman_collection.json b/MINT.postman_collection.json index fcb8661ba0..35afa73c27 100644 --- a/MINT.postman_collection.json +++ b/MINT.postman_collection.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "ee2ccc00-fbb9-4598-ac85-34095be5a1bd", + "_postman_id": "32329f70-986e-430d-8a0b-4509ca71dab1", "name": "MINT", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "20435042" + "_exporter_id": "20320964" }, "item": [ { @@ -2024,7 +2024,7 @@ ] }, { - "name": "Notifications", + "name": "Notfications", "item": [ { "name": "GetNotifications", @@ -2055,7 +2055,7 @@ "body": { "mode": "graphql", "graphql": { - "query": "query currentUser {\n currentUser {\n notifications {\n numUnreadNotifications\n notifications {\n __typename\n id\n isRead\n isArchived\n emailSent\n activity {\n activityType\n entityID\n actorID\n metaData {\n __typename\n ... on TaggedInPlanDiscussionActivityMeta{\n version\n type\n discussionID\n content\n }\n ... on TaggedInDiscussionReplyActivityMeta {\n version\n type\n discussionID\n replyID\n content\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n }\n }\n}\n", + "query": "query currentUser {\n currentUser {\n notifications {\n numUnreadNotifications\n notifications {\n __typename\n id\n isRead\n inAppSent\n emailSent\n activity {\n activityType\n entityID\n actorID\n metaData {\n __typename\n ... on TaggedInPlanDiscussionActivityMeta{\n version\n type\n discussionID\n content\n }\n ... on TaggedInDiscussionReplyActivityMeta {\n version\n type\n discussionID\n replyID\n content\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n }\n }\n}\n", "variables": "" } }, @@ -2200,7 +2200,7 @@ "body": { "mode": "graphql", "graphql": { - "query": "query currentUser {\n currentUser {\n launchDarkly {\n userKey\n }\n account {\n commonName\n email\n }\n notifications {\n numUnreadNotifications\n notifications {\n __typename\n id\n isRead\n isArchived\n emailSent\n activity {\n activityType\n entityID\n actorID\n metaData {\n __typename\n ... on TaggedInPlanDiscussionActivityMeta{\n version\n type\n discussionID\n content\n }\n ... on TaggedInDiscussionReplyActivityMeta {\n version\n type\n discussionID\n replyID\n content\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n }\n }\n}\n", + "query": "query currentUser {\n currentUser {\n launchDarkly {\n userKey\n }\n account {\n commonName\n email\n }\n notifications {\n numUnreadNotifications\n notifications {\n __typename\n id\n isRead\n inAppSent\n emailSent\n activity {\n activityType\n entityID\n actorID\n metaData {\n __typename\n ... on TaggedInPlanDiscussionActivityMeta{\n version\n type\n discussionID\n content\n }\n ... on TaggedInDiscussionReplyActivityMeta {\n version\n type\n discussionID\n replyID\n content\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n createdByUserAccount {\n commonName\n }\n }\n }\n }\n}\n", "variables": "{}" } }, @@ -2232,7 +2232,7 @@ "body": { "mode": "graphql", "graphql": { - "query": "mutation NotificationPreferencesUpdate {\nupdateUserNotificationPreferences( changes:{\n dailyDigestComplete: IN_APP_ONLY\n \n addedAsCollaborator: ALL\n\n taggedInDiscussion: ALL\n\n taggedInDiscussionReply: ALL\n\n newDiscussionReply: ALL\n\n modelPlanShared: ALL\n\n \n\n}) {\n\n # notificationPreferences {\n dailyDigestComplete\n\n addedAsCollaborator\n\n taggedInDiscussion\n\n taggedInDiscussionReply\n\n newDiscussionReply\n\n modelPlanShared\n\n \n }\n}\n", + "query": "mutation NotificationUpdate {\nupdateUserNotificationPreferences( changes:{\n dailyDigestComplete: IN_APP_ONLY\n \n addedAsCollaborator: ALL\n\n taggedInDiscussion: ALL\n\n taggedInDiscussionReply: ALL\n\n newDiscussionReply: ALL\n\n modelPlanShared: ALL\n\n \n\n}) {\n\n dailyDigestComplete\n\n addedAsCollaborator\n\n taggedInDiscussion\n\n taggedInDiscussionReply\n\n newDiscussionReply\n\n modelPlanShared\n\n \n }\n}\n", "variables": "" } }, diff --git a/migrations/V148__Add_Notification_tables.sql b/migrations/V148__Add_Notification_tables.sql index 730e4d2dde..a653fe850c 100644 --- a/migrations/V148__Add_Notification_tables.sql +++ b/migrations/V148__Add_Notification_tables.sql @@ -37,7 +37,7 @@ CREATE TABLE user_notification ( activity_id UUID NOT NULL REFERENCES activity(id), --foreign key to user table user_id UUID NOT NULL REFERENCES user_account(id), is_read BOOLEAN NOT NULL DEFAULT FALSE, - is_archived BOOLEAN NOT NULL DEFAULT FALSE, + in_app_sent BOOLEAN NOT NULL, email_sent BOOLEAN NOT NULL, --META DATA diff --git a/pkg/graph/generated/generated.go b/pkg/graph/generated/generated.go index fe1e5ff8b1..fc32f8e2b8 100644 --- a/pkg/graph/generated/generated.go +++ b/pkg/graph/generated/generated.go @@ -1053,7 +1053,7 @@ type ComplexityRoot struct { CreatedDts func(childComplexity int) int EmailSent func(childComplexity int) int ID func(childComplexity int) int - IsArchived func(childComplexity int) int + InAppSent func(childComplexity int) int IsRead func(childComplexity int) int ModifiedBy func(childComplexity int) int ModifiedByUserAccount func(childComplexity int) int @@ -7618,12 +7618,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.UserNotification.ID(childComplexity), true - case "UserNotification.isArchived": - if e.complexity.UserNotification.IsArchived == nil { + case "UserNotification.inAppSent": + if e.complexity.UserNotification.InAppSent == nil { break } - return e.complexity.UserNotification.IsArchived(childComplexity), true + return e.complexity.UserNotification.InAppSent(childComplexity), true case "UserNotification.isRead": if e.complexity.UserNotification.IsRead == nil { @@ -10662,7 +10662,7 @@ type UserNotification { # activityType: ActivityType #TODO EASI-3925 #Maybe add this on this level so the FE doesn't need to query it? //TODO EASI-3925 userID: UUID! #probably not needed, it should be only visible for the user isRead: Boolean! - isArchived: Boolean! + inAppSent: Boolean! emailSent: Boolean! activity: Activity! # should we nest this? content: UserNotificationContent! @@ -22989,8 +22989,8 @@ func (ec *executionContext) fieldContext_Mutation_markNotificationAsRead(ctx con return ec.fieldContext_UserNotification_userID(ctx, field) case "isRead": return ec.fieldContext_UserNotification_isRead(ctx, field) - case "isArchived": - return ec.fieldContext_UserNotification_isArchived(ctx, field) + case "inAppSent": + return ec.fieldContext_UserNotification_inAppSent(ctx, field) case "emailSent": return ec.fieldContext_UserNotification_emailSent(ctx, field) case "activity": @@ -23074,8 +23074,8 @@ func (ec *executionContext) fieldContext_Mutation_markAllNotificationsAsRead(ctx return ec.fieldContext_UserNotification_userID(ctx, field) case "isRead": return ec.fieldContext_UserNotification_isRead(ctx, field) - case "isArchived": - return ec.fieldContext_UserNotification_isArchived(ctx, field) + case "inAppSent": + return ec.fieldContext_UserNotification_inAppSent(ctx, field) case "emailSent": return ec.fieldContext_UserNotification_emailSent(ctx, field) case "activity": @@ -55684,8 +55684,8 @@ func (ec *executionContext) fieldContext_UserNotification_isRead(ctx context.Con return fc, nil } -func (ec *executionContext) _UserNotification_isArchived(ctx context.Context, field graphql.CollectedField, obj *models.UserNotification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UserNotification_isArchived(ctx, field) +func (ec *executionContext) _UserNotification_inAppSent(ctx context.Context, field graphql.CollectedField, obj *models.UserNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserNotification_inAppSent(ctx, field) if err != nil { return graphql.Null } @@ -55698,7 +55698,7 @@ func (ec *executionContext) _UserNotification_isArchived(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsArchived, nil + return obj.InAppSent, nil }) if err != nil { ec.Error(ctx, err) @@ -55715,7 +55715,7 @@ func (ec *executionContext) _UserNotification_isArchived(ctx context.Context, fi return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserNotification_isArchived(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserNotification_inAppSent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UserNotification", Field: field, @@ -56925,8 +56925,8 @@ func (ec *executionContext) fieldContext_UserNotifications_notifications(ctx con return ec.fieldContext_UserNotification_userID(ctx, field) case "isRead": return ec.fieldContext_UserNotification_isRead(ctx, field) - case "isArchived": - return ec.fieldContext_UserNotification_isArchived(ctx, field) + case "inAppSent": + return ec.fieldContext_UserNotification_inAppSent(ctx, field) case "emailSent": return ec.fieldContext_UserNotification_emailSent(ctx, field) case "activity": @@ -56999,8 +56999,8 @@ func (ec *executionContext) fieldContext_UserNotifications_unreadNotifications(c return ec.fieldContext_UserNotification_userID(ctx, field) case "isRead": return ec.fieldContext_UserNotification_isRead(ctx, field) - case "isArchived": - return ec.fieldContext_UserNotification_isArchived(ctx, field) + case "inAppSent": + return ec.fieldContext_UserNotification_inAppSent(ctx, field) case "emailSent": return ec.fieldContext_UserNotification_emailSent(ctx, field) case "activity": @@ -69326,8 +69326,8 @@ func (ec *executionContext) _UserNotification(ctx context.Context, sel ast.Selec if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "isArchived": - out.Values[i] = ec._UserNotification_isArchived(ctx, field, obj) + case "inAppSent": + out.Values[i] = ec._UserNotification_inAppSent(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } diff --git a/pkg/graph/schema/types/user_notification.graphql b/pkg/graph/schema/types/user_notification.graphql index 50d0eeb448..5941c4a7f1 100644 --- a/pkg/graph/schema/types/user_notification.graphql +++ b/pkg/graph/schema/types/user_notification.graphql @@ -11,7 +11,7 @@ type UserNotification { # activityType: ActivityType #TODO EASI-3925 #Maybe add this on this level so the FE doesn't need to query it? //TODO EASI-3925 userID: UUID! #probably not needed, it should be only visible for the user isRead: Boolean! - isArchived: Boolean! + inAppSent: Boolean! emailSent: Boolean! activity: Activity! # should we nest this? content: UserNotificationContent! diff --git a/pkg/models/user_notification.go b/pkg/models/user_notification.go index a6ad7bb921..06abc687ce 100644 --- a/pkg/models/user_notification.go +++ b/pkg/models/user_notification.go @@ -13,7 +13,7 @@ type UserNotification struct { // The if of the entity this notification is about ActivityID uuid.UUID `json:"activityID" db:"activity_id"` IsRead bool `json:"isRead" db:"is_read"` - IsArchived bool `json:"isArchived" db:"is_archived"` //TODO: EASI-3925 Switch to in_App_sent + InAppSent bool `json:"inAppSent" db:"in_app_sent"` //TODO: EASI-3925 Switch to in_App_sent EmailSent bool `json:"emailSent" db:"email_sent"` } @@ -30,7 +30,7 @@ func NewUserNotification( baseStruct: NewBaseStruct(userID), ActivityID: activityID, IsRead: !inAppNotification, // set to read if user doesn't want notifications - IsArchived: !inAppNotification, // set to archived if user doesn't want notifications + InAppSent: inAppNotification, // set to archived if user doesn't want notifications EmailSent: emailNotification, // set that an email should be sent for this } } diff --git a/pkg/sqlqueries/SQL/user_notification/collection_get_by_user_id.sql b/pkg/sqlqueries/SQL/user_notification/collection_get_by_user_id.sql index da6cf8e67d..861b48dd49 100644 --- a/pkg/sqlqueries/SQL/user_notification/collection_get_by_user_id.sql +++ b/pkg/sqlqueries/SQL/user_notification/collection_get_by_user_id.sql @@ -3,7 +3,7 @@ SELECT activity_id, user_id, is_read, - is_archived, + in_app_sent, email_sent, created_by, created_dts, diff --git a/pkg/sqlqueries/SQL/user_notification/create.sql b/pkg/sqlqueries/SQL/user_notification/create.sql index a08f99dc9a..25451a08d0 100644 --- a/pkg/sqlqueries/SQL/user_notification/create.sql +++ b/pkg/sqlqueries/SQL/user_notification/create.sql @@ -3,7 +3,7 @@ INSERT INTO public.user_notification( activity_id, user_id, is_read, - is_archived, + in_app_sent, email_sent, created_by ) @@ -12,7 +12,7 @@ VALUES ( :activity_id, :user_id, :is_read, - :is_archived, + :in_app_sent, :email_sent, :created_by ) @@ -21,7 +21,7 @@ id, activity_id, user_id, is_read, -is_archived, +in_app_sent, email_sent, created_by, created_dts, diff --git a/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_id.sql b/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_id.sql index e2d545265e..50ed40d53c 100644 --- a/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_id.sql +++ b/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_id.sql @@ -10,7 +10,7 @@ id, activity_id, user_id, is_read, -is_archived, +in_app_sent, email_sent, created_by, created_dts, diff --git a/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_user_id.sql b/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_user_id.sql index f9b6543074..b2a7d8580a 100644 --- a/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_user_id.sql +++ b/pkg/sqlqueries/SQL/user_notification/mark_as_read_by_user_id.sql @@ -10,7 +10,7 @@ id, activity_id, user_id, is_read, -is_archived, +in_app_sent, email_sent, created_by, created_dts, diff --git a/src/gql/gen/graphql.ts b/src/gql/gen/graphql.ts index 374b517796..3b4dbc3161 100644 --- a/src/gql/gen/graphql.ts +++ b/src/gql/gen/graphql.ts @@ -2766,7 +2766,7 @@ export type UserNotification = { createdDts: Scalars['Time']['output']; emailSent: Scalars['Boolean']['output']; id: Scalars['UUID']['output']; - isArchived: Scalars['Boolean']['output']; + inAppSent: Scalars['Boolean']['output']; isRead: Scalars['Boolean']['output']; modifiedBy?: Maybe; modifiedByUserAccount?: Maybe;