Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/das/src/api/miners/miners.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,25 @@ export class MinersController {
@ApiOperation({
summary: "Issues authored by a miner",
description:
"Returns every issue the miner has authored since the given date, " +
"including current labels with actor attribution and the PR number " +
"(if any) that solved the issue.",
"Returns issues the miner has authored, with current labels (actor " +
"attribution) and any solving PR. When `since` is provided, returns " +
"OPEN issues created on/after that date plus CLOSED issues closed " +
"on/after that date (scoring window). When `since` is omitted, " +
"returns all currently-OPEN issues with no time bound and no CLOSED " +
"history (open-issue load counting).",
})
@ApiParam({ name: "githubId", description: "GitHub user ID (numeric)" })
@ApiQuery({
name: "since",
required: false,
description:
"ISO timestamp. Defaults to 35 days ago (midnight UTC) if omitted.",
"ISO timestamp. When omitted, the response contains all currently-" +
"OPEN issues with no time bound and no CLOSED history.",
})
async getIssues(
@Param("githubId") githubId: string,
@Query("since") since?: string,
): Promise<unknown> {
return this.miners.getIssues(githubId, MinersService.resolveSince(since));
return this.miners.getIssues(githubId, since ?? null);
}
}
6 changes: 3 additions & 3 deletions packages/das/src/api/miners/miners.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ export class MinersService {

async getIssues(
githubId: string,
since: string,
since: string | null,
): Promise<{
github_id: string;
since: string;
since: string | null;
generated_at: string;
issues: unknown[];
}> {
Expand Down Expand Up @@ -208,7 +208,7 @@ export class MinersService {
FROM issues i
WHERE i.author_github_id = $1
AND (
(i.state = 'OPEN' AND i.created_at >= $2)
(i.state = 'OPEN' AND ($2::timestamptz IS NULL OR i.created_at >= $2))
OR (i.state = 'CLOSED' AND i.closed_at >= $2)
)
ORDER BY i.created_at DESC
Expand Down
Loading