-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pmp-api): get repository reviewers
Get reviewers of every PR in GitHub, instead of reviewers PRs. References #17
- Loading branch information
1 parent
0a4c2cc
commit 623467b
Showing
8 changed files
with
61 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../pmp-api/api-service/repository/data-access/src/lib/domain/entities/github-user.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...-service/repository/data-access/src/lib/domain/interfaces/user-model-with-pr.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { PrModel, UserModel } from '@pimp-my-pr/pmp-api/api-service/repository/domain'; | ||
|
||
export interface UserModelWithPr { | ||
reviewer: UserModel; | ||
prs: PrModel[]; | ||
} |
17 changes: 17 additions & 0 deletions
17
.../pmp-api/api-service/repository/data-access/src/lib/mappers/custom-user-with-pr.mapper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Mapper } from '@pimp-my-pr/pmp-api/shared/domain'; | ||
import { UserModelWithPr } from '../domain/interfaces/user-model-with-pr.interface'; | ||
import { PrModel, UserModel } from '@pimp-my-pr/pmp-api/api-service/repository/domain'; | ||
import { NotImplementedException } from '@nestjs/common'; | ||
|
||
export class CustomUserWithPrMapper implements Mapper<[UserModel, PrModel[]], UserModelWithPr> { | ||
mapFrom(param: [UserModel, PrModel[]]): UserModelWithPr { | ||
return { | ||
reviewer: param[0], | ||
prs: param[1] | ||
}; | ||
} | ||
|
||
mapTo(param: UserModelWithPr): [UserModel, PrModel[]] { | ||
throw new NotImplementedException('Mapping to user model with pr format is not implemented'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
libs/pmp-api/api-service/repository/domain/src/lib/models/user.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export class UserModel { | ||
name: string; | ||
id: string; | ||
id: number; | ||
avatarUrl: string; | ||
contributions: number; | ||
} |
10 changes: 3 additions & 7 deletions
10
libs/pmp-api/api-service/repository/domain/src/lib/read-models/pr-with-changes.read-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import { | ||
PrChanges, | ||
PrModel | ||
} from '@pimp-my-pr/pmp-api/api-service/repository/domain'; | ||
import { PrChanges, PrModel } from '@pimp-my-pr/pmp-api/api-service/repository/domain'; | ||
|
||
export class PrWithChangesReadModel { | ||
linesOfCodeToCheck: number; | ||
createdAt: Date; | ||
|
||
constructor(private pr: PrModel, private changes: PrChanges) { | ||
constructor(protected pr: PrModel, protected changes: PrChanges) { | ||
this.createdAt = pr.createdAt; | ||
this.linesOfCodeToCheck = | ||
changes.additions + changes.changes + changes.deletions; | ||
this.linesOfCodeToCheck = changes.additions + changes.changes + changes.deletions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters