Add createdAt timestamp tracking to GitHub (#1152)

Updates github schema to include createdAt timestamps, and then updates
the RelationalView to provide those timestamps as MsSinceEpoch.

I added createdAt timestamps to Repos, Issues, Pulls, Reviews, and
Comments, as these correspond to GitHub graph nodes where I think
time-based filtering is relevant. I didn't add them to Users, Reactions,
or Commits. Reactions, because they correspond to edges not nodes. (We
could consider doing the time filtering on edges too, but I'd rather
keep it simple for now.) Commits, because they're owned by a different
plugin. Users, because... in a certain sense the user identity is
timeless, the time factoring is mostly so we can evaluate how users'
cred varies over time.

Anyway, it will be easy to add more fields later if we need them.

Test plan:
- Inspect snapshot changes
- Ran `yarn test --full`
  - Its only failure is pre-existing, per #1151

Thanks to @s-ben for some motivation and discussion about this change.
This commit is contained in:
Dandelion Mané 2019-05-21 06:16:16 +03:00 committed by GitHub
parent a831e05e5f
commit d51c0b6715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 98 additions and 0 deletions

View File

@ -10,6 +10,8 @@ Array [
exports[`plugins/github/relationalView Comment has body 1`] = `"seems a bit capricious"`;
exports[`plugins/github/relationalView Comment has createdAt 1`] = `1519878210000`;
exports[`plugins/github/relationalView Comment has parent 1`] = `
Object {
"url": "https://github.com/sourcecred/example-github/pull/5#pullrequestreview-100313899",
@ -160,6 +162,8 @@ Array [
exports[`plugins/github/relationalView Issue has body 1`] = `"This issue references another issue, namely #1"`;
exports[`plugins/github/relationalView Issue has createdAt 1`] = `1519807129000`;
exports[`plugins/github/relationalView Issue has number 1`] = `"2"`;
exports[`plugins/github/relationalView Issue has parent 1`] = `
@ -200,6 +204,8 @@ exports[`plugins/github/relationalView Pull has body 1`] = `
- then approve the pr"
`;
exports[`plugins/github/relationalView Pull has createdAt 1`] = `1519807636000`;
exports[`plugins/github/relationalView Pull has deletions 1`] = `0`;
exports[`plugins/github/relationalView Pull has mergedAs 1`] = `
@ -325,6 +331,8 @@ Array [
]
`;
exports[`plugins/github/relationalView Repo has createdAt 1`] = `1519807034000`;
exports[`plugins/github/relationalView Repo has name 1`] = `"example-github"`;
exports[`plugins/github/relationalView Repo has owner 1`] = `"sourcecred"`;
@ -376,6 +384,8 @@ Array [
exports[`plugins/github/relationalView Review has body 1`] = `"hmmm.jpg"`;
exports[`plugins/github/relationalView Review has createdAt 1`] = `1519878210000`;
exports[`plugins/github/relationalView Review has parent 1`] = `
Object {
"url": "https://github.com/sourcecred/example-github/pull/5",

View File

@ -1,5 +1,6 @@
{
"__typename": "Repository",
"createdAt": "2018-02-28T08:37:14Z",
"defaultBranchRef": {
"__typename": "Ref",
"id": "MDM6UmVmMTIzMjU1MDA2Om1hc3Rlcg==",
@ -138,6 +139,7 @@
"body": "This is just an example issue.",
"comments": [
],
"createdAt": "2018-02-28T08:38:08Z",
"id": "MDU6SXNzdWUzMDA5MzQ4MTg=",
"number": 1,
"reactions": [
@ -186,6 +188,7 @@
"url": "https://github.com/decentralion"
},
"body": "It should also be possible to reference by exact url: https://github.com/sourcecred/example-github/issues/6",
"createdAt": "2018-03-16T16:28:13Z",
"id": "MDEyOklzc3VlQ29tbWVudDM3Mzc2ODcwMw==",
"reactions": [
],
@ -200,6 +203,7 @@
"url": "https://github.com/decentralion"
},
"body": "We might also reference individual comments directly.\r\nhttps://github.com/sourcecred/example-github/issues/6#issuecomment-373768538",
"createdAt": "2018-03-16T16:28:45Z",
"id": "MDEyOklzc3VlQ29tbWVudDM3Mzc2ODg1MA==",
"reactions": [
],
@ -214,6 +218,7 @@
"url": "https://github.com/decentralion"
},
"body": "Here's a PR by direct url: https://github.com/sourcecred/example-github/pull/5",
"createdAt": "2018-05-01T01:25:09Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTU3NjE4NQ==",
"reactions": [
],
@ -228,6 +233,7 @@
"url": "https://github.com/decentralion"
},
"body": "a PR review by url: https://github.com/sourcecred/example-github/pull/5#pullrequestreview-100313899",
"createdAt": "2018-05-01T01:25:25Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTU3NjIyMA==",
"reactions": [
],
@ -242,6 +248,7 @@
"url": "https://github.com/decentralion"
},
"body": "a PR Review Comment by url: https://github.com/sourcecred/example-github/pull/5#discussion_r171460198",
"createdAt": "2018-05-01T01:25:39Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTU3NjI0OA==",
"reactions": [
],
@ -256,6 +263,7 @@
"url": "https://github.com/decentralion"
},
"body": "a user by url: https://github.com/wchargin",
"createdAt": "2018-05-01T01:25:51Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTU3NjI3Mw==",
"reactions": [
],
@ -270,6 +278,7 @@
"url": "https://github.com/decentralion"
},
"body": "Here are several references:\r\n#1 \r\n#2\r\n#3 \r\n\r\nhttps://github.com/sourcecred/example-github/pull/5#discussion_r171460198\r\nhttps://github.com/sourcecred/example-github/pull/5#pullrequestreview-100313899\r\n",
"createdAt": "2018-05-01T01:30:31Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTU3NjkyMA==",
"reactions": [
],
@ -284,12 +293,14 @@
"url": "https://github.com/decentralion"
},
"body": "This comment has no references.",
"createdAt": "2018-05-01T01:30:38Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTU3NjkzNg==",
"reactions": [
],
"url": "https://github.com/sourcecred/example-github/issues/2#issuecomment-385576936"
}
],
"createdAt": "2018-02-28T08:38:49Z",
"id": "MDU6SXNzdWUzMDA5MzQ5ODA=",
"number": 2,
"reactions": [
@ -308,6 +319,7 @@
"body": "Alas, its life as an open issue had only just begun.",
"comments": [
],
"createdAt": "2018-02-28T08:44:14Z",
"id": "MDU6SXNzdWUzMDA5MzYzNzQ=",
"number": 4,
"reactions": [
@ -334,6 +346,7 @@
"url": "https://github.com/decentralion"
},
"body": "A wild COMMENT appeared!",
"createdAt": "2018-03-16T16:27:22Z",
"id": "MDEyOklzc3VlQ29tbWVudDM3Mzc2ODQ0Mg==",
"reactions": [
],
@ -348,6 +361,7 @@
"url": "https://github.com/decentralion"
},
"body": "And the maintainer said, \"Let there be comments!\"",
"createdAt": "2018-03-16T16:27:41Z",
"id": "MDEyOklzc3VlQ29tbWVudDM3Mzc2ODUzOA==",
"reactions": [
],
@ -362,6 +376,7 @@
"url": "https://github.com/decentralion"
},
"body": "This comment references an #2, which itself references an issue. This comment is thus allows us to test that in-references are not included when requesting a Post's references.",
"createdAt": "2018-04-29T03:41:47Z",
"id": "MDEyOklzc3VlQ29tbWVudDM4NTIyMzMxNg==",
"reactions": [
],
@ -376,12 +391,14 @@
"url": "https://github.com/credbot"
},
"body": "Hi! I'm a bot! Beep boop beep!!",
"createdAt": "2018-08-29T20:59:50Z",
"id": "MDEyOklzc3VlQ29tbWVudDQxNzEwNDA0Nw==",
"reactions": [
],
"url": "https://github.com/sourcecred/example-github/issues/6#issuecomment-417104047"
}
],
"createdAt": "2018-03-16T16:27:04Z",
"id": "MDU6SXNzdWUzMDU5OTM3NzM=",
"number": 6,
"reactions": [
@ -400,6 +417,7 @@
"body": "Deal with this, naive string display algorithms!!!!!",
"comments": [
],
"createdAt": "2018-03-20T18:19:09Z",
"id": "MDU6SXNzdWUzMDY5ODM1NTI=",
"number": 7,
"reactions": [
@ -418,6 +436,7 @@
"body": "Issue with Unicode: ȴሲ𣐳楢👍 :heart: 𐤔𐤁𐤀𐤑𐤍𐤉𐤔𐤌𐤄𐤍𐤍 ❤️\r\nIssue with Unicode: ȴሲ𣐳楢👍 :heart: 𐤔𐤁𐤀𐤑𐤍𐤉𐤔𐤌𐤄𐤍𐤍 ❤️",
"comments": [
],
"createdAt": "2018-03-20T18:24:03Z",
"id": "MDU6SXNzdWUzMDY5ODUzNjc=",
"number": 8,
"reactions": [
@ -436,6 +455,7 @@
"body": "This issue was paired with @wchargin \r\n\r\nIt also attempts to reference itself: #10\r\n\r\nIt also references something twice: #2 #2 ",
"comments": [
],
"createdAt": "2018-06-29T18:30:21Z",
"id": "MDU6SXNzdWUzMzcwOTU0NzM=",
"number": 10,
"reactions": [
@ -457,6 +477,7 @@
"__typename": "IssueComment",
"author": null,
"body": "Hello. :ghost: ",
"createdAt": "2018-09-12T21:59:05Z",
"id": "MDEyOklzc3VlQ29tbWVudDQyMDgxMTg3Mg==",
"reactions": [
],
@ -471,6 +492,7 @@
"url": "https://github.com/wchargin"
},
"body": "[Here is a screenshot of the thread at this point, prior to account deletion.](https://user-images.githubusercontent.com/4317806/45455614-8c4fe600-b69c-11e8-902e-aec65d7403e6.png)\r\n\r\nThe user has GraphQL ID `MDQ6VXNlcjQzMjIyMTkw` and database ID `43222190`.\r\n\r\nThe previous comment has GraphQL ID `MDEyOklzc3VlQ29tbWVudDQyMDgxMTg3Mg==` and database `420811872`.\r\n",
"createdAt": "2018-09-12T22:03:33Z",
"id": "MDEyOklzc3VlQ29tbWVudDQyMDgxMzAxMw==",
"reactions": [
],
@ -480,6 +502,7 @@
"__typename": "IssueComment",
"author": null,
"body": "My time in this life draws to a close. :wave: ",
"createdAt": "2018-09-12T22:04:18Z",
"id": "MDEyOklzc3VlQ29tbWVudDQyMDgxMzIwNg==",
"reactions": [
{
@ -538,12 +561,14 @@
"url": "https://github.com/decentralion"
},
"body": ":skull: :ghost:\r\nRIP",
"createdAt": "2018-09-12T22:06:05Z",
"id": "MDEyOklzc3VlQ29tbWVudDQyMDgxMzYyMQ==",
"reactions": [
],
"url": "https://github.com/sourcecred/example-github/issues/11#issuecomment-420813621"
}
],
"createdAt": "2018-09-12T21:57:59Z",
"id": "MDU6SXNzdWUzNTk2Njc4Mjk=",
"number": 11,
"reactions": [
@ -562,6 +587,7 @@
"body": "By url: https://github.com/sourcecred/example-github/commit/ec91adb718a6045b492303f00d8e8beb957dc780\r\n\r\nBy hash: ecc889dc94cf6da17ae6eab5bb7b7155f577519d\r\n\r\nHash from another repo: 3715ddfb8d4c4fd2a6f6af75488c82f84c92ec2f (example-git in this case)",
"comments": [
],
"createdAt": "2018-09-13T22:34:46Z",
"id": "MDU6SXNzdWUzNjAwOTExMDc=",
"number": 12,
"reactions": [
@ -591,6 +617,7 @@
"body": "I'm reacting to this with every emoji.",
"comments": [
],
"createdAt": "2018-09-13T22:35:37Z",
"id": "MDU6SXNzdWUzNjAwOTEzMTQ=",
"number": 13,
"reactions": [
@ -715,12 +742,14 @@
"url": "https://github.com/decentralion"
},
"body": "It seems apropos to reference something from a pull request comment... eg: #2 ",
"createdAt": "2018-02-28T08:43:40Z",
"id": "MDEyOklzc3VlQ29tbWVudDM2OTE2MjIyMg==",
"reactions": [
],
"url": "https://github.com/sourcecred/example-github/pull/3#issuecomment-369162222"
}
],
"createdAt": "2018-02-28T08:43:19Z",
"deletions": 0,
"id": "MDExOlB1bGxSZXF1ZXN0MTcxODg3NzQx",
"mergeCommit": {
@ -823,6 +852,7 @@
"url": "https://github.com/wchargin"
},
"body": "In retrospect, this was an excellent PR.",
"createdAt": "2018-06-12T00:46:20Z",
"id": "MDEyOklzc3VlQ29tbWVudDM5NjQzMDQ2NA==",
"reactions": [
{
@ -851,6 +881,7 @@
"url": "https://github.com/sourcecred/example-github/pull/5#issuecomment-396430464"
}
],
"createdAt": "2018-02-28T08:47:16Z",
"deletions": 0,
"id": "MDExOlB1bGxSZXF1ZXN0MTcxODg4NTIy",
"mergeCommit": {
@ -966,6 +997,7 @@
"url": "https://github.com/wchargin"
},
"body": "seems a bit capricious",
"createdAt": "2018-03-01T04:23:30Z",
"id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE3MTQ2MDE5OA==",
"reactions": [
{
@ -1104,6 +1136,7 @@
"url": "https://github.com/sourcecred/example-github/pull/5#discussion_r171460198"
}
],
"createdAt": "2018-03-01T04:23:30Z",
"id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTAwMzEzODk5",
"state": "CHANGES_REQUESTED",
"url": "https://github.com/sourcecred/example-github/pull/5#pullrequestreview-100313899"
@ -1119,6 +1152,7 @@
"body": "I'm sold",
"comments": [
],
"createdAt": "2018-03-01T04:24:56Z",
"id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTAwMzE0MDM4",
"state": "APPROVED",
"url": "https://github.com/sourcecred/example-github/pull/5#pullrequestreview-100314038"
@ -1139,6 +1173,7 @@
"body": "Nominally paired with @wchargin",
"comments": [
],
"createdAt": "2018-05-03T18:53:15Z",
"deletions": 0,
"id": "MDExOlB1bGxSZXF1ZXN0MTg1ODA2MTU3",
"mergeCommit": null,

View File

@ -45,6 +45,7 @@ export type Issue = {|
+author: null | Actor,
+body: String,
+comments: $ReadOnlyArray<null | IssueComment>,
+createdAt: DateTime,
+id: string,
+number: Int,
+reactions: $ReadOnlyArray<null | Reaction>,
@ -56,6 +57,7 @@ export type IssueComment = {|
+__typename: "IssueComment",
+author: null | Actor,
+body: String,
+createdAt: DateTime,
+id: string,
+reactions: $ReadOnlyArray<null | Reaction>,
+url: URI,
@ -74,6 +76,7 @@ export type PullRequest = {|
+author: null | Actor,
+body: String,
+comments: $ReadOnlyArray<null | IssueComment>,
+createdAt: DateTime,
+deletions: Int,
+id: string,
+mergeCommit: null | Commit,
@ -89,6 +92,7 @@ export type PullRequestReview = {|
+author: null | Actor,
+body: String,
+comments: $ReadOnlyArray<null | PullRequestReviewComment>,
+createdAt: DateTime,
+id: string,
+state: PullRequestReviewState,
+url: URI,
@ -98,6 +102,7 @@ export type PullRequestReviewComment = {|
+__typename: "PullRequestReviewComment",
+author: null | Actor,
+body: String,
+createdAt: DateTime,
+id: string,
+reactions: $ReadOnlyArray<null | Reaction>,
+url: URI,
@ -169,6 +174,7 @@ export type Ref = {|
export type Repository = {|
+__typename: "Repository",
+createdAt: DateTime,
+defaultBranchRef: null | Ref,
+id: string,
+issues: $ReadOnlyArray<null | Issue>,

View File

@ -55,6 +55,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
const repository: Repository = {
__typename: "Repository",
id: "repo:my-repo",
createdAt: "2019-05-20T22:52:07Z",
issues: [
{
__typename: "Issue",
@ -66,6 +67,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
author: authors.steven(),
comments: [],
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
},
{
__typename: "Issue",
@ -76,6 +78,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
body: "it is me, @steven\n\nPaired with: @pearl",
author: authors.steven(),
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
comments: [
{
__typename: "IssueComment",
@ -84,6 +87,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
body: "parry parry thrust @pearl\nparry parry thrust @steven",
author: authors.holo(),
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
},
{
__typename: "IssueComment",
@ -92,6 +96,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
body: "@holo-pearl: stop!",
author: authors.steven(),
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
},
{
__typename: "IssueComment",
@ -100,6 +105,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
body: "@amethyst @garnet why aren't you helping",
author: authors.pearl(),
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
},
{
__typename: "IssueComment",
@ -108,6 +114,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
body: "@amethyst! come quickly, @amethyst!",
author: authors.garnet(),
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
},
{
__typename: "IssueComment",
@ -116,6 +123,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
body: "i am busy fighting @boomerang-blade guy",
author: authors.amethyst(),
reactions: [],
createdAt: "2019-05-20T22:52:07Z",
},
],
},
@ -135,6 +143,7 @@ describe("plugins/github/heuristics/mentionsAuthorReference", () => {
comments: [],
author: authors.steven(),
reviews: [],
createdAt: "2019-05-20T22:52:07Z",
},
],
url: "https://github.com/my-owner/my-repo",

View File

@ -28,6 +28,8 @@ import {
reviewCommentUrlToId,
} from "./urlIdParse";
export type MsSinceEpoch = number;
const COMPAT_INFO = {
type: "sourcecred/github/relationalView",
version: "0.2.0",
@ -298,6 +300,7 @@ export class RelationalView {
pulls: expectAllNonNull(json, "pullRequests", json.pullRequests).map(
(x) => this._addPull(address, x)
),
createdAt: +new Date(json.createdAt),
};
const raw = N.toRaw(address);
this._repos.set(raw, entry);
@ -339,6 +342,7 @@ export class RelationalView {
reactions: expectAllNonNull(json, "reactions", json.reactions).map((x) =>
this._addReaction(x)
),
createdAt: +new Date(json.createdAt),
};
this._issues.set(N.toRaw(address), entry);
return address;
@ -421,6 +425,7 @@ export class RelationalView {
reactions: expectAllNonNull(json, "reactions", json.reactions).map((x) =>
this._addReaction(x)
),
createdAt: +new Date(json.createdAt),
};
this._pulls.set(N.toRaw(address), entry);
return address;
@ -441,6 +446,7 @@ export class RelationalView {
),
body: json.body,
authors: this._addNullableAuthor(json.author),
createdAt: +new Date(json.createdAt),
};
this._reviews.set(N.toRaw(address), entry);
return address;
@ -473,6 +479,7 @@ export class RelationalView {
reactions: expectAllNonNull(json, "reactions", json.reactions).map((x) =>
this._addReaction(x)
),
createdAt: +new Date(json.createdAt),
};
this._comments.set(N.toRaw(address), entry);
return address;
@ -719,6 +726,7 @@ type RepoEntry = {|
+url: string,
+issues: IssueAddress[],
+pulls: PullAddress[],
+createdAt: MsSinceEpoch,
|};
export class Repo extends _Entity<RepoEntry> {
@ -746,6 +754,9 @@ export class Repo extends _Entity<RepoEntry> {
referencedBy(): Iterator<TextContentEntity> {
return this._view._referencedBy(this);
}
createdAt(): MsSinceEpoch {
return this._entry.createdAt;
}
}
type IssueEntry = {|
@ -756,6 +767,7 @@ type IssueEntry = {|
+comments: CommentAddress[],
+authors: UserlikeAddress[],
+reactions: ReactionRecord[],
+createdAt: MsSinceEpoch,
|};
export class Issue extends _Entity<IssueEntry> {
@ -776,6 +788,9 @@ export class Issue extends _Entity<IssueEntry> {
body(): string {
return this._entry.body;
}
createdAt(): MsSinceEpoch {
return this._entry.createdAt;
}
*comments(): Iterator<Comment> {
for (const address of this._entry.comments) {
const comment = this._view.comment(address);
@ -808,6 +823,7 @@ type PullEntry = {|
+deletions: number,
+authors: UserlikeAddress[],
+reactions: ReactionRecord[],
+createdAt: MsSinceEpoch,
|};
export class Pull extends _Entity<PullEntry> {
@ -837,6 +853,9 @@ export class Pull extends _Entity<PullEntry> {
mergedAs(): ?GitNode.CommitAddress {
return this._entry.mergedAs;
}
createdAt(): MsSinceEpoch {
return this._entry.createdAt;
}
*reviews(): Iterator<Review> {
for (const address of this._entry.reviews) {
const review = this._view.review(address);
@ -870,6 +889,7 @@ type ReviewEntry = {|
+comments: CommentAddress[],
+state: T.PullRequestReviewState,
+authors: UserlikeAddress[],
+createdAt: MsSinceEpoch,
|};
export class Review extends _Entity<ReviewEntry> {
@ -896,6 +916,9 @@ export class Review extends _Entity<ReviewEntry> {
authors(): Iterator<Userlike> {
return getAuthors(this._view, this._entry);
}
createdAt(): MsSinceEpoch {
return this._entry.createdAt;
}
references(): Iterator<ReferentEntity> {
return this._view._references(this);
}
@ -910,6 +933,7 @@ type CommentEntry = {|
+url: string,
+authors: UserlikeAddress[],
+reactions: ReactionRecord[],
+createdAt: MsSinceEpoch,
|};
export class Comment extends _Entity<CommentEntry> {
@ -937,6 +961,9 @@ export class Comment extends _Entity<CommentEntry> {
body(): string {
return this._entry.body;
}
createdAt(): MsSinceEpoch {
return this._entry.createdAt;
}
authors(): Iterator<Userlike> {
return getAuthors(this._view, this._entry);
}

View File

@ -83,6 +83,7 @@ describe("plugins/github/relationalView", () => {
has("owner", () => entity.owner());
has("name", () => entity.name());
has("url", () => entity.url());
has("createdAt", () => entity.createdAt());
hasEntities("issues", () => entity.issues());
hasEntities("pulls", () => entity.pulls());
});
@ -95,6 +96,7 @@ describe("plugins/github/relationalView", () => {
has("title", () => entity.title());
has("url", () => entity.url());
has("parent", () => entity.parent());
has("createdAt", () => entity.createdAt());
hasEntities("comments", () => entity.comments());
hasEntities("authors", () => entity.authors());
has("reactions", () => entity.reactions());
@ -115,6 +117,7 @@ describe("plugins/github/relationalView", () => {
hasEntities("comments", () => entity.comments());
hasEntities("authors", () => entity.authors());
has("reactions", () => entity.reactions());
has("createdAt", () => entity.createdAt());
});
const review = Array.from(pull.reviews())[0];
@ -126,6 +129,7 @@ describe("plugins/github/relationalView", () => {
has("parent", () => entity.parent());
hasEntities("comments", () => entity.comments());
hasEntities("authors", () => entity.authors());
has("createdAt", () => entity.createdAt());
});
const comment = Array.from(review.comments())[0];
@ -136,6 +140,7 @@ describe("plugins/github/relationalView", () => {
has("parent", () => entity.parent());
hasEntities("authors", () => entity.authors());
has("reactions", () => entity.reactions());
has("createdAt", () => entity.createdAt());
});
const commit = Array.from(view.commits())[0];

View File

@ -36,6 +36,7 @@ export default function schema(): Schema.Schema {
issues: s.connection("Issue"),
pullRequests: s.connection("PullRequest"),
defaultBranchRef: s.node("Ref"),
createdAt: s.primitive(s.nonNull("DateTime")),
}),
Issue: s.object({
id: s.id(),
@ -46,6 +47,7 @@ export default function schema(): Schema.Schema {
author: s.node("Actor"),
comments: s.connection("IssueComment"),
reactions: s.connection("Reaction"),
createdAt: s.primitive(s.nonNull("DateTime")),
}),
PullRequest: s.object({
id: s.id(),
@ -60,6 +62,7 @@ export default function schema(): Schema.Schema {
comments: s.connection("IssueComment"), // yes, PRs have IssueComments
reviews: s.connection("PullRequestReview"),
reactions: s.connection("Reaction"),
createdAt: s.primitive(s.nonNull("DateTime")),
}),
IssueComment: s.object({
id: s.id(),
@ -67,6 +70,7 @@ export default function schema(): Schema.Schema {
body: s.primitive(s.nonNull("String")),
author: s.node("Actor"),
reactions: s.connection("Reaction"),
createdAt: s.primitive(s.nonNull("DateTime")),
}),
PullRequestReview: s.object({
id: s.id(),
@ -75,6 +79,7 @@ export default function schema(): Schema.Schema {
author: s.node("Actor"),
state: s.primitive(s.nonNull("PullRequestReviewState")),
comments: s.connection("PullRequestReviewComment"),
createdAt: s.primitive(s.nonNull("DateTime")),
}),
PullRequestReviewComment: s.object({
id: s.id(),
@ -82,6 +87,7 @@ export default function schema(): Schema.Schema {
body: s.primitive(s.nonNull("String")),
author: s.node("Actor"),
reactions: s.connection("Reaction"),
createdAt: s.primitive(s.nonNull("DateTime")),
}),
Reaction: s.object({
id: s.id(),