-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] Feature/ita profiles collaborators #106 and #107 #111
base: develop
Are you sure you want to change the base?
Changes from all commits
831324d
f3687a0
ba75e2b
c105a2f
4f0aec8
611047a
bfa1dcd
98cf763
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -15,6 +15,8 @@ public function index($area) | |||||||||||||||||||||||||||
return $this->collaboratorItaWiki(); | ||||||||||||||||||||||||||||
} elseif ($area === 'challenges') { | ||||||||||||||||||||||||||||
return $this->collaboratorItaChallenges(); | ||||||||||||||||||||||||||||
} elseif ($area === 'profiles') { | ||||||||||||||||||||||||||||
return $this->collaboratorItaProfiles(); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
return response()->json([ | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've found another way to approach this:
Suggested change
|
||||||||||||||||||||||||||||
|
@@ -24,7 +26,6 @@ public function index($area) | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
public function collaboratorLogic($collaborator) | ||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$url = env('URL_SERVER_API', 'https://api.github.com'); | ||||||||||||||||||||||||||||
$response = Http::withToken(env('MY_TOKEN'))->get($url.$collaborator); | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the token ba passed by a query parameter? I reckon frontend users won't be able to edit .env file. |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
@@ -40,7 +41,6 @@ public function collaboratorLogic($collaborator) | |||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
return $allCollaborators; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
public function uniqueCollaborators(...$arrays) | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function it's not needed by aplicate the change suggested at L61. And that change can be applied at the rest of methods |
||||||||||||||||||||||||||||
|
@@ -60,7 +60,6 @@ public function uniqueCollaborators(...$arrays) | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
public function collaboratorLanding() | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to change the method name if suggestion at
Suggested change
|
||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$collaboratorPhp = '/ita-landing-backend/collaborators?affiliation=direct'; | ||||||||||||||||||||||||||||
$collaboratorReact = '/ita-landing-frontend/collaborators?affiliation=direct'; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
@@ -78,7 +77,11 @@ public function collaboratorItaWiki() | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$collaboratorWiki = '/ita-wiki/collaborators?affiliation=direct'; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
return $this->collaboratorLogic($collaboratorWiki); | ||||||||||||||||||||||||||||
$wiki = $this->collaboratorLogic($collaboratorWiki); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$uniqueCollaborators = $this->uniqueCollaborators($wiki); | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Applying the L61 suggestion we also avoid the following SonarCloud message: |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
return $uniqueCollaborators; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
@@ -95,4 +98,17 @@ public function collaboratorItaChallenges() | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
return $uniqueCollaborators; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
public function collaboratorItaProfiles() | ||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||
$collaboratorReactProfiles = '/ita-profiles-frontend/collaborators?affiliation=direct'; | ||||||||||||||||||||||||||||
$collaboratorPhpProfiles = '/ita-profiles-backend/collaborators?affiliation=direct'; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$reactProfiles = $this->collaboratorLogic($collaboratorReactProfiles); | ||||||||||||||||||||||||||||
$phpProfiles = $this->collaboratorLogic($collaboratorPhpProfiles); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$uniqueCollaborators = $this->uniqueCollaborators($reactProfiles, $phpProfiles); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
return $uniqueCollaborators; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If CollaboratorController::collaboratorLanding() is changed as suggested, we may don't forget to change it here at L57 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't check these tests due the well-known problem with the token of the IT-Academy repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not in the next line at Swagger, I mean, it's all togheter with an asterisc in the middle, at least in my browser.I've tried to fix it but I couldn't.