Skip to content

Commit

Permalink
Reorder after and before
Browse files Browse the repository at this point in the history
  • Loading branch information
GODrums committed Sep 20, 2024
1 parent ad71f16 commit dbf2b02
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 31 deletions.
20 changes: 8 additions & 12 deletions server/application-server/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ paths:
- leaderboard
operationId: getLeaderboard
parameters:
- name: before
- name: after
in: query
required: false
schema:
type: string
format: date-time
- name: after
- name: before
in: query
required: false
schema:
Expand Down Expand Up @@ -254,9 +254,8 @@ components:
type: string
state:
type: string
description: |-
State of the PullRequest.
Does not include the state of the merge.
description: "State of the PullRequest.\r\n Does not include the state of\
\ the merge."
enum:
- CLOSED
- OPEN
Expand Down Expand Up @@ -410,15 +409,12 @@ components:
description: Display name of the user.
url:
type: string
description: |-
Unique URL to the user's profile.
Not the website a user can set in their profile.
description: "Unique URL to the user's profile.\r\n Not the website a user\
\ can set in their profile."
avatarUrl:
type: string
description: |-
URL to the user's avatar.
If unavailable, a fallback can be generated from the login, e.g. on Github:
https://github.com/{login}.png
description: "URL to the user's avatar.\r\n If unavailable, a fallback can\
\ be generated from the login, e.g. on Github:\r\n https://github.com/{login}.png"
type:
type: string
description: Type of the user. Used to distinguish between users and bots.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public LeaderboardController(LeaderboardService leaderboardService) {
}

@GetMapping
public ResponseEntity<List<LeaderboardEntry>> getLeaderboard(@RequestParam Optional<OffsetDateTime> before,
@RequestParam Optional<OffsetDateTime> after) {
return ResponseEntity.ok(leaderboardService.createLeaderboard(before, after));
public ResponseEntity<List<LeaderboardEntry>> getLeaderboard(@RequestParam Optional<OffsetDateTime> after,
@RequestParam Optional<OffsetDateTime> before) {
return ResponseEntity.ok(leaderboardService.createLeaderboard(after, before));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public LeaderboardService(UserService userService) {
this.userService = userService;
}

public List<LeaderboardEntry> createLeaderboard(Optional<OffsetDateTime> before, Optional<OffsetDateTime> after) {
public List<LeaderboardEntry> createLeaderboard(Optional<OffsetDateTime> after, Optional<OffsetDateTime> before) {
logger.info("Creating leaderboard dataset");

List<User> users = userService.getAllUsers();
Expand Down
18 changes: 9 additions & 9 deletions webapp/src/app/core/modules/openapi/api/leaderboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@ export class LeaderboardService implements LeaderboardServiceInterface {
}

/**
* @param before
* @param after
* @param before
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getLeaderboard(before?: string, after?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<LeaderboardEntry>>;
public getLeaderboard(before?: string, after?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<LeaderboardEntry>>>;
public getLeaderboard(before?: string, after?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<LeaderboardEntry>>>;
public getLeaderboard(before?: string, after?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public getLeaderboard(after?: string, before?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<LeaderboardEntry>>;
public getLeaderboard(after?: string, before?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<LeaderboardEntry>>>;
public getLeaderboard(after?: string, before?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<LeaderboardEntry>>>;
public getLeaderboard(after?: string, before?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (before !== undefined && before !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>before, 'before');
}
if (after !== undefined && after !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>after, 'after');
}
if (before !== undefined && before !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>before, 'before');
}

let localVarHeaders = this.defaultHeaders;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export interface LeaderboardServiceInterface {
/**
*
*
* @param before
* @param after
* @param before
*/
getLeaderboard(before?: string, after?: string, extraHttpRequestParams?: any): Observable<Array<LeaderboardEntry>>;
getLeaderboard(after?: string, before?: string, extraHttpRequestParams?: any): Observable<Array<LeaderboardEntry>>;

}
2 changes: 1 addition & 1 deletion webapp/src/app/core/modules/openapi/model/pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface PullRequest {
title: string;
url: string;
/**
* State of the PullRequest. Does not include the state of the merge.
* State of the PullRequest. Does not include the state of the merge.
*/
state: PullRequest.StateEnum;
additions?: number;
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/app/core/modules/openapi/model/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export interface User {
*/
name?: string;
/**
* Unique URL to the user\'s profile. Not the website a user can set in their profile.
* Unique URL to the user\'s profile. Not the website a user can set in their profile.
*/
url: string;
/**
* URL to the user\'s avatar. If unavailable, a fallback can be generated from the login, e.g. on Github: https://github.com/{login}.png
* URL to the user\'s avatar. If unavailable, a fallback can be generated from the login, e.g. on Github: https://github.com/{login}.png
*/
avatarUrl?: string;
/**
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class HomeComponent {

query = injectQuery(() => ({
queryKey: ['leaderboard', { after: this.after, before: this.before }],
queryFn: async () => lastValueFrom(this.leaderboardService.getLeaderboard(this.before(), this.after())),
queryFn: async () => lastValueFrom(this.leaderboardService.getLeaderboard(this.after(), this.before())),
gcTime: Infinity
}));
}

0 comments on commit dbf2b02

Please sign in to comment.