Skip to content

Commit

Permalink
comments as event subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Sep 16, 2024
1 parent 91e451b commit 7890b95
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 33 deletions.
3 changes: 2 additions & 1 deletion client/src/app/generated/civic.apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export type CoiFieldPolicy = {
expiresAt?: FieldPolicy<any> | FieldReadFunction<any>,
id?: FieldPolicy<any> | FieldReadFunction<any>
};
export type CommentKeySpecifier = ('comment' | 'commentable' | 'commenter' | 'createdAt' | 'creationEvent' | 'deleted' | 'deletedAt' | 'id' | 'link' | 'name' | 'parsedComment' | 'title' | CommentKeySpecifier)[];
export type CommentKeySpecifier = ('comment' | 'commentable' | 'commenter' | 'createdAt' | 'creationEvent' | 'deleted' | 'deletedAt' | 'events' | 'id' | 'link' | 'name' | 'parsedComment' | 'title' | CommentKeySpecifier)[];
export type CommentFieldPolicy = {
comment?: FieldPolicy<any> | FieldReadFunction<any>,
commentable?: FieldPolicy<any> | FieldReadFunction<any>,
Expand All @@ -553,6 +553,7 @@ export type CommentFieldPolicy = {
creationEvent?: FieldPolicy<any> | FieldReadFunction<any>,
deleted?: FieldPolicy<any> | FieldReadFunction<any>,
deletedAt?: FieldPolicy<any> | FieldReadFunction<any>,
events?: FieldPolicy<any> | FieldReadFunction<any>,
id?: FieldPolicy<any> | FieldReadFunction<any>,
link?: FieldPolicy<any> | FieldReadFunction<any>,
name?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down
77 changes: 46 additions & 31 deletions client/src/app/generated/civic.apollo.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/src/app/generated/civic.possible-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
],
"EventSubject": [
"Assertion",
"Comment",
"EvidenceItem",
"ExonCoordinate",
"Factor",
Expand Down
36 changes: 35 additions & 1 deletion client/src/app/generated/server.model.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ type ActivityInterfaceEdge {

enum ActivitySubjectInput {
ASSERTION
COMMENT
EVIDENCE_ITEM
FEATURE
FLAG
Expand Down Expand Up @@ -1835,14 +1836,47 @@ enum CoiStatus {
VALID
}

type Comment implements EventOriginObject {
type Comment implements EventOriginObject & EventSubject {
comment: String!
commentable: Commentable!
commenter: User!
createdAt: ISO8601DateTime!
creationEvent: Event
deleted: Boolean!
deletedAt: ISO8601DateTime

"""
List and filter events for an object
"""
events(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String

"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
eventType: EventAction

"""
Returns the first _n_ elements from the list.
"""
first: Int

"""
Returns the last _n_ elements from the list.
"""
last: Int
organizationId: Int
originatingUserId: Int

"""
Sort order for the events. Defaults to most recent.
"""
sortBy: DateSort
): EventConnection!
id: Int!
link: String!
name: String!
Expand Down
129 changes: 129 additions & 0 deletions client/src/app/generated/server.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,12 @@
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "COMMENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
Expand Down Expand Up @@ -9309,6 +9315,119 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "events",
"description": "List and filter events for an object",
"args": [
{
"name": "eventType",
"description": null,
"type": {
"kind": "ENUM",
"name": "EventAction",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "originatingUserId",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "organizationId",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "sortBy",
"description": "Sort order for the events. Defaults to most recent.",
"type": {
"kind": "INPUT_OBJECT",
"name": "DateSort",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "EventConnection",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": null,
Expand Down Expand Up @@ -9400,6 +9519,11 @@
"kind": "INTERFACE",
"name": "EventOriginObject",
"ofType": null
},
{
"kind": "INTERFACE",
"name": "EventSubject",
"ofType": null
}
],
"enumValues": null,
Expand Down Expand Up @@ -15250,6 +15374,11 @@
"name": "Assertion",
"ofType": null
},
{
"kind": "OBJECT",
"name": "Comment",
"ofType": null
},
{
"kind": "OBJECT",
"name": "EvidenceItem",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class ActivitySubjectInputType < Types::BaseEnum
value 'MOLECULAR_PROFILE', value: 'MolecularProfile'
value 'FLAG', value: 'Flag'
value 'REVISION_SET', value: 'RevisionSet'
value 'COMMENT', value: 'Comment'
end
end
1 change: 1 addition & 0 deletions server/app/graphql/types/entities/comment_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class CommentType < Types::BaseObject
connection_type_class Types::Connections::CommentsConnection

implements Types::Interfaces::EventOriginObject
implements Types::Interfaces::EventSubject

field :id, Int, null: false
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
Expand Down
2 changes: 2 additions & 0 deletions server/app/graphql/types/interfaces/event_subject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def resolve_type(object, context)
Types::Entities::FlagType
when RevisionSet
Types::Entities::RevisionSetType
when Comment
Types::Entities::CommentType
else
raise "Unexpected EventSubject type: #{object.class}"
end
Expand Down

0 comments on commit 7890b95

Please sign in to comment.