Skip to content

Commit

Permalink
DPLT-1043 chore: update hasura links to ems links (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
roshaans authored Jul 12, 2023
1 parent 4aaa74d commit 5b71804
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const GRAPHQL_ENDPOINT =
"https://queryapi-hasura-graphql-24ktefolwq-ew.a.run.app";
const APP_OWNER = "dev-queryapi.dataplatform.near";
props.GRAPHQL_ENDPOINT || "https://near-queryapi.api.pagoda.co";
const APP_OWNER = props.APP_OWNER || "dataplatform.near";
const accountId = props.accountId;
const blockHeight =
props.blockHeight === "now" ? "now" : parseInt(props.blockHeight);
Expand All @@ -26,7 +26,7 @@ const commentUrl = `https://alpha.near.org/#/${APP_OWNER}/widget/QueryApi.Exampl
if (!state.content && accountId && blockHeight !== "now") {
const commentQuery = `
query CommentQuery {
roshaan_near_feed_indexer_comments(
dataplatform_near_feed_indexer_comments(
where: {_and: {account_id: {_eq: "${accountId}"}, block_height: {_eq: ${blockHeight}}}}
) {
content
Expand All @@ -44,7 +44,7 @@ query CommentQuery {
`${GRAPHQL_ENDPOINT}/v1/graphql`,
{
method: "POST",
headers: { "x-hasura-role": "roshaan_near" },
headers: { "x-hasura-role": "dataplatform_near" },
body: JSON.stringify({
query: operationsDoc,
variables: variables,
Expand All @@ -57,7 +57,7 @@ query CommentQuery {
fetchGraphQL(commentQuery, "CommentQuery", {}).then((result) => {
if (result.status === 200) {
if (result.body.data) {
const comments = result.body.data.roshaan_near_feed_indexer_comments;
const comments = result.body.data.dataplatform_near_feed_indexer_comments;
if (comments.length > 0) {
const comment = comments[0];
let content = JSON.parse(comment.content);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

const GRAPHQL_ENDPOINT =
"https://queryapi-hasura-graphql-24ktefolwq-ew.a.run.app";
const APP_OWNER = "dev-queryapi.dataplatform.near";
props.GRAPHQL_ENDPOINT || "https://near-queryapi.api.pagoda.co";
const APP_OWNER = props.APP_OWNER || "dataplatform.near";
const item = props.item;

const likes = JSON.parse(props.likes?.length ? props.likes : "[]") ?? [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const GRAPHQL_ENDPOINT =
"https://queryapi-hasura-graphql-24ktefolwq-ew.a.run.app";
const APP_OWNER = "dev-queryapi.dataplatform.near";
props.GRAPHQL_ENDPOINT || "https://near-queryapi.api.pagoda.co";
const APP_OWNER = props.APP_OWNER || "dataplatform.near";
const accountId = props.accountId;
const blockHeight =
props.blockHeight === "now" ? "now" : parseInt(props.blockHeight);
Expand All @@ -26,7 +26,7 @@ if (!state.content || !state.comments || !state.likes) {
console.log("making call again");
const postsQuery = `
query IndexerQuery {
roshaan_near_feed_indexer_posts(
dataplatform_near_feed_indexer_posts(
order_by: {block_height: desc}
where: {_and: {block_height: {_eq: ${blockHeight}}, account_id: {_eq: "${accountId}"}}}
) {
Expand All @@ -51,7 +51,7 @@ query IndexerQuery {
`${GRAPHQL_ENDPOINT}/v1/graphql`,
{
method: "POST",
headers: { "x-hasura-role": "roshaan_near" },
headers: { "x-hasura-role": "dataplatform_near" },
body: JSON.stringify({
query: operationsDoc,
variables: variables,
Expand All @@ -64,7 +64,7 @@ query IndexerQuery {
fetchGraphQL(postsQuery, "IndexerQuery", {}).then((result) => {
if (result.status === 200) {
if (result.body.data) {
const posts = result.body.data.roshaan_near_feed_indexer_posts;
const posts = result.body.data.dataplatform_near_feed_indexer_posts;
if (posts.length > 0) {
const post = posts[0];
let content = JSON.parse(post.content);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const GRAPHQL_ENDPOINT =
props.GRAPHQL_ENDPOINT || "https://queryapi-hasura-graphql-24ktefolwq-ew.a.run.app";
props.GRAPHQL_ENDPOINT || "https://near-queryapi.api.pagoda.co";
const APP_OWNER = props.APP_OWNER || "dataplatform.near";
const accountId = props.accountId;
const commentBlockHeight = parseInt(props.commentBlockHeight);
Expand All @@ -13,7 +13,7 @@ State.init({
});

const parentPostByComment = `query ParentPostByComment {
roshaan_near_feed_indexer_comments(
dataplatform_near_feed_indexer_comments(
where: {_and: {account_id: {_eq: "${accountId}"}, block_height: {_eq: ${commentBlockHeight}}}}
) {
post {
Expand Down Expand Up @@ -49,7 +49,7 @@ function fetchGraphQL(operationsDoc, operationName, variables) {
`${GRAPHQL_ENDPOINT}/v1/graphql`,
{
method: "POST",
headers: { "x-hasura-role": "roshaan_near" },
headers: { "x-hasura-role": "dataplatform_near" },
body: JSON.stringify({
query: operationsDoc,
variables: variables,
Expand All @@ -64,7 +64,7 @@ if (commentBlockHeight) {
(result) => {
if (result.status === 200) {
if (result.body.data) {
const posts = result.body.data.roshaan_near_feed_indexer_comments;
const posts = result.body.data.dataplatform_near_feed_indexer_comments;
if (posts.length > 0) {
const post = posts[0].post;
let content = JSON.parse(post.content);
Expand Down
13 changes: 6 additions & 7 deletions frontend/widgets/examples/feed/src/QueryApi.Examples.Feed.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

const GRAPHQL_ENDPOINT =
props.GRAPHQL_ENDPOINT || "https://queryapi-hasura-graphql-24ktefolwq-ew.a.run.app";
props.GRAPHQL_ENDPOINT || "https://near-queryapi.api.pagoda.co";
const APP_OWNER = props.APP_OWNER || "dataplatform.near";
const LIMIT = 10;
const option = props.postsOrderOption ?? "blockHeight";
Expand Down Expand Up @@ -36,7 +35,7 @@ switch (option) {

const indexerQueries = `
query GetPostsQuery($offset: Int) {
roshaan_near_feed_indexer_posts(order_by: [${querySortFilter} { block_height: desc }], offset: $offset, limit: ${LIMIT}) {
dataplatform_near_feed_indexer_posts(order_by: [${querySortFilter} { block_height: desc }], offset: $offset, limit: ${LIMIT}) {
account_id
block_height
block_timestamp
Expand All @@ -51,7 +50,7 @@ const indexerQueries = `
content
}
}
roshaan_near_feed_indexer_posts_aggregate {
dataplatform_near_feed_indexer_posts_aggregate {
aggregate {
count
}
Expand All @@ -64,7 +63,7 @@ function fetchGraphQL(operationsDoc, operationName, variables) {
`${GRAPHQL_ENDPOINT}/v1/graphql`,
{
method: "POST",
headers: { "x-hasura-role": "roshaan_near" },
headers: { "x-hasura-role": "dataplatform_near" },
body: JSON.stringify({
query: operationsDoc,
variables: variables,
Expand Down Expand Up @@ -112,10 +111,10 @@ const loadMorePosts = () => {
if (result.status === 200) {
let data = result.body.data;
if (data) {
const newPosts = data.roshaan_near_feed_indexer_posts;
const newPosts = data.dataplatform_near_feed_indexer_posts;
console.log(newPosts);
const postsCount =
data.roshaan_near_feed_indexer_posts_aggregate.aggregate.count;
data.dataplatform_near_feed_indexer_posts_aggregate.aggregate.count;
if (newPosts.length > 0) {
State.update({
posts: [...state.posts, ...newPosts],
Expand Down
2 changes: 1 addition & 1 deletion frontend/widgets/examples/feed/src/QueryApi.Feed.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const GRAPHQL_ENDPOINT =
"https://queryapi-hasura-graphql-24ktefolwq-ew.a.run.app";
"https://near-queryapi.api.pagoda.co";
const APP_OWNER = "dataplatform.near";

return (
Expand Down
3 changes: 1 addition & 2 deletions frontend/widgets/examples/feed/src/QueryApi.dev.Feed.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const GRAPHQL_ENDPOINT =
"https://queryapi-hasura-graphql-vcqilefdcq-ew.a.run.app";
"https://near-queryapi.dev.api.pagoda.co";
const APP_OWNER = "dev-queryapi.dataplatform.near";


return (
<Widget
src={`${APP_OWNER}/widget/QueryApi.Examples.Feed`}
Expand Down

0 comments on commit 5b71804

Please sign in to comment.