-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #698 from basedosdados/feat/quem-somos
Feat/quem somos
- Loading branch information
Showing
5 changed files
with
221 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import axios from "axios"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function getAllPeople() { | ||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
data: { | ||
query: ` | ||
query { | ||
allAccount { | ||
edges { | ||
node { | ||
firstName | ||
lastName | ||
description | ||
website | ||
github | ||
picture | ||
isActiveStaff | ||
careers { | ||
edges { | ||
node { | ||
_id | ||
team | ||
role | ||
startAt | ||
endAt | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
} | ||
}) | ||
const result = res?.data?.data?.allAccount?.edges | ||
const data = result.filter(item => item.node.isActiveStaff === 'true') | ||
return data | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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,39 @@ | ||
import axios from "axios"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function getAllTeams() { | ||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
data: { | ||
query: ` | ||
query { | ||
allCareer { | ||
edges { | ||
node { | ||
team | ||
} | ||
} | ||
} | ||
} | ||
` | ||
} | ||
}) | ||
const result = res?.data?.data?.allCareer?.edges | ||
const teamsSet = new Set() | ||
|
||
result.forEach(item => { | ||
const team = item.node.team.trim() | ||
if (team !== "") { | ||
teamsSet.add(team) | ||
} | ||
}) | ||
|
||
const data = Array.from(teamsSet) | ||
return data | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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,48 @@ | ||
import axios from "axios"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function getCareerPeople(team) { | ||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
data: { | ||
query: ` | ||
query { | ||
allAccount (careers_Team: "${team}"){ | ||
edges { | ||
node { | ||
firstName | ||
lastName | ||
description | ||
website | ||
github | ||
picture | ||
careers { | ||
edges { | ||
node { | ||
_id | ||
team | ||
role | ||
startAt | ||
endAt | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
} | ||
}) | ||
const data = res?.data?.data?.allAccount?.edges | ||
return data | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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,7 +1,13 @@ | ||
import getTeams from "./getTeams" | ||
import getPeople from "./getPeople" | ||
import getTeams from "./getTeams"; | ||
import getPeople from "./getPeople"; | ||
import getAllPeople from "./getAllPeople"; | ||
import getCareerPeople from "./getCareerPeople"; | ||
import getAllTeams from "./getAllTeams"; | ||
|
||
export { | ||
getTeams, | ||
getPeople | ||
getPeople, | ||
getAllPeople, | ||
getCareerPeople, | ||
getAllTeams | ||
} |
Oops, something went wrong.