diff options
Diffstat (limited to 'api/graphql/schema')
-rw-r--r-- | api/graphql/schema/bug.graphql | 35 | ||||
-rw-r--r-- | api/graphql/schema/bug_comment.graphql | 26 | ||||
-rw-r--r-- | api/graphql/schema/bug_mutations.graphql (renamed from api/graphql/schema/mutations.graphql) | 94 | ||||
-rw-r--r-- | api/graphql/schema/bug_operations.graphql (renamed from api/graphql/schema/operations.graphql) | 58 | ||||
-rw-r--r-- | api/graphql/schema/bug_timeline.graphql | 93 | ||||
-rw-r--r-- | api/graphql/schema/directives.graphql | 18 | ||||
-rw-r--r-- | api/graphql/schema/identity.graphql | 2 | ||||
-rw-r--r-- | api/graphql/schema/label.graphql | 17 | ||||
-rw-r--r-- | api/graphql/schema/operation.graphql | 25 | ||||
-rw-r--r-- | api/graphql/schema/repository.graphql | 1 | ||||
-rw-r--r-- | api/graphql/schema/root.graphql | 21 | ||||
-rw-r--r-- | api/graphql/schema/status.graphql | 4 | ||||
-rw-r--r-- | api/graphql/schema/timeline.graphql | 86 |
13 files changed, 254 insertions, 226 deletions
diff --git a/api/graphql/schema/bug.graphql b/api/graphql/schema/bug.graphql index 17d3a897..f06f2f84 100644 --- a/api/graphql/schema/bug.graphql +++ b/api/graphql/schema/bug.graphql @@ -1,34 +1,3 @@ -"""Represents a comment on a bug.""" -type Comment implements Authored { - id: CombinedId! - - """The author of this comment.""" - author: Identity! - - """The message of this comment.""" - message: String! - - """All media's hash referenced in this comment""" - files: [Hash!]! -} - -type CommentConnection { - edges: [CommentEdge!]! - nodes: [Comment!]! - pageInfo: PageInfo! - totalCount: Int! -} - -type CommentEdge { - cursor: String! - node: Comment! -} - -enum Status { - OPEN - CLOSED -} - type Bug implements Authored { """The identifier for this bug""" id: ID! @@ -75,7 +44,7 @@ type Bug implements Authored { first: Int """Returns the last _n_ elements from the list.""" last: Int - ): CommentConnection! + ): BugCommentConnection! timeline( """Returns the elements in the list that come after the specified cursor.""" @@ -86,7 +55,7 @@ type Bug implements Authored { first: Int """Returns the last _n_ elements from the list.""" last: Int - ): TimelineItemConnection! + ): BugTimelineItemConnection! operations( """Returns the elements in the list that come after the specified cursor.""" diff --git a/api/graphql/schema/bug_comment.graphql b/api/graphql/schema/bug_comment.graphql new file mode 100644 index 00000000..916d31c8 --- /dev/null +++ b/api/graphql/schema/bug_comment.graphql @@ -0,0 +1,26 @@ +"""Represents a comment on a bug.""" +type BugComment implements Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.Comment") { + id: CombinedId! @goField(name: "CombinedId") + + """The author of this comment.""" + author: Identity! + + """The message of this comment.""" + message: String! + + """All media's hash referenced in this comment""" + files: [Hash!]! +} + +type BugCommentConnection { + edges: [BugCommentEdge!]! + nodes: [BugComment!]! + pageInfo: PageInfo! + totalCount: Int! +} + +type BugCommentEdge { + cursor: String! + node: BugComment! +} diff --git a/api/graphql/schema/mutations.graphql b/api/graphql/schema/bug_mutations.graphql index be6a0115..c67ad707 100644 --- a/api/graphql/schema/mutations.graphql +++ b/api/graphql/schema/bug_mutations.graphql @@ -1,4 +1,25 @@ -input NewBugInput { +extend type Mutation { + """Create a new bug""" + bugCreate(input: BugCreateInput!): BugCreatePayload! + """Add a new comment to a bug""" + bugAddComment(input: BugAddCommentInput!): BugAddCommentPayload! + """Add a new comment to a bug and close it""" + bugAddCommentAndClose(input: BugAddCommentAndCloseInput!): BugAddCommentAndClosePayload! + """Add a new comment to a bug and reopen it""" + bugAddCommentAndReopen(input: BugAddCommentAndReopenInput!): BugAddCommentAndReopenPayload! + """Change a comment of a bug""" + bugEditComment(input: BugEditCommentInput!): BugEditCommentPayload! + """Add or remove a set of label on a bug""" + bugChangeLabels(input: BugChangeLabelInput): BugChangeLabelPayload! + """Change a bug's status to open""" + bugStatusOpen(input: BugStatusOpenInput!): BugStatusOpenPayload! + """Change a bug's status to closed""" + bugStatusClose(input: BugStatusCloseInput!): BugStatusClosePayload! + """Change a bug's title""" + bugSetTitle(input: BugSetTitleInput!): BugSetTitlePayload! +} + +input BugCreateInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -11,16 +32,16 @@ input NewBugInput { files: [Hash!] } -type NewBugPayload { +type BugCreatePayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The created bug.""" bug: Bug! """The resulting operation.""" - operation: CreateOperation! + operation: BugCreateOperation! } -input AddCommentInput { +input BugAddCommentInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -33,16 +54,16 @@ input AddCommentInput { files: [Hash!] } -type AddCommentPayload { +type BugAddCommentPayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting operation.""" - operation: AddCommentOperation! + operation: BugAddCommentOperation! } -input AddCommentAndCloseBugInput { +input BugAddCommentAndCloseInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -55,18 +76,18 @@ input AddCommentAndCloseBugInput { files: [Hash!] } -type AddCommentAndCloseBugPayload { +type BugAddCommentAndClosePayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting AddComment operation.""" - commentOperation: AddCommentOperation! + commentOperation: BugAddCommentOperation! """The resulting SetStatusOperation.""" - statusOperation: SetStatusOperation! + statusOperation: BugSetStatusOperation! } -input AddCommentAndReopenBugInput { +input BugAddCommentAndReopenInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -79,18 +100,18 @@ input AddCommentAndReopenBugInput { files: [Hash!] } -type AddCommentAndReopenBugPayload { +type BugAddCommentAndReopenPayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting AddComment operation.""" - commentOperation: AddCommentOperation! + commentOperation: BugAddCommentOperation! """The resulting SetStatusOperation.""" - statusOperation: SetStatusOperation! + statusOperation: BugSetStatusOperation! } -input EditCommentInput { +input BugEditCommentInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -103,16 +124,16 @@ input EditCommentInput { files: [Hash!] } -type EditCommentPayload { +type BugEditCommentPayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting operation.""" - operation: EditCommentOperation! + operation: BugEditCommentOperation! } -input ChangeLabelInput { +input BugChangeLabelInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -125,33 +146,18 @@ input ChangeLabelInput { Removed: [String!] } -enum LabelChangeStatus { - ADDED - REMOVED - DUPLICATE_IN_OP - ALREADY_SET - DOESNT_EXIST -} - -type LabelChangeResult { - """The source label.""" - label: Label! - """The effect this label had.""" - status: LabelChangeStatus! -} - -type ChangeLabelPayload { +type BugChangeLabelPayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting operation.""" - operation: LabelChangeOperation! + operation: BugLabelChangeOperation! """The effect each source label had.""" results: [LabelChangeResult]! } -input OpenBugInput { +input BugStatusOpenInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -160,16 +166,16 @@ input OpenBugInput { prefix: String! } -type OpenBugPayload { +type BugStatusOpenPayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting operation.""" - operation: SetStatusOperation! + operation: BugSetStatusOperation! } -input CloseBugInput { +input BugStatusCloseInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -178,16 +184,16 @@ input CloseBugInput { prefix: String! } -type CloseBugPayload { +type BugStatusClosePayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting operation.""" - operation: SetStatusOperation! + operation: BugSetStatusOperation! } -input SetTitleInput { +input BugSetTitleInput { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The name of the repository. If not set, the default repository is used.""" @@ -198,11 +204,11 @@ input SetTitleInput { title: String! } -type SetTitlePayload { +type BugSetTitlePayload { """A unique identifier for the client performing the mutation.""" clientMutationId: String """The affected bug.""" bug: Bug! """The resulting operation""" - operation: SetTitleOperation! + operation: BugSetTitleOperation! } diff --git a/api/graphql/schema/operations.graphql b/api/graphql/schema/bug_operations.graphql index 8e198753..93228d2a 100644 --- a/api/graphql/schema/operations.graphql +++ b/api/graphql/schema/bug_operations.graphql @@ -1,99 +1,77 @@ -"""An operation applied to a bug.""" -interface Operation { - """The identifier of the operation""" - id: ID! - """The operations author.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! -} - -# Connection - -"""The connection type for an Operation""" -type OperationConnection { - edges: [OperationEdge!]! - nodes: [Operation!]! - pageInfo: PageInfo! - totalCount: Int! -} - -"""Represent an Operation""" -type OperationEdge { - cursor: String! - node: Operation! -} - -# Operations - -type CreateOperation implements Operation & Authored { +type BugCreateOperation implements Operation & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.CreateOperation") { """The identifier of the operation""" id: ID! """The author of this object.""" author: Identity! """The datetime when this operation was issued.""" - date: Time! + date: Time! @goField(name: "Time") title: String! message: String! files: [Hash!]! } -type SetTitleOperation implements Operation & Authored { +type BugSetTitleOperation implements Operation & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.SetTitleOperation") { """The identifier of the operation""" id: ID! """The author of this object.""" author: Identity! """The datetime when this operation was issued.""" - date: Time! + date: Time! @goField(name: "Time") title: String! was: String! } -type AddCommentOperation implements Operation & Authored { +type BugAddCommentOperation implements Operation & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.AddCommentOperation") { """The identifier of the operation""" id: ID! """The author of this object.""" author: Identity! """The datetime when this operation was issued.""" - date: Time! + date: Time! @goField(name: "Time") message: String! files: [Hash!]! } -type EditCommentOperation implements Operation & Authored { +type BugEditCommentOperation implements Operation & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.EditCommentOperation") { """The identifier of the operation""" id: ID! """The author of this object.""" author: Identity! """The datetime when this operation was issued.""" - date: Time! + date: Time! @goField(name: "Time") target: String! message: String! files: [Hash!]! } -type SetStatusOperation implements Operation & Authored { +type BugSetStatusOperation implements Operation & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.SetStatusOperation") { """The identifier of the operation""" id: ID! """The author of this object.""" author: Identity! """The datetime when this operation was issued.""" - date: Time! + date: Time! @goField(name: "Time") status: Status! } -type LabelChangeOperation implements Operation & Authored { +type BugLabelChangeOperation implements Operation & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.LabelChangeOperation") { """The identifier of the operation""" id: ID! """The author of this object.""" author: Identity! """The datetime when this operation was issued.""" - date: Time! + date: Time! @goField(name: "Time") added: [Label!]! removed: [Label!]! diff --git a/api/graphql/schema/bug_timeline.graphql b/api/graphql/schema/bug_timeline.graphql new file mode 100644 index 00000000..5fa09497 --- /dev/null +++ b/api/graphql/schema/bug_timeline.graphql @@ -0,0 +1,93 @@ +"""An item in the timeline of bug events""" +interface BugTimelineItem +@goModel(model: "github.com/git-bug/git-bug/entities/bug.TimelineItem") { + """The identifier of the source operation""" + id: CombinedId! +} + +"""CommentHistoryStep hold one version of a message in the history""" +type BugCommentHistoryStep +@goModel(model: "github.com/git-bug/git-bug/entities/bug.CommentHistoryStep") { + message: String! + date: Time! +} + +# Connection + +"""The connection type for TimelineItem""" +type BugTimelineItemConnection { + edges: [BugTimelineItemEdge!]! + nodes: [BugTimelineItem!]! + pageInfo: PageInfo! + totalCount: Int! +} + +"""Represent a TimelineItem""" +type BugTimelineItemEdge { + cursor: String! + node: BugTimelineItem! +} + +# Items + +"""BugCreateTimelineItem is a BugTimelineItem that represent the creation of a bug and its message edition history""" +type BugCreateTimelineItem implements BugTimelineItem & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.CreateTimelineItem") { + """The identifier of the source operation""" + id: CombinedId! @goField(name: "CombinedId") + author: Identity! + message: String! + messageIsEmpty: Boolean! + files: [Hash!]! + createdAt: Time! + lastEdit: Time! + edited: Boolean! + history: [BugCommentHistoryStep!]! +} + +"""BugAddCommentTimelineItem is a BugTimelineItem that represent a BugComment and its edition history""" +type BugAddCommentTimelineItem implements BugTimelineItem & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.AddCommentTimelineItem") { + """The identifier of the source operation""" + id: CombinedId! @goField(name: "CombinedId") + author: Identity! + message: String! + messageIsEmpty: Boolean! + files: [Hash!]! + createdAt: Time! + lastEdit: Time! + edited: Boolean! + history: [BugCommentHistoryStep!]! +} + +"""BugLabelChangeTimelineItem is a BugTimelineItem that represent a change in the labels of a bug""" +type BugLabelChangeTimelineItem implements BugTimelineItem & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.LabelChangeTimelineItem") { + """The identifier of the source operation""" + id: CombinedId! @goField(name: "CombinedId") + author: Identity! + date: Time! + added: [Label!]! + removed: [Label!]! +} + +"""BugSetStatusTimelineItem is a BugTimelineItem that represent a change in the status of a bug""" +type BugSetStatusTimelineItem implements BugTimelineItem & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.SetStatusTimelineItem") { + """The identifier of the source operation""" + id: CombinedId! @goField(name: "CombinedId") + author: Identity! + date: Time! + status: Status! +} + +"""BugLabelChangeTimelineItem is a BugTimelineItem that represent a change in the title of a bug""" +type BugSetTitleTimelineItem implements BugTimelineItem & Authored +@goModel(model: "github.com/git-bug/git-bug/entities/bug.SetTitleTimelineItem") { + """The identifier of the source operation""" + id: CombinedId! @goField(name: "CombinedId") + author: Identity! + date: Time! + title: String! + was: String! +} diff --git a/api/graphql/schema/directives.graphql b/api/graphql/schema/directives.graphql new file mode 100644 index 00000000..79c881d6 --- /dev/null +++ b/api/graphql/schema/directives.graphql @@ -0,0 +1,18 @@ +# Below are directives defined by gqlgen, see https://gqlgen.com/config/ + +directive @goModel( + model: String + models: [String!] + forceGenerate: Boolean +) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION + +directive @goField( + forceResolver: Boolean + name: String + omittable: Boolean +) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION + +directive @goTag( + key: String! + value: String +) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION diff --git a/api/graphql/schema/identity.graphql b/api/graphql/schema/identity.graphql index c910ea55..502b0a4f 100644 --- a/api/graphql/schema/identity.graphql +++ b/api/graphql/schema/identity.graphql @@ -29,4 +29,4 @@ type IdentityConnection { type IdentityEdge { cursor: String! node: Identity! -}
\ No newline at end of file +} diff --git a/api/graphql/schema/label.graphql b/api/graphql/schema/label.graphql index 1205915c..cbaf28b7 100644 --- a/api/graphql/schema/label.graphql +++ b/api/graphql/schema/label.graphql @@ -16,4 +16,19 @@ type LabelConnection { type LabelEdge { cursor: String! node: Label! -}
\ No newline at end of file +} + +enum LabelChangeStatus { + ADDED + REMOVED + DUPLICATE_IN_OP + ALREADY_SET + DOESNT_EXIST +} + +type LabelChangeResult { + """The source label.""" + label: Label! + """The effect this label had.""" + status: LabelChangeStatus! +} diff --git a/api/graphql/schema/operation.graphql b/api/graphql/schema/operation.graphql new file mode 100644 index 00000000..ed952c06 --- /dev/null +++ b/api/graphql/schema/operation.graphql @@ -0,0 +1,25 @@ +"""An operation applied to an entity.""" +interface Operation { + """The identifier of the operation""" + id: ID! + """The operations author.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! @goField(name: "Time") +} + +# Connection + +"""The connection type for an Operation""" +type OperationConnection { + edges: [OperationEdge!]! + nodes: [Operation!]! + pageInfo: PageInfo! + totalCount: Int! +} + +"""Represent an Operation""" +type OperationEdge { + cursor: String! + node: Operation! +} diff --git a/api/graphql/schema/repository.graphql b/api/graphql/schema/repository.graphql index d7411be7..ccd409f5 100644 --- a/api/graphql/schema/repository.graphql +++ b/api/graphql/schema/repository.graphql @@ -1,4 +1,3 @@ - type Repository { """The name of the repository""" name: String diff --git a/api/graphql/schema/root.graphql b/api/graphql/schema/root.graphql index e3c76c03..721698b0 100644 --- a/api/graphql/schema/root.graphql +++ b/api/graphql/schema/root.graphql @@ -3,23 +3,4 @@ type Query { repository(ref: String): Repository } -type Mutation { - """Create a new bug""" - newBug(input: NewBugInput!): NewBugPayload! - """Add a new comment to a bug""" - addComment(input: AddCommentInput!): AddCommentPayload! - """Add a new comment to a bug and close it""" - addCommentAndClose(input: AddCommentAndCloseBugInput!): AddCommentAndCloseBugPayload! - """Add a new comment to a bug and reopen it""" - addCommentAndReopen(input: AddCommentAndReopenBugInput!): AddCommentAndReopenBugPayload! - """Change a comment of a bug""" - editComment(input: EditCommentInput!): EditCommentPayload! - """Add or remove a set of label on a bug""" - changeLabels(input: ChangeLabelInput): ChangeLabelPayload! - """Change a bug's status to open""" - openBug(input: OpenBugInput!): OpenBugPayload! - """Change a bug's status to closed""" - closeBug(input: CloseBugInput!): CloseBugPayload! - """Change a bug's title""" - setTitle(input: SetTitleInput!): SetTitlePayload! -} +type Mutation # See each entity mutations diff --git a/api/graphql/schema/status.graphql b/api/graphql/schema/status.graphql new file mode 100644 index 00000000..2b07f1ec --- /dev/null +++ b/api/graphql/schema/status.graphql @@ -0,0 +1,4 @@ +enum Status { + OPEN + CLOSED +} diff --git a/api/graphql/schema/timeline.graphql b/api/graphql/schema/timeline.graphql deleted file mode 100644 index b7ab5ca8..00000000 --- a/api/graphql/schema/timeline.graphql +++ /dev/null @@ -1,86 +0,0 @@ -"""An item in the timeline of events""" -interface TimelineItem { - """The identifier of the source operation""" - id: CombinedId! -} - -"""CommentHistoryStep hold one version of a message in the history""" -type CommentHistoryStep { - message: String! - date: Time! -} - -# Connection - -"""The connection type for TimelineItem""" -type TimelineItemConnection { - edges: [TimelineItemEdge!]! - nodes: [TimelineItem!]! - pageInfo: PageInfo! - totalCount: Int! -} - -"""Represent a TimelineItem""" -type TimelineItemEdge { - cursor: String! - node: TimelineItem! -} - -# Items - -"""CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history""" -type CreateTimelineItem implements TimelineItem & Authored { - """The identifier of the source operation""" - id: CombinedId! - author: Identity! - message: String! - messageIsEmpty: Boolean! - files: [Hash!]! - createdAt: Time! - lastEdit: Time! - edited: Boolean! - history: [CommentHistoryStep!]! -} - -"""AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history""" -type AddCommentTimelineItem implements TimelineItem & Authored { - """The identifier of the source operation""" - id: CombinedId! - author: Identity! - message: String! - messageIsEmpty: Boolean! - files: [Hash!]! - createdAt: Time! - lastEdit: Time! - edited: Boolean! - history: [CommentHistoryStep!]! -} - -"""LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug""" -type LabelChangeTimelineItem implements TimelineItem & Authored { - """The identifier of the source operation""" - id: CombinedId! - author: Identity! - date: Time! - added: [Label!]! - removed: [Label!]! -} - -"""SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug""" -type SetStatusTimelineItem implements TimelineItem & Authored { - """The identifier of the source operation""" - id: CombinedId! - author: Identity! - date: Time! - status: Status! -} - -"""LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug""" -type SetTitleTimelineItem implements TimelineItem & Authored { - """The identifier of the source operation""" - id: CombinedId! - author: Identity! - date: Time! - title: String! - was: String! -} |