Browse Source

Adds fields to Issues

main
Keith Daulton 1 year ago
committed by Keith Daulton
parent
commit
a322bf857c
4 changed files with 46 additions and 25 deletions
  1. +1
    -1
      .vscode/queries.github-graphql-nb
  2. +11
    -0
      src/git/models/issue.ts
  3. +20
    -19
      src/plus/github/github.ts
  4. +14
    -5
      src/plus/github/models.ts

+ 1
- 1
.vscode/queries.github-graphql-nb
File diff suppressed because it is too large
View File


+ 11
- 0
src/git/models/issue.ts View File

@ -29,10 +29,16 @@ export interface IssueMember {
url: string;
}
export interface IssueRepository {
owner: string;
repo: string;
}
export interface IssueShape extends IssueOrPullRequest {
updatedDate: Date;
author: IssueMember;
assignees: IssueMember[];
repository: IssueRepository;
labels?: IssueLabel[];
commentsCount?: number;
thumbsUpCount?: number;
@ -143,6 +149,10 @@ export function serializeIssue(value: IssueShape): IssueShape {
avatarUrl: value.author.avatarUrl,
url: value.author.url,
},
repository: {
owner: value.repository.owner,
repo: value.repository.repo,
},
assignees: value.assignees.map(assignee => ({
name: assignee.name,
avatarUrl: assignee.avatarUrl,
@ -173,6 +183,7 @@ export class Issue implements IssueShape {
public readonly closed: boolean,
public readonly updatedDate: Date,
public readonly author: IssueMember,
public readonly repository: IssueRepository,
public readonly assignees: IssueMember[],
public readonly closedDate?: Date,
public readonly labels?: IssueLabel[],

+ 20
- 19
src/plus/github/github.ts View File

@ -2571,23 +2571,6 @@ totalCommentsCount
const issueNodeProperties = `
... on Issue {
number
title
url
createdAt
closedAt
updatedAt
author {
login
avatarUrl
url
}
repository {
name
owner {
login
}
}
assignees(first: 100) {
nodes {
login
@ -2595,6 +2578,21 @@ const issueNodeProperties = `
avatarUrl
}
}
author {
login
avatarUrl
url
}
comments {
totalCount
}
number
title
url
createdAt
closedAt
closed
updatedAt
labels(first: 20) {
nodes {
color
@ -2604,8 +2602,11 @@ const issueNodeProperties = `
reactions(content: THUMBS_UP) {
totalCount
}
comments {
totalCount
repository {
name
owner {
login
}
}
}
`;

+ 14
- 5
src/plus/github/models.ts View File

@ -95,14 +95,19 @@ export interface GitHubPullRequest {
export interface GitHubDetailedIssue extends GitHubIssueOrPullRequest {
date: Date;
updatedDate: Date;
closedDate: Date;
updatedAt: Date;
author: {
login: string;
avatarUrl: string;
url: string;
};
assignees: { nodes: IssueMember[] };
repository: {
name: string;
owner: {
login: string;
};
};
labels?: { nodes: IssueLabel[] };
reactions?: {
totalCount: number;
@ -302,20 +307,24 @@ export namespace GitHubDetailedIssue {
String(value.number),
value.title,
value.url,
value.date,
new Date(value.createdAt),
value.closed,
value.updatedDate,
new Date(value.updatedAt),
{
name: value.author.login,
avatarUrl: value.author.avatarUrl,
url: value.author.url,
},
{
owner: value.repository.owner.login,
repo: value.repository.name,
},
value.assignees.nodes.map(assignee => ({
name: assignee.name,
avatarUrl: assignee.avatarUrl,
url: assignee.url,
})),
value.closedDate,
value.closedAt == null ? undefined : new Date(value.closedAt),
value.labels?.nodes == null
? undefined
: value.labels.nodes.map(label => ({

Loading…
Cancel
Save