Skip to content
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

Add queries and services #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion client/src/constants/config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SERVER_URL = 'http://localhost:4000';
export const SERVER_URL = 'http://127.0.0.1:5000/graphql';
11 changes: 11 additions & 0 deletions client/src/edgeServer/getAcquisitions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from '@apollo/client';
import { GET_COMPANY_ACQUISITIONS_BY_NAME } from '@edgeServer/queries';

export const useGetAcquisitions = (companyName) => {
const response = useQuery(GET_COMPANY_ACQUISITIONS_BY_NAME, {
variables: { name: companyName },
skip: !companyName,
});

return response;
};
11 changes: 11 additions & 0 deletions client/src/edgeServer/getCompanyInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from '@apollo/client';
import { GET_COMPANY_INFO_BY_NAME } from '@edgeServer/queries';

export const useGetCompanyInfoByName = (companyName) => {
const response = useQuery(GET_COMPANY_INFO_BY_NAME, {
variables: { name: companyName },
skip: !companyName,
});

return response;
};
11 changes: 11 additions & 0 deletions client/src/edgeServer/getEngagement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from '@apollo/client';
import { GET_COMPANY_ENGAGEMENT_BY_NAME } from '@edgeServer/queries';

export const useGetEngagement = (companyName) => {
const response = useQuery(GET_COMPANY_ENGAGEMENT_BY_NAME, {
variables: { name: companyName },
skip: !companyName,
});

return response;
};
11 changes: 11 additions & 0 deletions client/src/edgeServer/getRevenue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from '@apollo/client';
import { GET_COMPANY_REVENUE_BY_NAME } from '@edgeServer/queries';

export const useGetRevenue = (companyName) => {
const response = useQuery(GET_COMPANY_REVENUE_BY_NAME, {
variables: { name: companyName },
skip: !companyName,
});

return response;
};
11 changes: 11 additions & 0 deletions client/src/edgeServer/getUnitEconomy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from '@apollo/client';
import { GET_COMPANY_UNIT_ECONOMY_BY_NAME } from '@edgeServer/queries';

export const useGetUnitEconomy = (companyName) => {
const response = useQuery(GET_COMPANY_UNIT_ECONOMY_BY_NAME, {
variables: { name: companyName },
skip: !companyName,
});

return response;
};
96 changes: 84 additions & 12 deletions client/src/edgeServer/queries.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,86 @@
import { gql } from '@apollo/client';

export const GET_COMPANY_BY_NAME = gql`
query company(name: "Apple") {
id
name
cik
sic
symbol
filingStart {
quarter
year
}
}`;
export const GET_COMPANY_INFO_BY_NAME = gql`
query company($name: String!) {
company(name: $name) {
id
name
cik
sic
symbol
filingStart {
quarter
year
}
}
}
`;

export const GET_COMPANY_ACQUISITIONS_BY_NAME = gql`
query company($name: String!) {
company(name: $name) {
filingStart {
quarter
year
}
acquisition {
leads
accounts
conversion
salesCycle
cac
}
}
}
`;

export const GET_COMPANY_ENGAGEMENT_BY_NAME = gql`
query company($name: String!) {
company(name: $name) {
filingStart {
quarter
year
}
engagement {
users
penetration
nps
}
}
}
`;

export const GET_COMPANY_REVENUE_BY_NAME = gql`
query company($name: String!) {
company(name: $name) {
filingStart {
quarter
year
}
revenue {
rr
growth
arpa
acv
churnRate
accountDist
}
}
}
`;

export const GET_COMPANY_UNIT_ECONOMY_BY_NAME = gql`
query company($name: String!) {
company(name: $name) {
filingStart {
quarter
year
}
unitEcon {
ltv
ltvRatio
payback
}
}
}
`;
13 changes: 11 additions & 2 deletions client/src/layouts/companyDashboard/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import React from 'react';
import { useParams } from 'react-router-dom';
// import { useGetCompanyInfoByName } from '@edgeServer/getCompanyInfo';
// import { useGetAcquisitions } from '@edgeServer/getAcquisitions';
// import { useGetEngagement } from '@edgeServer/getEngagement';
// import { useGetRevenue } from '@edgeServer/getRevenue';

const CompanyDashboard = () => {
const { companyName } = useParams();
console.log(companyName);
return <div>CompanyDashboard</div>;
// const companyInfoGQL = useGetCompanyInfoByName(companyName);
// const acquisitionsGQL = useGetAcquisitions(companyName);
// const engagementGQL = useGetEngagement(companyName);
// const revenueGQL = useGetRevenue(companyName);

// console.log(revenueGQL);
return <div>CompanyDashboard | {companyName}</div>;
};

export default CompanyDashboard;