diff --git a/__fixtures__/notification.ts b/__fixtures__/notification.ts index 91a817dcd..3c37dd509 100644 --- a/__fixtures__/notification.ts +++ b/__fixtures__/notification.ts @@ -74,18 +74,6 @@ export const createEntityLinkNotificationEvent: Model<'CreateEntityLinkNotificat childId: coursePage.id, } -export const removeEntityLinkNotificationEvent: Model<'RemoveEntityLinkNotificationEvent'> = - { - __typename: NotificationEventType.RemoveEntityLink, - id: 55273, - instance: Instance.De, - date: '2014-03-01T20:45:56Z', - actorId: user.id, - objectId: coursePage.id, - parentId: course.id, - childId: coursePage.id, - } - export const createEntityRevisionNotificationEvent: Model<'CreateEntityRevisionNotificationEvent'> = { __typename: NotificationEventType.CreateEntityRevision, diff --git a/__tests__/schema/event-types.ts b/__tests__/schema/event-types.ts index 01f2d8573..878cb2ef9 100644 --- a/__tests__/schema/event-types.ts +++ b/__tests__/schema/event-types.ts @@ -13,7 +13,6 @@ import { createTaxonomyTermNotificationEvent, createThreadNotificationEvent, rejectRevisionNotificationEvent, - removeEntityLinkNotificationEvent, removeTaxonomyLinkNotificationEvent, setLicenseNotificationEvent, setTaxonomyParentNotificationEvent, @@ -46,7 +45,6 @@ describe('creates event successfully with right payload', () => { createTaxonomyTermNotificationEvent, createThreadNotificationEvent, rejectRevisionNotificationEvent, - removeEntityLinkNotificationEvent, removeTaxonomyLinkNotificationEvent, setLicenseNotificationEvent, setTaxonomyParentNotificationEvent, @@ -196,15 +194,6 @@ async function getLastEvent() { reason } - ... on RemoveEntityLinkNotificationEvent { - parent { - id - } - child { - id - } - } - ... on RemoveTaxonomyLinkNotificationEvent { parent { id diff --git a/packages/server/src/model/decoder.ts b/packages/server/src/model/decoder.ts index fad9b596f..39d95dd98 100644 --- a/packages/server/src/model/decoder.ts +++ b/packages/server/src/model/decoder.ts @@ -449,7 +449,6 @@ export enum NotificationEventType { CreateTaxonomyLink = 'CreateTaxonomyLinkNotificationEvent', CreateThread = 'CreateThreadNotificationEvent', RejectRevision = 'RejectRevisionNotificationEvent', - RemoveEntityLink = 'RemoveEntityLinkNotificationEvent', RemoveTaxonomyLink = 'RemoveTaxonomyLinkNotificationEvent', SetLicense = 'SetLicenseNotificationEvent', SetTaxonomyTerm = 'SetTaxonomyTermNotificationEvent', @@ -544,17 +543,6 @@ export const CreateEntityLinkNotificationEventDecoder = t.exact( ]), ) -export const RemoveEntityLinkNotificationEventDecoder = t.exact( - t.intersection([ - AbstractNotificationEventDecoder, - t.type({ - __typename: t.literal(NotificationEventType.RemoveEntityLink), - parentId: t.number, - childId: t.number, - }), - ]), -) - export const CreateEntityRevisionNotificationEventDecoder = t.exact( t.intersection([ AbstractNotificationEventDecoder, @@ -649,7 +637,6 @@ export const NotificationEventDecoder = t.union([ CreateTaxonomyLinkNotificationEventDecoder, CreateThreadNotificationEventDecoder, RejectRevisionNotificationEventDecoder, - RemoveEntityLinkNotificationEventDecoder, RemoveTaxonomyLinkNotificationEventDecoder, SetLicenseNotificationEventDecoder, SetTaxonomyTermNotificationEventDecoder, diff --git a/packages/server/src/model/types.ts b/packages/server/src/model/types.ts index be51ee0af..ff68aa15f 100644 --- a/packages/server/src/model/types.ts +++ b/packages/server/src/model/types.ts @@ -33,7 +33,6 @@ import { PageDecoder, PageRevisionDecoder, RejectRevisionNotificationEventDecoder, - RemoveEntityLinkNotificationEventDecoder, RemoveTaxonomyLinkNotificationEventDecoder, SetLicenseNotificationEventDecoder, SetTaxonomyParentNotificationEventDecoder, @@ -108,9 +107,6 @@ export interface Models { RejectRevisionNotificationEvent: t.TypeOf< typeof RejectRevisionNotificationEventDecoder > - RemoveEntityLinkNotificationEvent: t.TypeOf< - typeof RemoveEntityLinkNotificationEventDecoder - > SetLicenseNotificationEvent: t.TypeOf< typeof SetLicenseNotificationEventDecoder > diff --git a/packages/server/src/schema/event-types/resolvers.ts b/packages/server/src/schema/event-types/resolvers.ts index 35a9d40db..7f1fb50e2 100644 --- a/packages/server/src/schema/event-types/resolvers.ts +++ b/packages/server/src/schema/event-types/resolvers.ts @@ -187,18 +187,6 @@ export const resolvers: Resolvers = { }, }, - RemoveEntityLinkNotificationEvent: { - ...createNotificationEventResolvers(), - async parent(event, _args, context) { - const id = event.parentId - return UuidResolver.resolveWithDecoder(EntityDecoder, { id }, context) - }, - async child(event, _args, context) { - const id = event.childId - return UuidResolver.resolveWithDecoder(EntityDecoder, { id }, context) - }, - }, - CreateEntityLinkNotificationEvent: { ...createNotificationEventResolvers(), async parent(event, _args, context) { diff --git a/packages/server/src/schema/event-types/types.graphql b/packages/server/src/schema/event-types/types.graphql index 252c86d3b..e65a4a085 100644 --- a/packages/server/src/schema/event-types/types.graphql +++ b/packages/server/src/schema/event-types/types.graphql @@ -127,16 +127,6 @@ type CreateTaxonomyTermNotificationEvent implements AbstractNotificationEvent & taxonomyTerm: TaxonomyTerm! } -type RemoveEntityLinkNotificationEvent implements AbstractNotificationEvent & InstanceAware { - id: Int! - instance: Instance! - date: DateTime! - actor: User! - objectId: Int! - parent: AbstractEntity! - child: AbstractEntity! -} - type CreateEntityLinkNotificationEvent implements AbstractNotificationEvent & InstanceAware { id: Int! instance: Instance! diff --git a/packages/server/src/schema/events/event.ts b/packages/server/src/schema/events/event.ts index 3ed0d3621..698568f99 100644 --- a/packages/server/src/schema/events/event.ts +++ b/packages/server/src/schema/events/event.ts @@ -14,7 +14,6 @@ enum EventType { CreateEntity = 'entity/create', SetLicense = 'license/object/set', CreateEntityLink = 'entity/link/create', - RemoveEntityLink = 'entity/link/remove', CreateEntityRevision = 'entity/revision/add', CheckoutRevision = 'entity/revision/checkout', RejectRevision = 'entity/revision/reject', @@ -170,16 +169,10 @@ export function toGraphQLModel( __typename: NotificationEventType.SetLicense, repositoryId: event.objectId, } - } else if ( - event.type === EventType.CreateEntityLink || - event.type === EventType.RemoveEntityLink - ) { + } else if (event.type === EventType.CreateEntityLink) { return { ...base, - __typename: - event.type === EventType.CreateEntityLink - ? NotificationEventType.CreateEntityLink - : NotificationEventType.RemoveEntityLink, + __typename: NotificationEventType.CreateEntityLink, childId: event.objectId, parentId: event.uuidParameter, } @@ -279,16 +272,10 @@ function toDatabaseRepresentation( type: EventType.SetLicense, objectId: event.repositoryId, } - } else if ( - event.__typename === NotificationEventType.CreateEntityLink || - event.__typename === NotificationEventType.RemoveEntityLink - ) { + } else if (event.__typename === NotificationEventType.CreateEntityLink) { return { ...base, - type: - event.__typename === NotificationEventType.CreateEntityLink - ? EventType.CreateEntityLink - : EventType.RemoveEntityLink, + type: EventType.CreateEntityLink, objectId: event.childId, uuidParameter: event.parentId, } @@ -375,7 +362,6 @@ type GraphQLEventModels = | Model<'CreateEntityNotificationEvent'> | Model<'SetLicenseNotificationEvent'> | Model<'CreateEntityLinkNotificationEvent'> - | Model<'RemoveEntityLinkNotificationEvent'> | Model<'CreateEntityRevisionNotificationEvent'> | Model<'CheckoutRevisionNotificationEvent'> | Model<'RejectRevisionNotificationEvent'> @@ -393,7 +379,6 @@ type PayloadForNewEvent = | Omit, 'id' | 'date' | 'objectId'> | Omit, 'id' | 'date' | 'objectId'> | Omit, 'id' | 'date' | 'objectId'> - | Omit, 'id' | 'date' | 'objectId'> | Omit< Model<'CreateEntityRevisionNotificationEvent'>, 'id' | 'date' | 'objectId' @@ -448,10 +433,6 @@ const DatabaseEventRepresentations = { type: EventType.CreateEntityLink, parameters: t.type({ uuidParameter: t.number }), }), - RemoveEntityLink: getDatabaseRepresentationDecoder({ - type: EventType.RemoveEntityLink, - parameters: t.type({ uuidParameter: t.number }), - }), CreateEntityRevision: getDatabaseRepresentationDecoder({ type: EventType.CreateEntityRevision, parameters: t.type({ uuidParameter: t.number }), @@ -509,7 +490,6 @@ export const DatabaseEventRepresentation: t.Type = DatabaseEventRepresentations.CreateTaxonomyLink, DatabaseEventRepresentations.CreateThread, DatabaseEventRepresentations.RejectRevision, - DatabaseEventRepresentations.RemoveEntityLink, DatabaseEventRepresentations.RemoveTaxonomyLink, DatabaseEventRepresentations.RestoreThread, DatabaseEventRepresentations.RestoreUuid, diff --git a/packages/server/src/schema/uuid/taxonomy-term/resolvers.ts b/packages/server/src/schema/uuid/taxonomy-term/resolvers.ts index a3cff3f66..a65d6ede4 100644 --- a/packages/server/src/schema/uuid/taxonomy-term/resolvers.ts +++ b/packages/server/src/schema/uuid/taxonomy-term/resolvers.ts @@ -319,7 +319,7 @@ export const resolvers: Resolvers = { await createEvent( { - __typename: NotificationEventType.RemoveEntityLink, + __typename: NotificationEventType.RemoveTaxonomyLink, actorId: userId, instance: taxonomyTerm.instance, parentId: taxonomyTermId, diff --git a/packages/server/src/types.ts b/packages/server/src/types.ts index 19396a732..29578ebf6 100644 --- a/packages/server/src/types.ts +++ b/packages/server/src/types.ts @@ -78,7 +78,7 @@ export type AbstractNotificationEvent = { export type AbstractNotificationEventConnection = { __typename?: 'AbstractNotificationEventConnection'; - nodes: Array; + nodes: Array; pageInfo: PageInfo; }; @@ -960,7 +960,7 @@ export type Notification = { __typename?: 'Notification'; email: Scalars['Boolean']['output']; emailSent: Scalars['Boolean']['output']; - event?: Maybe; + event?: Maybe; id: Scalars['Int']['output']; unread: Scalars['Boolean']['output']; }; @@ -1183,17 +1183,6 @@ export type RejectRevisionNotificationEvent = AbstractNotificationEvent & Instan revision: AppletRevision | ArticleRevision | CoursePageRevision | CourseRevision | EventRevision | ExerciseGroupRevision | ExerciseRevision | PageRevision | VideoRevision; }; -export type RemoveEntityLinkNotificationEvent = AbstractNotificationEvent & InstanceAware & { - __typename?: 'RemoveEntityLinkNotificationEvent'; - actor: User; - child: Applet | Article | Course | CoursePage | Event | Exercise | ExerciseGroup | Video; - date: Scalars['DateTime']['output']; - id: Scalars['Int']['output']; - instance: Instance; - objectId: Scalars['Int']['output']; - parent: Applet | Article | Course | CoursePage | Event | Exercise | ExerciseGroup | Video; -}; - export type RemoveTaxonomyLinkNotificationEvent = AbstractNotificationEvent & InstanceAware & { __typename?: 'RemoveTaxonomyLinkNotificationEvent'; actor: User; @@ -1954,12 +1943,12 @@ export type ResolversInterfaceTypes<_RefType extends Record> = AbstractEntity: ( ModelOf ) | ( ModelOf
) | ( ModelOf ) | ( ModelOf ) | ( ModelOf ) | ( ModelOf ) | ( ModelOf ) | ( ModelOf